0

Is converting Fixed Pt. (fixed n bit for fraction) to IEEE double safe ?

ie: does IEEE double format can represent all numbers a fixed point can represent ?

The test: a number goes to floating pt format then back to it's original fixed pt format.

2 Answers 2

4

Assuming your fixed point numbers are stored as 32-bit integers, yes, IEEE double precision can represent any value representable in fixed point. This is because double has a 53-bit mantissa, your fixed point values only have 32 bits of precision, and the floating-point exponent for the fixed point value is bounded between -32 and 32 (depending on where you consider the binary-point to lie in your fixed point values) which is well within the representable range.

Sign up to request clarification or add additional context in comments.

Comments

1

It all depends on the size and format of your fixed point type. Fixed point to floating point is safe if your fixed type has few enough bits not to become inaccurate when converted to float. The other way round your fixed point type would have to be extremely long because a double can potentially represent a very large value (magnitude-wise) in a small amount of bits.

2 Comments

This is not correct. You can have 1 fractional digit allowed and still not be representable by any number of bits. 0.1 (one tenth) can't be represented in binary, so doubles can't represent it accurately.
Obviously I was talking about a binary fixed point number. There's no such "impedance mismatch" between floating point and fixed point if they're both binary, right?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.