File tree Expand file tree Collapse file tree 1 file changed +2
-8
lines changed Expand file tree Collapse file tree 1 file changed +2
-8
lines changed Original file line number Diff line number Diff line change @@ -49,16 +49,10 @@ static inline double php_intpow10(int power) {
49
49
/* {{{ php_round_helper
50
50
Actually performs the rounding of a value to integer in a certain mode */
51
51
static inline double php_round_helper (double adjusted_value , double value , double coefficient , int mode ) {
52
- double integral , fractional , edge_case ;
52
+ double integral = adjusted_value >= 0.0 ? floor ( adjusted_value ) : ceil ( adjusted_value ) ;
53
53
double value_abs = fabs (value );
54
+ double edge_case ;
54
55
55
- /* Split the input value into the integral and fractional part.
56
- *
57
- * Both parts will have the same sign as the input value. We take
58
- * the absolute value of the fractional part (which will not result
59
- * in branches in the assembly) to make the following cases simpler.
60
- */
61
- fractional = fabs (modf (adjusted_value , & integral ));
62
56
if (fabs (adjusted_value ) >= value_abs ) {
63
57
edge_case = fabs ((integral + copysign (0.5 , integral )) / coefficient );
64
58
} else {
You can’t perform that action at this time.
0 commit comments