Keil™, An ARM® Company

Discussion Forum

fmod with negative decimal numbers error?

Next Thread | Thread List | Previous Thread Start a Thread | Settings

DetailsMessage
Read-Only
Author
Jesper Madsen
Posted
16-May-2008 09:12 GMT
Toolset
ARM
New! fmod with negative decimal numbers error?

the result of fmod(-0.6, 0.01) is -0.01 is this an error?

Read-Only
Author
Tamir Michael
Posted
16-May-2008 10:23 GMT
Toolset
ARM
New! RE: fmod with negative decimal numbers error?

no it is not. check out this statement (see your math.h, assuming you are using the RealView compiler):
"fmod returns the value x - i * y, for some integer i such that, if y is nonzero, the result has the same sign as x and magnitude less than the magnitude of y. If y is zero, a domain error occurs and -HUGE_VAL is returned."

Next Thread | Thread List | Previous Thread Start a Thread | Settings