Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^5: Variables are automatically rounded off in perl (humans)

by BrowserUk (Patriarch)
on Jul 22, 2016 at 08:04 UTC ( [id://1168310]=note: print w/replies, xml ) Need Help??


in reply to Re^4: Variables are automatically rounded off in perl (humans)
in thread Variables are automatically rounded off in perl

but for literal floating point values you would in general have to write them in a number base of a power of two if you want to express (and match) them exactly

You've missed the point.

It is not about representing root3 exactly; it is about displaying and printing the calculated internal value of root3 such that it retains all the available accuracy, so that that same level of accuracy may be restored from the printed value.

This is always possible; but perl does not achieve it.

The point is about reproducibility.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority". I knew I was on the right track :)
In the absence of evidence, opinion is indistinguishable from prejudice.
  • Comment on Re^5: Variables are automatically rounded off in perl (humans)

Replies are listed 'Best First'.
Re^6: Variables are automatically rounded off in perl (humans)
by hexcoder (Curate) on Jul 22, 2016 at 11:03 UTC
    This is always possible...

    I agree (now). Sorry, that was my fault. Decimal values like 0.2 cannot be represented exactly with finite precision in number base two, but it works certainly the other way round since all fractions of powers of two don't have repeating decimals.

Log In?
Username:
Password:

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

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

    No recent polls found