[Tutor] (no subject)
Kopalle Narasimha
engnarasimha at gmail.com
Tue Nov 28 16:46:43 CET 2006
Hello, Everyone.
I have a strange problem with floating point numbers. Please help me.
I tried the following at the python prompt:
Case 1:
>>> 4.5/2.0 #Gives quotient
Answer: 2.25
Case 2:
>>> 4.5%2.0 #Gives Remainder
Answer: 0.5
How could a floating point division give a remainder???
I think the remainder must always be zero since the quotient would be
a floating point number.
When a similar program is written in C language(i.e. to get remainder
of two floating point numbers), I received an error supporting my
idea.
More information about the Tutor
mailing list