[A83] Re: 83p os
[Prev][Next][Index][Thread]
[A83] Re: 83p os
> > For ease of calculation, lets say we want 9 accurate decimal digits.
> > 10^9 ~ 2^30 (because 1000 = 10^3 ~ 2^10 = 1024). So 9 decimal
> > digits more or less correspond to 30 binary digits, right? (Another
> > way of looking at it: 2^-30 < 10^-9, meaning if the 31st binary digit
> > is wrong, that won't affect the first 9 decimal digits.)
>
> Try it with 1/3. No matter how many binary digits you have, you'll still
be
> incorrect.
I don't agree. While, as Henk Poley states, you cannot describe 1/3 even in
decimal form, a certain number of binary digits do give "correct" and
accurate, but of course not infinitely precise answers. Try some binary
long division.
(monospaced font)
.0101010101010101010101010101010101010101 ...
_______________________________________________
11 ) 1.0000000000000000000000000000000000000000 ...
11
100
11
100
11
100
...
In the case of 1/3 (1/11 binary) it requires 32 digits (according to my
TI-83 ;) to produce a 10-digit decimal answer of .3333333333. 9 decimal
digits (.333333333) requires 30 binary digits. Evaluate this yourself:
2^-2 + 2^-4 + 2^-6 + 2^-8 ... 2^-30 the exponent corresponds to the binary
digit right of the point.
2/3, anyone?
.1010101010101010101010101010101010101010101
__________________________________________________
11 ) 10.0000000000000000000000000000000000000000000...
1/7?
.001001001001001001001001001001001001001001001001...
______________________________________________________
111 ) 1.000000000000000000000000000000000000000000000000...
Not only correct, but fun (I need a life).
> You need something like BCD to do things accurately. Binary can
> get you "close enough" for many applications, such as 3D engines on slow
> platforms, but it isn't nearly accurate enough for general numerical work.
Why? Numbers are numbers, and arithmetic is arithmetic, no matter what base
you use. IMO, it's just a matter of creating the algorithm for the required
number of digits. I don't see how it isn't accurate. Precision of this
math routine is only dependent upon the number of places the calculation is
carried out to.
References: