Commit 0fe540d
committed
Fix fractional() emitting degenerate output when the fraction rounds to a whole
When limit_denominator(1000) reduces the fractional part to a whole number
(denominator == 1), fold it into the integer part instead of printing a
degenerate "N/1". For example fractional(2.9999999) returned "2 1/1"
instead of "3", fractional(0.9999999) returned "1/1" instead of "1",
and fractional(0) returned "0/1" instead of "0".1 parent c3a124c commit 0fe540d
2 files changed
Lines changed: 11 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
361 | 361 | | |
362 | 362 | | |
363 | 363 | | |
364 | | - | |
365 | | - | |
366 | | - | |
367 | | - | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
368 | 370 | | |
369 | 371 | | |
370 | 372 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
190 | 195 | | |
191 | 196 | | |
192 | 197 | | |
| |||
0 commit comments