in reply to Decimal Floating Point (DFP) and does Perl needs DFP?

As a side note, Perl 6 has a built-in Rat (rational number) class, so that if I write:
my $c = 1/3;
it will apparently store internally "1/3", a Rat type, not "0.333333...".

I suppose this will remove some of the problems associated with floating point calculations, but probably not all of them.

Je suis Charlie.

Replies are listed 'Best First'.
Re^2: Decimal Floating Point (DFP) and does Perl needs DFP?
by syphilis (Archbishop) on Jan 17, 2015 at 23:58 UTC
    Perl 6 has a built-in Rat (rational number) class

    It'll be interesting to see how well that performs and what limitations it has. (Are denominator and numerator limited to ivsize ?)
    Perl5 does provide access to rational arithmetic via Math::BigRat (which is slow) and Math::GMPq (which is fast, but requires the gmp library).

    Cheers,
    Rob
Re^2: Decimal Floating Point (DFP) and does Perl needs DFP?
by flexvault (Monsignor) on Jan 17, 2015 at 13:03 UTC

    Hello Laurent_R,

    Yes, but it's still in the software. It is one of the features of Perl 6 that I look forward to...Ed

    Regards...Ed

    "Well done is better than well said." - Benjamin Franklin