in reply to floating points and sprintf

Wrong format, he wants '%e' or '%f'.

Oops, replied to the title. Decimal representation of binary fractions problen, see 'perldoc -q round' from perlfaq4..

After Compline,
Zaxo

Replies are listed 'Best First'.
Re: Re: floating points and sprintf
by kennethwlangley (Novice) on Nov 14, 2002 at 15:35 UTC
    Not if he wants to convert a float to an int (check my quote from the perlfunc document). I forgot to include a table of results. Here it is:
    $ ./chksprintf.pl
    147    14700    14700    14700
    147.1  14710    14710    14710
    147.2  14720    14720    14719
    147.3  14730    14730    14730
    147.4  14740    14740    14740