Is Perl 6 Performance Affected by Using Rational Numbers for Decimal Numbers

I understand that Perl 6 implements decimal numbers as rational, where possible, in order to avoid the floating point problems that are present in most other languages.

Did anyone benchmark or understand how this is done?

+4
source share
2 answers

Does Perl 6 Boost the Use of Rational Numbers for Decimals

I think the most useful general answer is "no, not really, but let me elaborate."

If you prefer not to care about accuracy or performance

, P6 , Rat s.

, P6 Rat, 64 , P6 Num ( P6 double float) .

.

, , , , .

, 3.141592e0 / , Num/float literal.

100% -

( Rat; FatRat class; Rational role), 100% , .

wikipedia .


- , ?

, , . # perl6. :

, .

+5

, Perl 6 (Rakudo Star 2017.07), , , , .

script, CSV SVG, , , . , , , script src/core/Rational.Str, ( 6000ms 11000 ). Num ( , ).

, script, , , , -, , .

+2

Source: https://habr.com/ru/post/1687840/


All Articles