On 2021-08-05 1:17 a.m., 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: > > Imagine this evaluating as true (fake syntax): > > if ( 0 == .1d + .2d - .3d ) { ... } > > Many languages currently support decimal data types natively (COBOL, C#) or via > core libraries (Java, Python). I would suggest that the simplest implementation is just as a scaled integer. So its precision would be the same as a Perl integer because it would be implementing using the same kind of machine integer, likely a 64-bit one. Is about 18 digits of precision enough or do you need more? I would expect that should handle fine the finance use case you mention. In my experience finance apps often use scaled integers implemented at the app level anyway in absence of a decimal type, say as an integer that counts in 100ths of a currency unit for example. -- Darren DuncanThread Previous | Thread Next