3.154. __nv_fmod


double @__nv_fmod(double %x, double %y) 


Calculate the floating-point remainder of x / y. The absolute value of the computed value is always less than y's absolute value and will have the same sign as x.


  • Returns the floating point remainder of x / y.

  • __nv_fmod( ± 0 , y) returns ± 0 if y is not zero.

  • __nv_fmod(x, y) returns NaN and raised an invalid floating point exception if x is ± or y is zero.

  • __nv_fmod(x, y) returns zero if y is zero or the result would overflow.

  • __nv_fmod(x, ± ) returns x if x is finite.

  • __nv_fmod(x, 0) returns NaN.


For accuracy information for this function see the CUDA C++ Programming Guide, Appendix E.1, Table 7.

Library Availability:

Compute 2.0: Yes

Compute 3.0: Yes

Compute 3.5: Yes