3 ms·
You are confusing two things. Usually you represent decimal numbers as rational fractions p/q with two integers. If you fix q, you get a fixed point format, if
by danbruc 4y ago
You are confusing two things. Usually you represent decimal numbers as rational fractions p/q with two integers. If you fix q, you get a fixed point format, if you allow q to vary, you get a floating point format. Unless you are representing rational numbers you usually limit the possible values of q, usually either powers of two or ten. Powers of two will give you your familiar floating point numbers but there are also base ten floating point numbers, for example currency data types.
BCD is a completely different thing, instead of tightly encoding an integer you encode it digit by digit wasting some fraction of a bit each time but make conversion to and from decimal numbers much easier. But there is no advantage compared to a base ten fixed or floating point representation when it comes to representable numbers.
- elpocko 4y agoThis was one of those things where I know just enough to realize something about the reasoning is not right. Thank you for putting that feeling into competent words.
- jasomill 4y agoAs a practical example, POWER architecture uses the densely-packed decimal encoding[1] to encode decimal digits within its IEEE 754-compliant decimal floating-point format[2]. IEEE 754 also supports encoding decimal integers as binary, by converting the entire decimal integer to a single binary integer (i.e., not by storing each decimal digit as a separate binary number). [1] https://en.wikipedia.org/wiki/Densely_packed_decimal https://en.wikipedia.org/wiki/Densely_packed_decimal [2] https://files.openpower.foundation/s/dAYSdGzTfW4j2r2#page=221 https://files.openpower.foundation/s/dAYSdGzTfW4j2r2#page=22...