File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2819,12 +2819,15 @@ def compare_total(self, other):
28192819 other_nan = other ._isnan ()
28202820 if self_nan or other_nan :
28212821 if self_nan == other_nan :
2822- if self ._int < other ._int :
2822+ # compare payloads as though they're integers
2823+ self_key = len (self ._int ), self ._int
2824+ other_key = len (other ._int ), other ._int
2825+ if self_key < other_key :
28232826 if sign :
28242827 return _One
28252828 else :
28262829 return _NegativeOne
2827- if self . _int > other . _int :
2830+ if self_key > other_key :
28282831 if sign :
28292832 return _NegativeOne
28302833 else :
Original file line number Diff line number Diff line change @@ -154,6 +154,22 @@ extr1301 fma Inf 0 sNaN456 -> NaN Invalid_operation
154154extr1302 fma 0E123 -Inf sNaN789 -> NaN Invalid_operation
155155extr1302 fma -Inf 0E-456 sNaN148 -> NaN Invalid_operation
156156
157+ -- Issue #6794: when comparing NaNs using compare_total, payloads
158+ -- should be compared as though positive integers; not
159+ -- lexicographically as strings.
160+ extr1400 comparetotal NaN123 NaN45 -> 1
161+ extr1401 comparetotal sNaN123 sNaN45 -> 1
162+ extr1402 comparetotal -NaN123 -NaN45 -> -1
163+ extr1403 comparetotal -sNaN123 -sNaN45 -> -1
164+ extr1404 comparetotal NaN45 NaN123 -> -1
165+ extr1405 comparetotal sNaN45 sNaN123 -> -1
166+ extr1406 comparetotal -NaN45 -NaN123 -> 1
167+ extr1407 comparetotal -sNaN45 -sNaN123 -> 1
168+
169+ extr1410 comparetotal -sNaN63450748854172416 -sNaN911993 -> -1
170+ extr1411 comparetotmag NaN1222222222222 -NaN999999 -> 1
171+
172+
157173-- max/min/max_mag/min_mag bug in 2.5.2/2.6/3.0: max(NaN, finite) gave
158174-- incorrect answers when the finite number required rounding; similarly
159175-- for the other thre functions
Original file line number Diff line number Diff line change 6565Library
6666-------
6767
68+ - Issue #6794: Fix Decimal.compare_total and Decimal.compare_total_mag: NaN
69+ payloads are now ordered by integer value rather than lexicographically.
70+
6871- Issue #1356969: Add missing info methods in tix.HList.
6972
7073- Issue #1522587: New constants and methods for the tix.Grid widget.
You can’t perform that action at this time.
0 commit comments