Re: BUG! Erratic for loop behavior
petelomax at blueyonder.co.uk wrote:
>
>
> On Sat, 23 Mar 2002 20:36:14 +0100, Rolf Schröder <r.schr at t-online.de>
> wrote:
>
> >Actually, 0.1 (dec.) is has
> >an unlimited binary representation: 0.0001100110011..... .
>
> Sanity check required. Kinda understand. Kinda appreciate I may have
> been mollycoddled over many years, or somesuch.
>
> Where'd you get this from, please.
>
You do it yourself!
The decimal 0.1 is equal 1/10 . Written with binary numbers it's 1/1010
. Now you fulfill a 'written' division as you may be used to do for
decimal numbers (but now you have only 0 and 1 as digits):
1: 1010 = 0.0001100110011....
-----------
10: 1010 = 0
---------
100 : 1010 = 0
-----------
* 1000 : 1010 = 0
------------
10000 : 1010 = 1
-1010
------
1100 : 1010 = 1
-1010
------
100 : 1010 = 0
----------
1000 : 1010 = 0 from here the same as (*) and therefore
repeated.
One has to become familiar with this kind of calculations :) .
Have a nice division, Rolf
|
Not Categorized, Please Help
|
|