Ripseed Oil
Ripseed Oil

Reputation: 77

Is it possible to have a floating point exponent in floating point binary number?

Is it possible to represent for example, 7x2ˆ0.25 in binary floating point representation? If yes the problem is whether it would be standard compliant?

Upvotes: 2

Views: 48

Answers (2)

Patricia Shanahan
Patricia Shanahan

Reputation: 26175

The current floating point formats are designed to exactly store a subset of the rational numbers, specifically certain numbers with terminating binary fraction representations. 2^0.25, the fourth root of two, is an irrational number, as is the result of multiplying it by any rational number, including 7x2ˆ0.25

You could very closely approximate it as a conventional floating point number with an integer exponent. For example, in Java 7*Math.pow(2,0.25).

Floating point numbers are generally intended to be used as approximations, so this would be an acceptable solution for most cases. Do you have an application for which this would not be a solution?

You also ask whether it would be standard compliant. It would certainly not conform to IEEE 754. You have not yet stated any benefit at all, and given its complexity it would take a major benefit to get it into a standard.

Upvotes: 1

Jacek Blaszczynski
Jacek Blaszczynski

Reputation: 3269

Theoretical answer for possibility of creating such floating point number containing floating point exponent is yes, it can be created - how numbers are represented is a matter of convention turned into standard. Nobody is ever prevented from creating shes own convention. It is even theoretically possible to create floating point number from floating point significand and floating point exponent with floating point radix (for explanations of terms see below).

Going even further it is even possible to speculate about multiple levels of floating point numbers used for consecutive significands, exponents and radixes. The question is whether it would be practical to use - I suppose that for some applications yes, it could be an interesting option for extending range while keeping limited precision of floating point number. It would be an opposite direction of tackling such problem to the one used in open source GNU MPFR Library where significand and exponent remained an integrals but the precision and representable reals range was expanded by using large integers.

If the number has to be accepted by majority of floating point implementations what means that it should be standard compliant, than the answer is no.

According to IEEE-754 2008 Standard for Floating-Point Arithmetic:

The set of finite floating-point numbers representable within a particular format is determined by the following integer parameters:

― b = the radix, 2 or 10

― p = the number of digits in the significand (precision)

― emax = the maximum exponent e

― emin = the minimum exponent e

emin shall be 1 − emax for all formats.

As said at the beginning nothing prevents anyone from creating it's own floating point representation composed of integer significand and floating point exponent - even significand and radix could be a custom one. But than such implementation would need to provide support for it's floating point number arithmetic. Therefore, if the question is it's possible to design such a number than the answer is yes if the question is whether it's practical the answer is yes again. For details see GNU MPFR Library implementation.

Upvotes: 1

Related Questions