Skip to content

Commit

Permalink
[S32]: Remove 'm' (complex) modifier from sprintf, in hopes of a
Browse files Browse the repository at this point in the history
more unified approach to formatted printing for Perl 6 (e.g.,
what about formatting Rats?).

The idea here is to take a minimalist approach to 'sprintf' --
supplying the conversions that people are familiar with from
other languages and libraries, but be cautious about layering
on new "ad-hoc"-ish options until we have a better plan for
handling them all.  This is addressed further in
#13 .
  • Loading branch information
pmichaud committed Jul 4, 2012
1 parent 0ebf6ac commit f891058
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions S32-setting-library/Str.pod
Expand Up @@ -446,25 +446,21 @@ Perl 5 (non-)compatibility:
n produces a runtime exception
p produces a runtime exception

Modifiers change the meaning of format directives. The most important being
support for complex numbers (a basic type in Perl). Here are all of the
modifiers and what they modify:
Modifiers change the meaning of format directives. At the moment
these are recognized primarily for compatibility with C<printf>
from other languages (notably C and Perl 5), but their exact semantics
are still conjectural.

h interpret integer as native "short" (typically int16)
l interpret integer as native "long" (typically int32 or int64)
ll interpret integer as native "long long" (typically int64)
L interpret integer as native "long long" (typically uint64)
q interpret integer as native "quads" (typically int64 or larger)
m interpret value as a complex number

The C<m> modifier works with C<d,u,o,x,F,E,G,X,E> and C<G> format
directives, and the directive applies to both the real and imaginary
parts of the complex number.

Examples:

sprintf "%ld a big number, %lld a bigger number, %mf complexity\n",
4294967295, 4294967296, 1+2i);
sprintf "%ld a big number, %lld a bigger number\n",
4294967295, 4294967296;

=item fmt

Expand Down

0 comments on commit f891058

Please sign in to comment.