Don Wrote: > Paul D. Anderson wrote: > > I have some bikeshed sort of questions regarding both naming and > > implementation and I'd like some feedback from the community: > > > > 1) I've named the AP numbers "Decimal", but a better name is either > > "BigDecimal" or "BigFloat". I'm leaning toward BigDecimal. The fixed size > > numbers are "Dec32", "Dec64" and "Dec128". Are these names satisfactory? > > Do they use base 10 ? > Ie, is it impossible to request a significand length of (say) 2048 bits? > > Name = BaseTenOnly ? "BigDecimal" : "BigFloat". > > I would expect something called 'BigFloat' to be able to duplicate the > semantics of the built-in binary floating point types, and 'BigDecimal' > to duplicate the semantics of the decimal types. > If it can do both, BigFloat is a shorter name. >
They are decimals. Significands are specified in decimal digits, etc. > > 2) There are two available representations for the fixed size numbers: > > densely packed decimals and binary integer decimals. If anyone knows or > > cares about the difference do you have a preference? The binary integer > > decimals are much simpler to convert to other types, so I'm implementing > > those, but it's not much work to implement the others. If you want more > > info I can point you to references. > > I suspect densely packed decimals are only really useful as an > interchange format, when you don't have hardware that uses them > natively. But I could be wrong. > According to what I've read, there is some uncertainty as to which would or should be implemented in hardware, and the iEEE-754 is agnostic about which representation is preferred. But this is something that can be easily incorporated later, either way. > > 3) The current design is to back all the fixed size numbers with the AP > > numbers. That is, the fixed sized are converted to arbitrary precision, > > operated on, and coverted back. The AP numbers are based on > > std.bigint.BigInt, so all internal math is performed using BigInts. It is > > possible, however, to use uints and ulong arithmetic for Dec32 and Dec64, > > respectively. But the ints and longs would have to indicate overflow, etc., > > so it's not trivial. (I wish there were CheckedInt struct!) The first > > releases will use BigInts, but is it worthwhile to pursue the other? > > I think that stuff belongs in a FixedInt class rather than in this code. > I agree. > > > > Any questions or ideas please e-mail me at the address above. (I won't be > > able to check my e-mail until this evening (PDT), so if you want a quicker > > response use this forum.) > > > > Paul > >