Re: printf "%.100f" the value 2 ^ (-127)

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Igor Tandetnik (itandetnik_at_mvps.org)
Date: 03/26/04


Date: Fri, 26 Mar 2004 10:55:14 -0500


"Simon Trew" <ten.egnaro@werts> wrote in message
news:ue2bKzxEEHA.2768@tk2msftngp13.phx.gbl
> I was trying to imagine an algorithm that, for at least one finite FP
> representation, would output an infinite series of digits.

Here's one such algorithm - I'm not sure how difficult it would be to
actually implement. Given an FP number, construct the range of all real
values that this FP number approximates. That is, any exact mathematical
value falling outside this interval should be more closely approximated
by some other representable FP number. Such a range can be constructed
by following IEEE rounding rules backwards.

This range contains an infinite number of rational values. Among them,
pick one with the smallest denominator. That would be the formal
definition of your "most familiar to the user" concept. Output this
number as a rational fraction, or as a periodic decimal fraction (e.g.
0.(3) may mean "0. followed by infinitely repeating threes"). As you
probably know, any rational number is representable as a periodic
decimal fraction (the period may contain more than one digit, and it may
not start right after the decimal point - there may be a non-repeating
finite fragment preceding it).

This algorithm is probably impractical.

-- 
With best wishes,
    Igor Tandetnik
"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken


Relevant Pages

  • Re: No Set Contains Every Computable Natural
    ... > and not allow inputs with an infinite number of 1's. ... A TM is essentially an algorithm. ... > A TM that decided this language would not halt on a blank tape. ... this depends on the representation. ...
    (comp.theory)
  • Re: Chex Wat: Pi is "random" and "not predictable"?
    ... their output sequence. ... The fact is that an algorithm can also be used to ... first was about the probability of finding an apparent match. ... They may be matched within e at an infinite ...
    (talk.origins)
  • Re: No Set Contains Every Computable Natural (was Church-Turing compared to Zuse-Fredkin thesis)
    ... Russell is right about Turing saying this, ... You might not want to call this an algorithm which has ... decimal representation of x digit by digit. ...
    (comp.theory)
  • Re: Poetential infinity
    ... > represented more formally as discrete infinite sequences. ... If you search Google with terms "potentially infinite" turing machine tap ... for an algorithm has a finiteness requirement. ... "computational method" which abandons the finiteness requirement: ...
    (sci.logic)
  • "Algorithmic Randomness, Quantum Physics, and Incompleteness"
    ... all finite sequences are to be found infinitely often and ... different members of the infinite set of random numbers. ... Just using random numbers with initial digits 1 thru 9, ... it generated by a shorter input algorithm than the length ...
    (sci.logic)