Skip to content

Commit 2d0b0d6

Browse files
committed
Remove unnecessary C99 checks for maths functions
1 parent 7577e79 commit 2d0b0d6

File tree

1 file changed

+7
-98
lines changed

1 file changed

+7
-98
lines changed

ext/standard/math.c

Lines changed: 7 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -204,83 +204,6 @@ PHPAPI double _php_math_round(double value, int places, int mode) {
204204
}
205205
/* }}} */
206206

207-
/* {{{ php_asinh
208-
*/
209-
static double php_asinh(double z)
210-
{
211-
#ifdef HAVE_ASINH
212-
return(asinh(z));
213-
#else
214-
# ifdef _WIN64
215-
if (z >= 0) {
216-
return log(z + sqrt(z * z + 1));
217-
}
218-
else {
219-
return -log(-z + sqrt(z * z + 1));
220-
}
221-
# else
222-
return(log(z + sqrt(1 + pow(z, 2))) / log(M_E));
223-
# endif
224-
#endif
225-
}
226-
/* }}} */
227-
228-
/* {{{ php_acosh
229-
*/
230-
static double php_acosh(double x)
231-
{
232-
#ifdef HAVE_ACOSH
233-
return(acosh(x));
234-
#else
235-
# ifdef _WIN64
236-
if (x >= 1) {
237-
return log(x + sqrt(x * x - 1));
238-
} else {
239-
return ZEND_NAN;
240-
}
241-
# else
242-
return(log(x + sqrt(x * x - 1)));
243-
# endif
244-
#endif
245-
}
246-
/* }}} */
247-
248-
/* {{{ php_atanh
249-
*/
250-
static double php_atanh(double z)
251-
{
252-
#ifdef HAVE_ATANH
253-
return(atanh(z));
254-
#else
255-
return(0.5 * log((1 + z) / (1 - z)));
256-
#endif
257-
}
258-
/* }}} */
259-
260-
/* {{{ php_log1p
261-
*/
262-
static double php_log1p(double x)
263-
{
264-
#ifdef HAVE_LOG1P
265-
return(log1p(x));
266-
#else
267-
return(log(1 + x));
268-
#endif
269-
}
270-
/* }}} */
271-
272-
/* {{{ php_expm1
273-
*/
274-
static double php_expm1(double x)
275-
{
276-
#ifndef PHP_WIN32
277-
return(expm1(x));
278-
#else
279-
return(exp(x) - 1);
280-
#endif
281-
}
282-
/* }}}*/
283-
284207
/* {{{ proto int|float abs(int|float number)
285208
Return the absolute value of the number */
286209
PHP_FUNCTION(abs)
@@ -533,7 +456,7 @@ PHP_FUNCTION(asinh)
533456
ZEND_PARSE_PARAMETERS_START(1, 1)
534457
Z_PARAM_DOUBLE(num)
535458
ZEND_PARSE_PARAMETERS_END();
536-
RETURN_DOUBLE(php_asinh(num));
459+
RETURN_DOUBLE(asinh(num));
537460
}
538461
/* }}} */
539462

@@ -546,7 +469,7 @@ PHP_FUNCTION(acosh)
546469
ZEND_PARSE_PARAMETERS_START(1, 1)
547470
Z_PARAM_DOUBLE(num)
548471
ZEND_PARSE_PARAMETERS_END();
549-
RETURN_DOUBLE(php_acosh(num));
472+
RETURN_DOUBLE(acosh(num));
550473
}
551474
/* }}} */
552475

@@ -559,7 +482,7 @@ PHP_FUNCTION(atanh)
559482
ZEND_PARSE_PARAMETERS_START(1, 1)
560483
Z_PARAM_DOUBLE(num)
561484
ZEND_PARSE_PARAMETERS_END();
562-
RETURN_DOUBLE(php_atanh(num));
485+
RETURN_DOUBLE(atanh(num));
563486
}
564487
/* }}} */
565488

@@ -644,10 +567,7 @@ PHP_FUNCTION(exp)
644567
/* }}} */
645568

646569
/* {{{ proto float expm1(float number)
647-
Returns exp(number) - 1, computed in a way that accurate even when the value of number is close to zero */
648-
/*
649-
WARNING: this function is experimental: it could change its name or
650-
disappear in the next version of PHP!
570+
Returns exp(number) - 1, computed in a way that accurate even when the value of number is close to zero
651571
*/
652572
PHP_FUNCTION(expm1)
653573
{
@@ -657,15 +577,12 @@ PHP_FUNCTION(expm1)
657577
Z_PARAM_DOUBLE(num)
658578
ZEND_PARSE_PARAMETERS_END();
659579

660-
RETURN_DOUBLE(php_expm1(num));
580+
RETURN_DOUBLE(expm1(num));
661581
}
662582
/* }}} */
663583

664584
/* {{{ proto float log1p(float number)
665-
Returns log(1 + number), computed in a way that accurate even when the value of number is close to zero */
666-
/*
667-
WARNING: this function is experimental: it could change its name or
668-
disappear in the next version of PHP!
585+
Returns log(1 + number), computed in a way that accurate even when the value of number is close to zero
669586
*/
670587
PHP_FUNCTION(log1p)
671588
{
@@ -675,7 +592,7 @@ PHP_FUNCTION(log1p)
675592
Z_PARAM_DOUBLE(num)
676593
ZEND_PARSE_PARAMETERS_END();
677594

678-
RETURN_DOUBLE(php_log1p(num));
595+
RETURN_DOUBLE(log1p(num));
679596
}
680597
/* }}} */
681598

@@ -695,11 +612,9 @@ PHP_FUNCTION(log)
695612
RETURN_DOUBLE(log(num));
696613
}
697614

698-
#ifdef HAVE_LOG2
699615
if (base == 2.0) {
700616
RETURN_DOUBLE(log2(num));
701617
}
702-
#endif
703618

704619
if (base == 10.0) {
705620
RETURN_DOUBLE(log10(num));
@@ -757,13 +672,7 @@ PHP_FUNCTION(hypot)
757672
Z_PARAM_DOUBLE(num2)
758673
ZEND_PARSE_PARAMETERS_END();
759674

760-
#if HAVE_HYPOT
761675
RETURN_DOUBLE(hypot(num1, num2));
762-
#elif defined(_MSC_VER)
763-
RETURN_DOUBLE(_hypot(num1, num2));
764-
#else
765-
RETURN_DOUBLE(sqrt((num1 * num1) + (num2 * num2)));
766-
#endif
767676
}
768677
/* }}} */
769678

0 commit comments

Comments
 (0)