Think about Loose Coupling | |
PerlMonks |
significant digits in computationsby daemonchild (Acolyte) |
on Jun 12, 2000 at 11:22 UTC ( [id://17681]=perlquestion: print w/replies, xml ) | Need Help?? |
daemonchild has asked for the wisdom of the Perl Monks concerning the following question:
hello all
i have written a script that does some price calculations based on input thru drop down menus (CGI). It all works, but I am running into problems maintaining the correct number of significant digits in calculations. for example, trailing zeros are just obliterated, eg 2*120.00 = 240 and decimal calculations often end up with 4 or 5 trailing decimals. is there an easy way to specify 2 trailing decimal places? or am i relegated to the following ugly hacks ... much thanks, --steve
Back to
Seekers of Perl Wisdom
|
|