Re: conversion to floating point



Ravi wrote:

We enter the floating point numbers through keyboard as normal
strings. How these numbers are converted into internal representation
of floating points (most commonly IEEE754)

With floating point operations, eg. multiplying and dividing by 10.0
and adding each new digit to the sum. The result is the floating
point representation of the number, courtesy of the hardware.

The only complexity is avoiding overflow or underflow during the
process, hard cases.

--
Ron Hardin
rhhardin@xxxxxxxxxxxxxx

On the internet, nobody knows you're a jerk.
.



Relevant Pages

  • Re: Singles to Doubles
    ... If you're saying an internal representation of 1.11 should be displayed as 1.1100 externally under all circumstances, that can't be unless it is one of the set of reals than can be represented exactly. ... If otoh it can't be represented exactly as a Single, then the likelihood that it can in Double isn't zero, but the problem of translation to/from the external representation arises, as does that of promotion. ... google on "floating point conversion" or similar and amongst the zillion of hits pretty early on there will be sites that have floating point calculators that you can type numbers into and see their internal representations. ...
    (microsoft.public.vb.general.discussion)
  • Re: Rfd: floating point truncation V1
    ... Round r1 to an integral value using the "round towards zero" rule, ... an internal representation of floating point negative zero, "-0E", which differs from the representation of floating point positive zero, "0E", should return r2 as floating point negative zero for r1 in the open interval. ...
    (comp.lang.forth)
  • Re: conversion to floating point
    ... strings. ... How these numbers are converted into internal representation ... of floating points ... Here is the classic paper on the topic: ...
    (comp.theory)
  • Re: converting single to integer
    ... If by "different value" you mean a differing internal representation for the same numerical value... ... and interpret it as a Single, I sincerely doubt it would return the same value as that bit pattern interpreted as an Integer, which is what you are doing when you use memcopy to copy from a single to an integer. ... I think we're then talking past each other...yes, the internal bit pattern isn't the same between the same integer stored in Single as floating point as the same integer stored as a Long -- which is what I said. ... And, since there are only 23 bits reserved for the mantissa plus a "hidden" bit, any integer requiring over that many bits for representation will lose precision if cast to a Single. ...
    (microsoft.public.vb.general.discussion)
  • Re: Floating point precision problem
    ... int main ... Actually, your program is incorrect. ... The internal representation of your "expected" qqq also has floating point errors in it, so your qq-qqq does not represent the true error in the calculated qq. ...
    (microsoft.public.vc.language)