Is fmod() exact when y is an integer?

后端 未结 2 1718
轻奢々
轻奢々 2020-11-27 19:45

In using double fmod(double x, double y) and y is an integer, the result appears to be always exact.

(That is y a w

2条回答
  •  一向
    一向 (楼主)
    2020-11-27 20:27

    The result of fmod is always exact; whether y is an integer is irrelevant. Of course, if x and/or y are already approximations of some real numbers a and b, then fmod(x,y) is unlikely to be exactly equal to a mod b.

提交回复
热议问题