2
0

Math.hx 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*
  2. * Copyright (C)2005-2019 Haxe Foundation
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  20. * DEALINGS IN THE SOFTWARE.
  21. */
  22. @:coreApi
  23. class Math {
  24. @:hlNative("std", "math_sqrt") public static function sqrt(v:Float):Float
  25. return 0.;
  26. @:hlNative("std", "math_abs") public static function abs(v:Float):Float
  27. return 0.;
  28. @:hlNative("std", "math_floor") public static function floor(v:Float):Int
  29. return 0;
  30. @:hlNative("std", "math_round") public static function round(v:Float):Int
  31. return 0;
  32. @:hlNative("std", "math_ceil") public static function ceil(v:Float):Int
  33. return 0;
  34. @:hlNative("std", "math_isfinite") public static function isFinite(f:Float):Bool
  35. return true;
  36. @:hlNative("std", "math_isnan") public static function isNaN(f:Float):Bool
  37. return false;
  38. @:hlNative("std", "math_ffloor") public static function ffloor(v:Float):Float
  39. return 0.;
  40. @:hlNative("std", "math_fround") public static function fround(v:Float):Float
  41. return 0.;
  42. @:hlNative("std", "math_fceil") public static function fceil(v:Float):Float
  43. return 0.;
  44. @:hlNative("std", "math_cos") public static function cos(v:Float):Float
  45. return 0.;
  46. @:hlNative("std", "math_sin") public static function sin(v:Float):Float
  47. return 0.;
  48. @:hlNative("std", "math_exp") public static function exp(v:Float):Float
  49. return 0.;
  50. @:hlNative("std", "math_log") public static function log(v:Float):Float
  51. return 0.;
  52. @:hlNative("std", "math_tan") public static function tan(v:Float):Float
  53. return 0.;
  54. @:hlNative("std", "math_atan") public static function atan(v:Float):Float
  55. return 0.;
  56. @:hlNative("std", "math_acos") public static function acos(v:Float):Float
  57. return 0.;
  58. @:hlNative("std", "math_asin") public static function asin(v:Float):Float
  59. return 0.;
  60. @:hlNative("std", "math_pow") public static function pow(v:Float, exp:Float):Float
  61. return 0.;
  62. @:hlNative("std", "math_atan2") public static function atan2(y:Float, x:Float):Float
  63. return 0.;
  64. public static function random():Float
  65. return @:privateAccess Std.rnd_float(Std.rnd);
  66. public static function min(a:Float, b:Float):Float
  67. return a < b || isNaN(a) ? a : b;
  68. public static function max(a:Float, b:Float):Float
  69. return a < b || isNaN(b) ? b : a;
  70. public static var PI(default, null):Float;
  71. public static var NaN(default, null):Float;
  72. public static var POSITIVE_INFINITY(default, null):Float;
  73. public static var NEGATIVE_INFINITY(default, null):Float;
  74. static function __init__():Void {
  75. PI = 3.1415926535897932384626433832795;
  76. NaN = 0. / 0.;
  77. POSITIVE_INFINITY = 1. / 0.;
  78. NEGATIVE_INFINITY = -1. / 0.;
  79. }
  80. }