in reply to Re: problem with variables
in thread problem with variables

Using sprintf("%.5f",$x) works!! thanks. But it is still strange that if there are more decimal numbers, why they are not printed to the screen ?

Luca

Replies are listed 'Best First'.
Re^3: problem with variables
by davido (Cardinal) on Oct 19, 2005 at 09:09 UTC

    Because they may be thirteen decimal places to the right hand side of the decimal point. If the number, for example, is converted back to base ten as "19.9490000000001", the output will show a rounded-off version that doesn't include the most insignificant digits. In other words, more precision is stored than is displayed. Part of the reason that not all digits are displayed is because of the high liklihood that they're tainted by base-2 to base-10 conversion errors.


    Dave