Re: Tough problem...
- From: "Avatar Zondertau" <avatarzt@xxxxxxxxx (please reply to newsgroup)>
- Date: Tue, 27 Jun 2006 19:31:29 +0200
You should be permanently aware of the fact that the FPU does not use
a decimal representation, but a binary notation. Multiplication by
1000 is not really that simple in binary; 1024 for example is simpler.
Actually, it's just as easy to demonstrate with decimals. Suppose you
have an FP unit which calculates in decimals, with five digits of
accuracy. We want to calculate the remainder of dividing by 2*Pi.
For this FPU pi equals 3,1416 and therefore 2*Pi equals 6,2832. We will
calculate the remainder for 10 and for 1000:
Rem( 10, 6,2832) = 10 - 1 * 6,2832 = 3,7168
Rem(1000, 6,2832) = 1000 - 159 * 6,2832 = 0,9712
The real answers, without intermediate rounding to 5 positions are:
Rem( 10, pi) = 3,7168
Rem(1000, pi) = 0,9735
We see that the difference is caused by intermediate rounding to five
decimal digits. This is unavoidable, since the FPU cannot do arithmetic
with larger numbers. For example, it doesn't know a more accurate
version of pi, which it would need to reach the same accuracy for both.
--
The Fastcode Project: http://www.fastcodeproject.org/
.
- Follow-Ups:
- Re: Tough problem...
- From: Atmapuri
- Re: Tough problem...
- References:
- Tough problem...
- From: Atmapuri
- Re: Tough problem...
- From: John Herbster
- Re: Tough problem...
- From: Atmapuri
- Re: Tough problem...
- From: Avatar Zondertau
- Tough problem...
- Prev by Date: Re: Tough problem...
- Next by Date: Re: Tough problem...
- Previous by thread: Re: Tough problem...
- Next by thread: Re: Tough problem...
- Index(es):
Relevant Pages
|