Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^2: RFC: Large Floating Point Numbers - Rounding Errors (not Rounding mode)

by tye (Sage)
on Sep 08, 2011 at 17:00 UTC ( [id://924874]=note: print w/replies, xml ) Need Help??


in reply to Re: RFC: Large Floating Point Numbers - Rounding Errors (Rounding mode)
in thread RFC: Large Floating Point Numbers - Rounding Errors

Nice try. But...

No. It isn't.

YOU are wrong! Wrong! Wrong!

It is just a consequence of switching between base 10 and 2:

#!/usr/bin/perl -wl use strict; for my $n ( 0.000005, 0.000015, 0.000025, 0.000035, 0.000045, 0.000055, 0.000065, 0.000075, 0.000085, 0.000095, ) { printf "%.23f\n", $n; } __END__ 0.00000500000000000000041 0.00001500000000000000038 0.00002500000000000000120 0.00003499999999999999693 0.00004500000000000000283 0.00005500000000000000196 0.00006499999999999999431 0.00007499999999999999343 0.00008500000000000000611 0.00009500000000000000523

Your assumption that 0.000035 is exactly the same as 0.000005 + 3*0.000010 was not correct.

Update: Please show the results for explicitly enumerated values and show more precision on the first value. Or I'll to do that myself a bit later when I will probably again have convenient access to a system with Inline::C installed on it and with _controlfp().

- tye        

  • Comment on Re^2: RFC: Large Floating Point Numbers - Rounding Errors (not Rounding mode)
  • Download Code

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2024-04-25 19:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found