Guest User

float2.inc v1.1

a guest
Jul 22nd, 2015
372
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.03 KB | None | 0 0
  1. /*
  2.     float2.inc
  3.     kvann 2015, no rights reserved at all.
  4. */
  5.  
  6. #include <a_samp>
  7.  
  8. #if defined _float2_included
  9.         #endinput
  10. #endif
  11. #define _float2_included
  12.  
  13. /*
  14.     native Float:floatmod(Float:oper1, Float:oper2);
  15. */
  16.  
  17. #if !defined FLOAT_INFINITY
  18.     #define FLOAT_INFINITY (Float:0x7F800000)
  19. #endif
  20.  
  21. #if !defined FLOAT_POS_INFINITY
  22.     #define FLOAT_POS_INFINITY (Float:0x7F800000)
  23. #endif
  24.  
  25. #if !defined FLOAT_NEG_INFINITY
  26.     #define FLOAT_NEG_INFINITY (Float:0xFF800000)
  27. #endif
  28.  
  29. #if !defined FLOAT_NAN
  30.     #define FLOAT_NAN (Float:0x7FFFFFFF)
  31. #endif
  32.  
  33. stock Float:floatmod(Float:oper1, Float:oper2)
  34. {
  35.     if (oper2 == 0.0) return FLOAT_NAN;
  36.         while (oper1 >= oper2) oper1 -= oper2;
  37.     while (oper1 < 0.0) oper1 += oper2;
  38.         return oper1;
  39. }
  40.  
  41. native operator=(Float:oper) = floatround;
  42.  
  43. stock Float:operator%(Float:oper1, Float:oper2) return floatmod(oper1, oper2);
  44. stock Float:operator%(oper1, Float:oper2) return floatmod(float(oper1), oper2);
  45. stock Float:operator%(Float:oper1, oper2) return floatmod(oper1, float(oper2));
Advertisement
Add Comment
Please, Sign In to add comment