skulakowski
03-27-2006, 10:00 AM
Can anybody explain this odd behavior of the greatest common divisor (GCD) function?
Correctly, GCD(440, 460) = 20.
Also correctly, GCD( (440*100) / 100, (460*100) / 100) = 20
BUT... GCD( (440/100) *100, (460/100) * 100) = 1.
Seems to me that 440/100 * 100 equals 440*100 / 100 equals 440.
I'll round any divisions I use but I'd like to understand why I have to round.
Thanks.
Correctly, GCD(440, 460) = 20.
Also correctly, GCD( (440*100) / 100, (460*100) / 100) = 20
BUT... GCD( (440/100) *100, (460/100) * 100) = 1.
Seems to me that 440/100 * 100 equals 440*100 / 100 equals 440.
I'll round any divisions I use but I'd like to understand why I have to round.
Thanks.