in reply to Re: Re: Re: Filthy Floats
in thread Filthy Floats
In your case, the value is being handled as a string until you force Perl to treat it as a number (by using it in a multiplication). The result is a floating point value, subject to the inaccuracies described elsewhere. If it comes up with a seemingly exact value sometimes, well, welcome to the mystery :)
I take it the issue here is that you want a leading zero, or some other normalization? If so, then use sprintf to enforce the format you want. Try <%=sprintf("%1.2f",$target)%> for instance.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: Re: Filthy Floats
by THuG (Beadle) on Jul 16, 2001 at 21:22 UTC | |
by TheoPetersen (Priest) on Jul 16, 2001 at 21:58 UTC |