Skip to content

Commit 1431d36

Browse files
committed
Add payload handling
1 parent a094f8e commit 1431d36

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

extra/decimal_printer.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,22 @@ def decimal32_summary(valobj, internal_dict):
1818

1919
if bits & 2113929216 == 2113929216:
2020
result = "SNAN"
21+
isnan = True
2122
elif bits & 2080374784 == 2080374784:
2223
result = "QNAN"
23-
elif bits & 2080374784 == 2080374784:
24-
result = "INF"
24+
isnan = True
25+
elif bits & 2080374784 == 2013265920:
26+
if sign:
27+
result = "-INF"
28+
else:
29+
result = "INF"
2530
else:
2631
raise ValueError("Unknown Finite Value")
32+
33+
if isnan:
34+
payload = bits & 8388607
35+
if payload > 0:
36+
result += str(payload)
2737
else:
2838
# See decimal32_t::to_components()
2939
d32_comb_11_mask = 1610612736

0 commit comments

Comments
 (0)