Skip to content

Commit fa0b577

Browse files
committed
fixed a comment
1 parent 42221ed commit fa0b577

File tree

1 file changed

+5
-10
lines changed
  • ext/bcmath/libbcmath/src

1 file changed

+5
-10
lines changed

ext/bcmath/libbcmath/src/div.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -142,18 +142,13 @@ static inline void bc_standard_div(
142142
* Since B = 10^b, the formula becomes:
143143
* MAX_E = (n2_high * B * (B^k - 1)) / (n2_high * (n2_high * B^k + B^k - 1))
144144
* MAX_E = (10^x * 10^b * ((10^b)^k - 1)) / (10^x * (10^x * (10^b)^k + (10^b)^k - 1))
145-
* MAX_E = (10^(x + b) * (10^(k * b) - 1)) / (10^(2x + k * b) + 10^(x + k * b) + 10^x)
146-
* MAX_E = (10^(x + b) * (10^(k * b) - 1)) / (10^(x + k * b) * (10^x + 1) + 10^x)
147145
*
148-
* Now let's make an approximation. Remove -1 from the numerator and +1 from the denominator. Approximate
149-
* the numerator to be large and the denominator to be small, such that MAX_E is less than this expression.
150-
* MAX_E = (10^(x + b) * (10^(k * b) - 1)) / (10^(x + k * b) * (10^x + 1) + 10^x)
151-
* MAX_E < (10^(x + b) * 10^(k * b)) / (10^(x + k * b) * 10^x + 10^x)
152-
* MAX_E < (10^(x + k + 2b)) / (10^x * (10^(x + k * b) + 1))
146+
* Now let's make an approximation. Remove -1 from the numerator. Approximate the numerator to be
147+
* large and the denominator to be small, such that MAX_E is less than this expression.
148+
* Also, the denominator "(10^b)^k - 1" is never a negative value, so delete it.
153149
*
154-
* Approximate again and remove +1 in the denominator
155-
* MAX_E < 10^(x + k + 2b) / (10^x * (10^(x + k * b) + 1))
156-
* MAX_E < 10^(x + k + 2b) / (10^x * 10^(x + k * b))
150+
* MAX_E = (10^x * 10^b * ((10^b)^k - 1)) / (10^x * (10^x * (10^b)^k + (10^b)^k - 1))
151+
* MAX_E < (10^x * 10^b * (10^b)^k) / (10^x * 10^x * (10^b)^k)
157152
* MAX_E < 10^b / 10^x
158153
* MAX_E < 10^(b - x)
159154
*

0 commit comments

Comments
 (0)