Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Why does Perl 6 math suck less?

by moritz (Cardinal)
on Jan 12, 2011 at 05:45 UTC ( #881807=note: print w/replies, xml ) Need Help??


in reply to Why does perl math suck?

$ perl6 -e 'say 5056.45 + 10112.92 == 15169.37 ?? "as expected" !! "pe +rl math sucks!"' as expected

explanation

Replies are listed 'Best First'.
Re^2: Why does Perl 6 math suck less?
by Anonymous Monk on Jan 12, 2011 at 10:57 UTC
    Just out of curiosity ..
    How does Perl 6 get around this?

      By defaulting to rational numbers that are stored as two integers internally. As explained in the link I provided.

      (Note that floating point numbers are still accessible with by using scientifc notation, eg 0.1e0)

        By defaulting to rational numbers that are stored as two integers internally

        To get the same sort of behaviour with perl5 you could use Math::BigRat or Math::GMPq.

        Any other perl5 alternatives ?

        Cheers,
        Rob
        How is 0.1 stored? as floating point or fixed point or ?

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2018-12-15 10:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many stories does it take before you've heard them all?







    Results (69 votes). Check out past polls.

    Notices?