Commit b50f6f2
authored
[libc] Properly fix printf long double subnormals (#172103)
In a previous PR I fixed one case where subnormal long doubles would
cause an infinite loop in printf. It was an improper fix though. The
problem was that a shift on the fixed point representation would
sometimes go negative, since the effective exponent of a subnormal is
lower than the minimum allowed exponent value. This patch extends the
fixed point representation to have space for subnormals, and adds an
assert to check that lshifts are always positive. The previous fix of
sometimes shifting right instead of left caused a loss of precision
which also sometimes caused infinite loops in the %e code.1 parent ad2fca7 commit b50f6f2
File tree
2 files changed
+22
-9
lines changed- libc
- src/__support
- test/src/stdio
2 files changed
+22
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
618 | 618 | | |
619 | 619 | | |
620 | 620 | | |
621 | | - | |
| 621 | + | |
622 | 622 | | |
623 | 623 | | |
624 | 624 | | |
625 | 625 | | |
626 | 626 | | |
627 | 627 | | |
628 | | - | |
629 | | - | |
630 | | - | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
631 | 633 | | |
632 | 634 | | |
633 | 635 | | |
| |||
699 | 701 | | |
700 | 702 | | |
701 | 703 | | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
702 | 707 | | |
703 | | - | |
704 | | - | |
705 | | - | |
706 | | - | |
707 | | - | |
| 708 | + | |
708 | 709 | | |
709 | 710 | | |
710 | 711 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2484 | 2484 | | |
2485 | 2485 | | |
2486 | 2486 | | |
| 2487 | + | |
| 2488 | + | |
| 2489 | + | |
| 2490 | + | |
| 2491 | + | |
| 2492 | + | |
| 2493 | + | |
| 2494 | + | |
| 2495 | + | |
| 2496 | + | |
| 2497 | + | |
| 2498 | + | |
2487 | 2499 | | |
2488 | 2500 | | |
2489 | 2501 | | |
| |||
0 commit comments