On Thu, 02 Sep 2021 12:08:21 -0300, Hope Rouselle <hrouse...@jevedi.com> declaimed the following:
>Suppose these numbers are prices in dollar, never going beyond cents. >Would it be safe to multiply each one of them by 100 and therefore work >with cents only? For instance > A lot of software with a "monetary" data type uses scaled INTEGERS for that... M$ Excel uses four decimal places, internally scaled. The Ada language has both FIXED and FLOAT data types; for FIXED one specifies the delta between adjacent values that must be met (the compiler is free to use something with more resolution internally). Money should never be treated as a floating value. >I suppose that if I multiply it by a power of two, that would be an >operation that I can be sure will not bring about any precision loss >with floating-point numbers. Do you agree? Are we talking IEEE floats? Or some of the ancient formats used for computers that may not have had hardware floating point units, or predate the IEEE standard. Normalized with suppressed leading bit? (If normalization always puts the most significant bit at the binary point... Why store that bit?, shift it out and gain another bit at the small end) Xerox Sigma floats used an exponent based on radix 16. A normalized mantissa could have up to three leading 0 bits. Motorola Fast Floating Point (software float implementation used on base Amiga systems -- the exponent was in the low byte) -- Wulfraed Dennis Lee Bieber AF6VN wlfr...@ix.netcom.com http://wlfraed.microdiversity.freeddns.org/ -- https://mail.python.org/mailman/listinfo/python-list