For Programmers: Free Programming Magazines  


Home > Archive > Cobol > April 2008 > Re: Decimal versus binary arithmetic was Re: J4 - presentation/discussion on "Fu









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Decimal versus binary arithmetic was Re: J4 - presentation/discussion on "Fu
Robert

2008-04-02, 3:57 am

On Tue, 01 Apr 2008 12:44:49 GMT, "Michael Mattias" <mmattias@talsystems.com> wrote:

>"Robert" <no@e.mail> wrote in message
> news:jbd3v3tomdipsgke42j5cklujltahbtjle@
4ax.com...
>
>That's because you did not do it in binary, you did it in decimal.
>One-fifth is rational in decimal, but irrational in binary.


Nope, all three numbers are binary INTEGERS. The fallacy is in thinking of quotient as a
fraction. It is not a fraction, it is an integer. The compiler SCALED two integers by
multiplying by powers of 10, then divided two binary integers to get a quotient with no
fraction. Binary 10 divided by binary 5 gives binary 2.

101111101011110000100000000 / 1100001101010000 = 11111010000

For ease of reading, in base 16 and 10

5F5E100 / C350 = 7D0

100000000 / 50000 = 2000


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com