develooper Front page | perl.perl5.porters | Postings from August 2021

RE: Pre-RFC decimal data type

Thread Previous | Thread Next
From:
paul.marquess via perl5-porters
Date:
August 5, 2021 09:18
Subject:
RE: Pre-RFC decimal data type
Message ID:
00e301d789da$e15d1a50$a4174ef0$@ntlworld.com
From: Nicholas Clark <nick@ccl4.org> 
> 
> On Thu, Aug 05, 2021 at 08:17:22AM +0000, Ovid via perl5-porters wrote:
> > Since we're talking about wishes, would a decimal type be interesting?
For example, in floating point, you can't represent .3. So the following
evaluates to false:
> > 
> > if ( 0 == .1 + .2 - .3 ) { ... }
> 
> Yes, it would be interesting, but I have no good idea how to implement
this in a performant and portable way.

Use the Rational number implementation from Raku as inspiration? See
https://docs.raku.org/type/Rat

Paul


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About