Guest User

Untitled

a guest
Jan 19th, 2018
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. if ( x === 0 && y ===0 ) return NaN;
  2. if ( x === y ) return 0;
  3. if ( x === 0 ) return 0;
  4. if (x > 0 && y > 0) {
  5. return x < y ? x : modulo(x-y,y);
  6. }
  7.  
  8. if ( x < 0 && y < 0 ) {
  9.  
  10. return x*-1 < y*-1 ? x : modulo(x-y,y);
  11. }
  12.  
  13. if( x > 0 && y < 0 ) {
  14. return x < y*-1 ? x : modulo(x+y,y);
  15. }
  16.  
  17. if ( x < 0 && y >0) {
  18. return x*-1 < y ? x : modulo(x+y,y);
  19. }
Add Comment
Please, Sign In to add comment