The most common ones are base 2 or base 10 (aka decimal floating point). But can they have any base (like base 3, base 6, base 4 etc.)?
-
1$\begingroup$ IBM used base-16 in their original S360 systems (and still support it). Base-256 was somewhat common for software floating point on 8-bit micros. Non power-of-2 bases (other than base 10) seem unlikely to be useful, however. $\endgroup$Chris Dodd– Chris Dodd2024-10-10 21:21:06 +00:00Commented Oct 10, 2024 at 21:21
-
1$\begingroup$ What would prevent it? $\endgroup$Erik Eidt– Erik Eidt2024-10-10 21:30:52 +00:00Commented Oct 10, 2024 at 21:30
-
3$\begingroup$ One of the upsides of base 2 floats is that, except for zero and subnormals, the mantissa can always be assumed to start with a 1, such that the most significant bit of the mantissa need not be stored. In a different base, you can't easily take advantage of the fact that the most significant digit of the mantissa is (normally) never zero. $\endgroup$kaya3– kaya32024-10-10 22:42:49 +00:00Commented Oct 10, 2024 at 22:42
-
1$\begingroup$ Why stop there? There is no requirement for a base to be positive, an integer, or even a rational. You can have negative bases, rational bases, irrational bases, transcendental bases, imaginary bases, complex bases, … $\endgroup$Jörg W Mittag– Jörg W Mittag2024-10-11 08:40:04 +00:00Commented Oct 11, 2024 at 8:40
2 Answers
Yes, there can be any base in theory, in the sense that the concept is not inherently tied to any particular base or combination of bases.
In practice, the overwhelming use of the floating-point concept is to represent decimal numbers using fixed-width storage fields on a binary-based computer.
Floating-point differs from fixed-point in the coverage of the numbers that can be represented within the fixed-width storage.
Fixed-point has total coverage of numbers within a certain range at a single scale, whereas floating-point has partial coverage of numbers within a certain overall range but also covers a mix of scales.
You could, but there's not likely to be much benefit to it.
The main benefit of binary floating point is that after you separate the value into sign, exponent, and mantissa, operations are reduced to binary integer arithmetic, which can be implemented straightforwardly in logic gates.
Non-binary floating point will require more complicated hardware logic, especially if the base can be chosen dynamically. Or it will have to be implemented in software.
There are software floating point implementations, of course. They were needed on early microprocessors that didn't have floating point units, and may still be needed on modern microcontrollers. You can also find software floating point libraries now for doing multi-precision FP, to get more precision than IEEE floating point.