Commit 20bb598
committed
type_max_num_digits: correctly handle signed types
In type_max_num_digits() properly handle signed types that require more
digits to represent the minimum value than they do the maximum value.
A signed type often has a minimum value that has a larger absolute value
than the maximum value. In theory, because of this, the minimum value
could require more digits to represent.
(In practice this doesn't really occur; minimum/maximum values tend to
have the same number of decimal digits. However, this change makes the
code correct even in those theoretical cases).1 parent 28d99c3 commit 20bb598
1 file changed
+25
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
498 | 499 | | |
499 | 500 | | |
500 | 501 | | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
501 | 509 | | |
502 | 510 | | |
503 | | - | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
504 | 514 | | |
505 | 515 | | |
506 | | - | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
507 | 530 | | |
508 | 531 | | |
509 | 532 | | |
| |||
0 commit comments