Repository navigation
Commit 4a8dbb8
committed
Carry intword() to the next unit for values >= 10^24
The rounding carry compared `rounded_value * power == powers[ordinal + 1]`,
a float product against an exact int power. `float(10**k) != 10**k` for
k >= 24, so from septillion up the equality was False and the carry was
skipped: `10**24 - 1` rendered as "1000.0 sextillion" instead of
"1.0 septillion". Compare the rounded mantissa against the exact integer
ratio between adjacent powers instead; every power is a power of ten so the
ratio is exact, and it stays large across the decillion-to-googol gap, so
`10**36` is unchanged at "1000.0 decillion".
Fixes #400.1 parent 3201e70 commit 4a8dbb8
2 files changed
Lines changed: 24 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
255 | 255 | | |
256 | 256 | | |
257 | 257 | | |
258 | | - | |
259 | | - | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
260 | 271 | | |
261 | 272 | | |
262 | 273 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
119 | 130 | | |
120 | 131 | | |
121 | 132 | | |
| |||
0 commit comments