Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
Commit420f0df
authored
Minor optimization for Fractions.limit_denominator (GH-93730)
When we construct the upper and lower candidates in limit_denominator,the numerator and denominator are already relatively prime (and thedenominator positive) by construction, so there's no need to go throughthe usual normalisation in the constructor. This saves a couple ofpotentially expensive gcd calls.Suggested by Michael Scott Asato Cuthbert inGH-93477.1 parent8305137 commit420f0df
1 file changed
+8
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
245 | 245 | | |
246 | 246 | | |
247 | 247 | | |
248 | | - | |
249 | 248 | | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
254 | 256 | | |
255 | | - | |
| 257 | + | |
256 | 258 | | |
257 | 259 | | |
258 | 260 | | |
| |||
0 commit comments
Comments
(0)