Re: OT: computer arithmetic question on integer division

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Globe Trotter wrote:

| HI,
|
| Does anyone know how the computer *actually* does integer division?
| I understand that with powers of 2, it just does bit shifting, but
| what about other powers, do you know?
|
| (for example, 5/2 = 101/10 so shift the 101 by 1 and get 10, but
| how does 5/3 work, lets say?)
|
| Thanks and best wishes!
|
|
|
|  __________________________________ Do you Yahoo!? Read only the
| mail you want - Yahoo! Mail SpamGuard.
| http://promotions.yahoo.com/new_mail
|
Mr Globe Trotter,

Go to your text books and look it up yourself.
As someone already said, look up any good computer architecture book.

PS:  This question "smells" an awful lot like a homework question.

Things actually get interesting when you start talking about 1/10 or
even 1/100.  These fractions get represented by the computer as
repeating binary numbers.  Which is one reason why 0.01 + 0.01 may not
equal 0.02 exactly.

James Kosin

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFB7Ri9kNLDmnu1kSkRAh6aAJ9BKR44EwJaklDrbR97+v0ZUBi1rwCfR0Fu
SLoVqtPW5aJZjbKoxZ3wlOc=
=dmkD
-----END PGP SIGNATURE-----


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux