Re: printf "%.100f" the value 2 ^ (-127)
From: Igor Tandetnik (itandetnik_at_mvps.org)
Date: 03/26/04
- Next message: Simon Trew: "Re: printf "%.100f" the value 2 ^ (-127)"
- Previous message: Dipak Patil: "Screen saver desktop name...?"
- In reply to: Simon Trew: "Re: printf "%.100f" the value 2 ^ (-127)"
- Next in thread: Simon Trew: "Re: printf "%.100f" the value 2 ^ (-127)"
- Reply: Simon Trew: "Re: printf "%.100f" the value 2 ^ (-127)"
- Messages sorted by: [ date ] [ thread ]
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
- Next message: Simon Trew: "Re: printf "%.100f" the value 2 ^ (-127)"
- Previous message: Dipak Patil: "Screen saver desktop name...?"
- In reply to: Simon Trew: "Re: printf "%.100f" the value 2 ^ (-127)"
- Next in thread: Simon Trew: "Re: printf "%.100f" the value 2 ^ (-127)"
- Reply: Simon Trew: "Re: printf "%.100f" the value 2 ^ (-127)"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|