Commit a267ca7
authored
Improve performance of x**y when y is a huge value (#438)
When y.exponent is several thousand or more, x**y was slow because exponentiation by squaring requires several thousands of multiplications.
Use exp and log in such case.
Needed to calaculate (1+1/n).power(n, prec)1 parent cb2458b commit a267ca7
2 files changed
+22
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
168 | | - | |
169 | 168 | | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
182 | 186 | | |
183 | | - | |
184 | 187 | | |
185 | 188 | | |
186 | 189 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1991 | 1991 | | |
1992 | 1992 | | |
1993 | 1993 | | |
| 1994 | + | |
| 1995 | + | |
| 1996 | + | |
| 1997 | + | |
| 1998 | + | |
1994 | 1999 | | |
1995 | 2000 | | |
1996 | 2001 | | |
| |||
0 commit comments