[php-maint] Bug#613982: Bug#613982: printf generates scientific notation inaccurately

Raphael Geissert geissert at debian.org
Fri Feb 18 20:32:41 UTC 2011

severity 613982 minor


On Friday 18 February 2011 11:03:08 Ronan wrote:
> printf, when outputting a number in scientific
> notation, allows the precision to be specified.
> However, the precision is capped at 40.  If a cap
> has to be set at all, then it should be set at 52,
> because this is the smallest value which allows all
> IEEE double-precision floating-point numbers to be
> output with perfect accuracy.

I don't know why a limit was set in place in the *printf functions, but 
according to the code that does the actual conversion it can handle a 
precision up to 318.

You can workaround it by using number_format btw (which internally uses the 
same formatter as *printf, without the arbitrary limit).

P.S. would be great if you could report it upstream. It would save us some 

Raphael Geissert - Debian Developer
www.debian.org - get.debian.net

More information about the pkg-php-maint mailing list