Re: IEEE-754 DP-FP rounding question
- From: Terje Mathisen <terje.mathisen@xxxxxxxxxxxxx>
- Date: Thu, 15 Feb 2007 18:13:33 +0100
Nick Maclaren wrote:
In article <266ea4-0oa.ln1@xxxxxxxxxxxxxxxxxxxxxxx>,
Terje Mathisen <terje.mathisen@xxxxxxxxxxxxx> writes:
|> |> I believe the real answer is even simpler (or maybe not?): Pretend that |> you're first generating an infinitely accurate decimal version of your |> binary number, then inspect the result:
|> |> If it is less or equal to half a binary ulp away from an exactly |> representable number, then you should return that number, particularly |> if this results in a much shorter representation.
|> |> I.e. you should always try to return the shortest possible decimal value |> which when converted back into binary will result in the original number.
That is what quite a few of those systems do, and has been known to be
a BAD idea since time immemorial. The reason is that most naive users
interpret a short decimal string as meaning that the number is exactly
that. The removal of trailing zeroes should be done only if they are
truly zero.
Nick, this is getting awfully close to interval arithmetic!
IA is a good idea,at least in principle, the problem is to figure out exactly how good/bad the final answer should be shown to be.
I.e. there are many algorithms with quadratic convergence, where the exact representation doesn't matter at all before the last couple of iterations, but where naive IA would say that you had no significance at all.
The alternative of having an explicit inexactness flag disappeared some
decades ago, though I have no idea why.
It is still there in binary FP, except nobody uses it, right?
Terje
--
- <Terje.Mathisen@xxxxxxxxxxxxx>
"almost all programming can be viewed as an exercise in caching"
.
- Follow-Ups:
- Re: IEEE-754 DP-FP rounding question
- From: Nick Maclaren
- Re: IEEE-754 DP-FP rounding question
- References:
- IEEE-754 DP-FP rounding question
- From: VK
- Re: IEEE-754 DP-FP rounding question
- From: robertwessel2@xxxxxxxxx
- Re: IEEE-754 DP-FP rounding question
- From: Terje Mathisen
- Re: IEEE-754 DP-FP rounding question
- From: Nick Maclaren
- IEEE-754 DP-FP rounding question
- Prev by Date: Re: IEEE-754 DP-FP rounding question
- Next by Date: Re: IEEE-754 DP-FP rounding question
- Previous by thread: Re: IEEE-754 DP-FP rounding question
- Next by thread: Re: IEEE-754 DP-FP rounding question
- Index(es):