Safe addition: Difference between revisions

m
→‎{{header|Raku}}: Fix comment and code: Perl 6 --> Raku
(Rename Perl 6 -> Raku, alphabetize, minor clean-up)
m (→‎{{header|Raku}}: Fix comment and code: Perl 6 --> Raku)
Line 765:
{{works with|Rakudo|2018.12}}
 
Perl 6Raku uses 64 bit IEEE floating points numbers which provide 53 binary digits
of accuracy. If you insist on using floats your answer will be accurate in the range
± 1.1102230246251565e-16. Perl 6Raku actually makes it somewhat difficult to output
an exact stringified float with more than 15 digits of accuracy. It automatically
rounds since it doesn't try to pretend that it is more accurate than that.
 
If you really DO need very high precision and accuracy, Perl 6Raku has native
built-in Rational number support. Rationals are the ratio of two integers, and
are always exact. Standard Rats are limited to 64 bits of precision in the
Line 816:
use Rat::Precise; # module loading is scoped to the enclosing block
my $rat = 1.5**63;
say "\nPerl 6nRaku default stringification for 1.5**63:\n" ~ $rat; # standard stringification
say "\nRat::Precise stringification for 1.5**63:\n" ~$rat.precise; # full precision
}</lang>
Line 835:
Use a module to get full precision.
 
Perl 6Raku default stringification for 1.5**63:
124093581919.64894769782737365038
 
2,392

edits