Re: [v][sf]printf additions (#, E, g, G)
| From: | Matt W | Date: | Sat, 22 Jul 2006 07:15:04 +0000 |
| Subject: | Re: [v][sf]printf additions (#, E, g, G) | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-24872@lists.php.net to get a copy of this message | ||
Hi Marcus,
Cool, thanks. I didn't start modifying it yet, but will soon.
Matt
----- Original Message -----
From: "Marcus Boerger"
Sent: Friday, July 21, 2006
> Hello Matt,
>
> sounds good then, keep going.
>
> best regards
> marcus
>
> Friday, July 21, 2006, 10:08:19 AM, you wrote:
>
> > Hi Marcus,
>
> > ----- Original Message -----
> > From: "Marcus Boerger"
> > Sent: Thursday, July 20, 2006 2:21 PM
> > Subject: Re: [PHP-DEV] [v][sf]printf additions (#, E, g, G)
>
> >> Hello Matt,
> >>
> >> Having more conversion specifiers here won't hurt. If it can be done
> >> in a way compatible to other languages especially like C it should be
> >> done in that way. If PHP has already closed the way by choosing
opposite
> >> defaults the opposite should everntually also work.
>
> > Sorry, not sure what you mean in the last sentence as far as the
additions
> > I'm asking about. I agree about compatibility with C's specifiers, but
> > PHP's *printf() has things that C's doesn't (%b; alternate padding
> > specifier) and vice versa (PHP's doesn't support "*" width/precision
> > --
nor
> > does it need to; also no %n). That's why I thought it would be OK to
let #
> > with f/F mean no trailing 0's.
>
> > Other than that, g/G would, of course, be new. Unless it's not needed
if 1)
> > my "alternate form" %f idea is added, or 2) its precision would confuse
> > users since it means "number of significant digits" with g/G, rather
than
> > decimal places.
>
> > # with e/E would include the decimal point even if precision=0
> > # with g/G *wouldn't* strip trailing 0's
> > # with o would include "0" prefix with non-zero result
> > # with x/X would include "0x"/"0X" prefix with non-zero result
>
> > All like C AFAIK, again except %#.3f, for example, wouldn't have
trailing
> > zeros/point. As you can probably tell, I don't like extra 0's unless
> > there's a *need* to always have the same width (same idea with
> > number_format()). :-) I'm sure other PHP users feel the same way and
would
> > like this alternate %f form, even if no other language has it!
>
> >> Best regards,
> >> Marcus
>
> > Thanks for the reply,
> > Matt