Re: Found a sprintf() bug inPerl 5.6.1 (and mod_perl)

2002-04-16 Thread Franck PORCHER
I think that if there is a bug, which i'm not convinced of (see below), it's likely to be int(), which may *first* be called by sprintf to cast the floating-point number into an integral format (%03d). Indeed if you run : perl -e '$a=0.57; print int($a * 100)' you get 0.56 . Now,

Found a sprintf() bug inPerl 5.6.1 (and mod_perl)

2002-04-15 Thread Dominique Blas
Sorry, I've found the following bug in mod_perl 1.25 and Perl 5.6.1. Maybe was it already released but in case not here it is : perl -e ' $a=0.57; print sprintf(%03d, $a * 100)' prints 056 instead of 057 Same behaviour with $a=0,58 that prints 057. Of course it works for other values and

Re: Found a sprintf() bug inPerl 5.6.1 (and mod_perl)

2002-04-15 Thread Stas Bekman
Dominique Blas wrote: Sorry, I've found the following bug in mod_perl 1.25 and Perl 5.6.1. Maybe was it already released but in case not here it is : perl -e ' $a=0.57; print sprintf(%03d, $a * 100)' prints 056 instead of 057 Same behaviour with $a=0,58 that prints 057. Of

Re: Found a sprintf() bug inPerl 5.6.1 (and mod_perl)

2002-04-15 Thread Andy Lester
correct -269; that's because it's really more like -268.94315658 instead. Usually, the sprintf, printf, or the POSIX::floor and And in this case, that means: alester@flr4[~/play]$ more sprintf.pl #!/usr/bin/perl -w $a=0.57 * 100;

Re: Found a sprintf() bug inPerl 5.6.1 (and mod_perl)

2002-04-15 Thread Dominique Blas
Thank you for your explanation both of you. alester@flr4[~/play]$ perl sprintf.pl 056 56.9928946 ... In general, the chances that you've found a bug in the language or implementation that's been around as long and is as widely used as Perl 5.6 is preeetty small. I know