Skip to content

Commit f2770cb

Browse files
committed
+1
1 parent eb06f94 commit f2770cb

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

Objects/floatobject.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1928,17 +1928,16 @@ PyFloat_Pack2(double x, char *data, int le)
19281928
* different floating-point type, the result is the
19291929
* canonical NaN of the new type". The canonical NaN here
19301930
* is a positive qNaN with zero payload. */
1931-
if (v & (1ULL << 63)) {
1932-
u16 |= (uint16_t)(1U << 15); /* set sign */
1933-
}
19341931
/* add payload */
19351932
u16 -= (u16 & 0x1ff);
19361933
u16 += (uint16_t)((v & 0x7ffffffffffffULL) >> 42);
19371934
/* if have payload, make sNaN */
19381935
if ((v & (1ULL << 51)) == 0 && (u16 & 0x1ff)) {
19391936
u16 &= ~(uint16_t)(1 << 9);
19401937
}
1941-
1938+
if (v & (1ULL << 63)) {
1939+
u16 |= (uint16_t)(1U << 15); /* set sign */
1940+
}
19421941
memcpy(&y, &u16, 2);
19431942
#endif
19441943
}

0 commit comments

Comments
 (0)