Skip to content

Commit 5bfcbe5

Browse files
committed
Unify variable names such as f1 to "exponent"
1 parent 7d6b939 commit 5bfcbe5

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

ext/standard/math.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,15 @@ static inline double php_intpow10(int power) {
4848

4949
/* {{{ php_round_helper
5050
Actually performs the rounding of a value to integer in a certain mode */
51-
static inline double php_round_helper(double adjusted_value, double value, double coefficient, int mode) {
51+
static inline double php_round_helper(double adjusted_value, double value, double exponent, int mode) {
5252
double integral = adjusted_value >= 0.0 ? floor(adjusted_value) : ceil(adjusted_value);
5353
double value_abs = fabs(value);
5454
double edge_case;
5555

5656
if (fabs(adjusted_value) >= value_abs) {
57-
edge_case = fabs((integral + copysign(0.5, integral)) / coefficient);
57+
edge_case = fabs((integral + copysign(0.5, integral)) / exponent);
5858
} else {
59-
edge_case = fabs((integral + copysign(0.5, integral)) * coefficient);
59+
edge_case = fabs((integral + copysign(0.5, integral)) * exponent);
6060
}
6161

6262
switch (mode) {
@@ -148,7 +148,7 @@ static inline double php_round_helper(double adjusted_value, double value, doubl
148148
* mode. For the specifics of the algorithm, see http://wiki.php.net/rfc/rounding
149149
*/
150150
PHPAPI double _php_math_round(double value, int places, int mode) {
151-
double f1;
151+
double exponent;
152152
double tmp_value;
153153

154154
if (!zend_finite(value) || value == 0.0) {
@@ -157,28 +157,28 @@ PHPAPI double _php_math_round(double value, int places, int mode) {
157157

158158
places = places < INT_MIN+1 ? INT_MIN+1 : places;
159159

160-
f1 = php_intpow10(abs(places));
160+
exponent = php_intpow10(abs(places));
161161

162162
/* adjust the value */
163163
if (places >= 0) {
164-
tmp_value = value * f1;
164+
tmp_value = value * exponent;
165165
} else {
166-
tmp_value = value / f1;
166+
tmp_value = value / exponent;
167167
}
168168
/* This value is beyond our precision, so rounding it is pointless */
169169
if (fabs(tmp_value) >= 1e15) {
170170
return value;
171171
}
172172

173173
/* round the temp value */
174-
tmp_value = php_round_helper(tmp_value, value, f1, mode);
174+
tmp_value = php_round_helper(tmp_value, value, exponent, mode);
175175

176176
/* see if it makes sense to use simple division to round the value */
177177
if (abs(places) < 23) {
178178
if (places > 0) {
179-
tmp_value = tmp_value / f1;
179+
tmp_value = tmp_value / exponent;
180180
} else {
181-
tmp_value = tmp_value * f1;
181+
tmp_value = tmp_value * exponent;
182182
}
183183
} else {
184184
/* Simple division can't be used since that will cause wrong results.

0 commit comments

Comments
 (0)