You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

163 lines
4.2 KiB

20 years ago
25 years ago
27 years ago
27 years ago
27 years ago
27 years ago
  1. /*
  2. +----------------------------------------------------------------------+
  3. | PHP Version 5 |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 1997-2007 The PHP Group |
  6. +----------------------------------------------------------------------+
  7. | This source file is subject to version 3.01 of the PHP license, |
  8. | that is bundled with this package in the file LICENSE, and is |
  9. | available through the world-wide-web at the following url: |
  10. | http://www.php.net/license/3_01.txt |
  11. | If you did not receive a copy of the PHP license and are unable to |
  12. | obtain it through the world-wide-web, please send a note to |
  13. | license@php.net so we can mail you a copy immediately. |
  14. +----------------------------------------------------------------------+
  15. | Authors: Jim Winstead <jimw@php.net> |
  16. | Stig Sther Bakken <ssb@php.net> |
  17. +----------------------------------------------------------------------+
  18. */
  19. /* $Id$ */
  20. #ifndef PHP_MATH_H
  21. #define PHP_MATH_H
  22. PHPAPI char *_php_math_number_format(double, int, char , char);
  23. PHPAPI char * _php_math_longtobase(zval *arg, int base);
  24. PHPAPI long _php_math_basetolong(zval *arg, int base);
  25. PHPAPI int _php_math_basetozval(zval *arg, int base, zval *ret);
  26. PHPAPI char * _php_math_zvaltobase(zval *arg, int base TSRMLS_DC);
  27. PHP_FUNCTION(sin);
  28. PHP_FUNCTION(cos);
  29. PHP_FUNCTION(tan);
  30. PHP_FUNCTION(asin);
  31. PHP_FUNCTION(acos);
  32. PHP_FUNCTION(atan);
  33. PHP_FUNCTION(atan2);
  34. PHP_FUNCTION(pi);
  35. PHP_FUNCTION(exp);
  36. PHP_FUNCTION(log);
  37. PHP_FUNCTION(log10);
  38. PHP_FUNCTION(is_finite);
  39. PHP_FUNCTION(is_infinite);
  40. PHP_FUNCTION(is_nan);
  41. PHP_FUNCTION(pow);
  42. PHP_FUNCTION(sqrt);
  43. PHP_FUNCTION(srand);
  44. PHP_FUNCTION(rand);
  45. PHP_FUNCTION(getrandmax);
  46. PHP_FUNCTION(mt_srand);
  47. PHP_FUNCTION(mt_rand);
  48. PHP_FUNCTION(mt_getrandmax);
  49. PHP_FUNCTION(abs);
  50. PHP_FUNCTION(ceil);
  51. PHP_FUNCTION(floor);
  52. PHP_FUNCTION(round);
  53. PHP_FUNCTION(decbin);
  54. PHP_FUNCTION(dechex);
  55. PHP_FUNCTION(decoct);
  56. PHP_FUNCTION(bindec);
  57. PHP_FUNCTION(hexdec);
  58. PHP_FUNCTION(octdec);
  59. PHP_FUNCTION(base_convert);
  60. PHP_FUNCTION(number_format);
  61. PHP_FUNCTION(fmod);
  62. PHP_FUNCTION(deg2rad);
  63. PHP_FUNCTION(rad2deg);
  64. /*
  65. WARNING: these functions are expermental: they could change their names or
  66. disappear in the next version of PHP!
  67. */
  68. PHP_FUNCTION(hypot);
  69. PHP_FUNCTION(expm1);
  70. #ifdef HAVE_LOG1P
  71. PHP_FUNCTION(log1p);
  72. #endif
  73. PHP_FUNCTION(sinh);
  74. PHP_FUNCTION(cosh);
  75. PHP_FUNCTION(tanh);
  76. #ifdef HAVE_ASINH
  77. PHP_FUNCTION(asinh);
  78. #endif
  79. #ifdef HAVE_ACOSH
  80. PHP_FUNCTION(acosh);
  81. #endif
  82. #ifdef HAVE_ATANH
  83. PHP_FUNCTION(atanh);
  84. #endif
  85. #include <math.h>
  86. #ifndef M_E
  87. #define M_E 2.7182818284590452354 /* e */
  88. #endif
  89. #ifndef M_LOG2E
  90. #define M_LOG2E 1.4426950408889634074 /* log_2 e */
  91. #endif
  92. #ifndef M_LOG10E
  93. #define M_LOG10E 0.43429448190325182765 /* log_10 e */
  94. #endif
  95. #ifndef M_LN2
  96. #define M_LN2 0.69314718055994530942 /* log_e 2 */
  97. #endif
  98. #ifndef M_LN10
  99. #define M_LN10 2.30258509299404568402 /* log_e 10 */
  100. #endif
  101. #ifndef M_PI
  102. #define M_PI 3.14159265358979323846 /* pi */
  103. #endif
  104. #ifndef M_PI_2
  105. #define M_PI_2 1.57079632679489661923 /* pi/2 */
  106. #endif
  107. #ifndef M_PI_4
  108. #define M_PI_4 0.78539816339744830962 /* pi/4 */
  109. #endif
  110. #ifndef M_1_PI
  111. #define M_1_PI 0.31830988618379067154 /* 1/pi */
  112. #endif
  113. #ifndef M_2_PI
  114. #define M_2_PI 0.63661977236758134308 /* 2/pi */
  115. #endif
  116. #ifndef M_SQRTPI
  117. #define M_SQRTPI 1.77245385090551602729 /* sqrt(pi) */
  118. #endif
  119. #ifndef M_2_SQRTPI
  120. #define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */
  121. #endif
  122. #ifndef M_LNPI
  123. #define M_LNPI 1.14472988584940017414 /* ln(pi) */
  124. #endif
  125. #ifndef M_EULER
  126. #define M_EULER 0.57721566490153286061 /* Euler constant */
  127. #endif
  128. #ifndef M_SQRT2
  129. #define M_SQRT2 1.41421356237309504880 /* sqrt(2) */
  130. #endif
  131. #ifndef M_SQRT1_2
  132. #define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */
  133. #endif
  134. #ifndef M_SQRT3
  135. #define M_SQRT3 1.73205080756887729352 /* sqrt(3) */
  136. #endif
  137. #endif /* PHP_MATH_H */