ldexp requires i64 (not u64) exponent in numpy 1.21

This commit is contained in:
Jan Petykiewicz 2021-12-15 18:23:30 -08:00
parent 2a37a3e85f
commit e54d041d85

View File

@ -43,7 +43,7 @@ def decode_real8(nums: numpy.ndarray) -> numpy.ndarray:
exp = (nums >> 56) & 0x7f exp = (nums >> 56) & 0x7f
mant = (nums & 0x00ff_ffff_ffff_ffff).astype(numpy.float64) mant = (nums & 0x00ff_ffff_ffff_ffff).astype(numpy.float64)
mant[neg != 0] *= -1 mant[neg != 0] *= -1
return numpy.ldexp(mant, 4 * (exp - 64) - 56, dtype=numpy.float64) return numpy.ldexp(mant, (4 * (exp - 64) - 56).astype(numpy.int64))
def parse_real8(data: bytes) -> numpy.ndarray: def parse_real8(data: bytes) -> numpy.ndarray: