Skip to content

Commit a69877f

Browse files
committed
+1
1 parent f2770cb commit a69877f

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

Objects/floatobject.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1929,15 +1929,15 @@ PyFloat_Pack2(double x, char *data, int le)
19291929
* canonical NaN of the new type". The canonical NaN here
19301930
* is a positive qNaN with zero payload. */
19311931
/* add payload */
1932-
u16 -= (u16 & 0x1ff);
1932+
if (v & (1ULL << 63)) {
1933+
u16 |= (uint16_t)(1U << 15); /* set sign */
1934+
}
1935+
u16 -= (uint16_t)(u16 & 0x1ff);
19331936
u16 += (uint16_t)((v & 0x7ffffffffffffULL) >> 42);
19341937
/* if have payload, make sNaN */
19351938
if ((v & (1ULL << 51)) == 0 && (u16 & 0x1ff)) {
19361939
u16 &= ~(uint16_t)(1 << 9);
19371940
}
1938-
if (v & (1ULL << 63)) {
1939-
u16 |= (uint16_t)(1U << 15); /* set sign */
1940-
}
19411941
memcpy(&y, &u16, 2);
19421942
#endif
19431943
}

0 commit comments

Comments
 (0)