This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

fmod with negative decimal numbers error?

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

Parents
  • 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."

Reply
  • 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."

Children
No data