Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Rounding off the scale value after decimal point

by swampyankee (Parson)
on Sep 19, 2012 at 02:45 UTC ( #994397=note: print w/ replies, xml ) Need Help??


in reply to Rounding off the scale value after decimal point

Perl will use the floating point library for the C compiler used to build it, so I would expect (but not guarantee) that a C interface to the database would give the same answer as the perl interface.

Double precision only has 15 or 16 significant digits, so the "4" in the right-most place is almost certainly not significant. See, for example,http://www.monash.edu.au/policy/gpnumacc.htm#SignificantFigures.


Information about American English usage here and here. Floating point issues? Please read this before posting. — emc


Comment on Re: Rounding off the scale value after decimal point
Replies are listed 'Best First'.
Re^2: Rounding off the scale value after decimal point
by venu_hs (Novice) on Sep 21, 2012 at 08:27 UTC
    Thank you monks for your responses. I dont want to round off the number. So i started using bignum module to specify the precision as 17. So if a number is actually 500.123, as per the precision of 17, it becomes 500.12300000000000000 which is ideal and intended. But then i would need it as 500.123 Any other perl modules i can use to accomodate this scenario.

      But then i would need it as 500.123 Any other perl modules i can use to accomodate this scenario.

      How odd, either you want the precision or you don't

      You can squash trailing zeros with  $num =~ s/0+$//;

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://994397]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (7)
As of 2015-07-30 00:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (269 votes), past polls