Re: Converting Long to Float: Values not Matching
I am getting:
I tried with multiple numbers but still the values are not equal. What
am I missing?
Floats have limited precision. Your number is larger than the number of
Internally, numbers are represented as a number (the mantissa)
multiplied by some power of 2; your number cannot be exactly represented
to the precision that the mantissa has, so it lops off a few bits at the
end, giving you a moderately close but not exact approximation.
Beware of bugs in the above code; I have only proved it correct, not
tried it. -- Donald E. Knuth
- Re: Reciprocal square root (Was: Re: If It Were Easy...)
... It has about 66 bits of precision. ... That is a potential error of 2**40 ulps. ... At a multiple of pi/2, the potential error is only the multiple times ... However, the fprem/fprem1 instructions are also very slow, though ...
- Re: Why fixed point ?
... Yes, we do not care about lower half of result bits (standard precision result is in upper half), but in multiple accumulations we may loose carry bitfrom lower half. ... Most DSPs provide a MAC engine with an accumulator that has significantly more bits than a multiply. ... The correct technique to use this precision was to do your MAC, shift the result around as necessary to line up with the notation that you were using, then saturate the result based on the contents of the "overflow" part of the accumulator. ...
- Re: calculation accuracy
... about inaccuracies in trig functions introduced by argument reduction. ... That is, sinfor large X, even when X should be close to a multiple ... The argument here is double precision, ... Then subtract. ...
- Re: Infinity + Infinity (or NegInfinity - NegInfinity)
... Extended precision is the easy answer, but if that isn't available (and ... all you need is some decent support for multiple ... above design helps a lot with optimising that); ...
- Re: QI and MQ Coder: First real-life experiences
... > is used to align the mantissa? ... If you look at SWI as a floating point number, ... So for that concept of "precision", ... The SW exponent, of course, as shown e.g. in EncDec.c, function ...