mirror of
https://github.com/php/php-src.git
synced 2025-01-22 11:44:09 +08:00
Additional fix for bug #52550 & fix test & warning from previous fixes
This commit is contained in:
parent
d0dc4810eb
commit
7ab1a74f49
@ -29,6 +29,8 @@
|
||||
#include <float.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "basic_functions.h"
|
||||
|
||||
/* {{{ php_intlog10abs
|
||||
Returns floor(log10(fabs(val))), uses fast binary search */
|
||||
static inline int php_intlog10abs(double value) {
|
||||
@ -127,7 +129,11 @@ PHPAPI double _php_math_round(double value, int places, int mode) {
|
||||
double tmp_value;
|
||||
int precision_places;
|
||||
|
||||
precision_places = 14 - php_intlog10abs(value);
|
||||
if ((precision_places = php_intlog10abs(value)) > 0) {
|
||||
precision_places = 14 - php_intlog10abs(value);
|
||||
} else {
|
||||
precision_places = 14;
|
||||
}
|
||||
|
||||
f1 = php_intpow10(abs(places));
|
||||
|
||||
|
@ -94,7 +94,7 @@ Warning: log(): base must be greater than 0 in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 2 --
|
||||
float(INF)
|
||||
float(NAN)
|
||||
|
||||
-- Iteration 3 --
|
||||
float(0.12145441273706)
|
||||
@ -135,7 +135,7 @@ Warning: log(): base must be greater than 0 in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 13 --
|
||||
float(INF)
|
||||
float(NAN)
|
||||
|
||||
-- Iteration 14 --
|
||||
|
||||
@ -143,7 +143,7 @@ Warning: log(): base must be greater than 0 in %s on line %d
|
||||
bool(false)
|
||||
|
||||
-- Iteration 15 --
|
||||
float(INF)
|
||||
float(NAN)
|
||||
|
||||
-- Iteration 16 --
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user