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

Re^3: [Raku] Arcane treatment of doubles and rationals

by holli (Abbot)
on Apr 04, 2021 at 12:59 UTC ( [id://11130801]=note: print w/replies, xml ) Need Help??


in reply to Re^2: [Raku] Arcane treatment of doubles and rationals
in thread [Raku] Arcane treatment of doubles and rationals

There is a loss of precision happening when using the exponential form.
$ raku -e "dd 0.10000000000000006e0" 0.10000000000000006e0 $ raku -e "dd 0.100000000000000006e0" 0.1e0
The exponential form creates a Num which needs to be between -1.7976931348623157e308 to 1.7976931348623158e308. See what Raku considers Infinity.


holli

You can lead your users to water, but alas, you cannot drown them.

Replies are listed 'Best First'.
Re^4: [Raku] Arcane treatment of doubles and rationals
by syphilis (Archbishop) on Apr 04, 2021 at 13:26 UTC
    I'd consider this a bug

    Yes, I think there's something that's definitely not right.
    For a start, there's never any need to assign an 18-significant-digit (decimal) value to a double.
    Whatever value is assigned to a double by the 18-siginificant-digit 0.100000000000000006 will also be assigned by the 17-significant-digit 0.10000000000000001.

    As I said (in the reply to myself that I posted shortly after your post), I will raise the issues with them.

    Cheers,
    Rob
      there's never any need to assign an 18-significant-digit (decimal) value to a double
      You are forcing that by using an exponent.


      holli

      You can lead your users to water, but alas, you cannot drown them.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2024-03-29 14:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found