Commit 43ebe21
committed
Fix scientific() on small positive numbers.
Checking a number is negative using `'-' in string_value` leads to confusion
because 1e-30 and -1e30 both contain a '-' but only one of them is negative.
This bug had found its way into the tests and the docstring.
Additionally, the removal of redundant leading '0's and '+'s from the exponent
would only kick in if both were present so that 1e20 would become 10⁺²⁰ instead
of just 10²⁰ and the insertion of negative exponents could lead to outputs such
as 3.00 x 10⁻⁺²⁰.1 parent 7688f20 commit 43ebe21
2 files changed
Lines changed: 11 additions & 23 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
337 | 337 | | |
338 | 338 | | |
339 | 339 | | |
340 | | - | |
| 340 | + | |
341 | 341 | | |
342 | 342 | | |
343 | 343 | | |
| |||
369 | 369 | | |
370 | 370 | | |
371 | 371 | | |
372 | | - | |
373 | 372 | | |
374 | 373 | | |
375 | | - | |
376 | 374 | | |
377 | | - | |
378 | | - | |
379 | | - | |
380 | | - | |
381 | | - | |
382 | | - | |
383 | | - | |
384 | | - | |
385 | | - | |
386 | | - | |
| 375 | + | |
387 | 376 | | |
388 | 377 | | |
389 | | - | |
| 378 | + | |
| 379 | + | |
390 | 380 | | |
391 | | - | |
392 | | - | |
393 | | - | |
394 | | - | |
395 | | - | |
| 381 | + | |
| 382 | + | |
396 | 383 | | |
397 | 384 | | |
398 | | - | |
399 | | - | |
400 | | - | |
401 | 385 | | |
402 | 386 | | |
403 | 387 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
147 | | - | |
| 147 | + | |
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
| |||
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
159 | 163 | | |
160 | 164 | | |
161 | 165 | | |
| |||
0 commit comments