Advertisement
jack06215

[c++] mod

Jul 7th, 2020
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.18 KB | None | 0 0
  1. inline float mod(float x, float y)
  2. {
  3.     float result = std::fmod(x, y);
  4.     return result >= 0 ? result : result + y;
  5. }
  6.  
  7. int main(void)
  8. {
  9.     int remainder = mod(-1.4, 2.5);
  10.     return 0;
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement