summaryrefslogtreecommitdiff
path: root/numpy/polynomial/polyutils.py
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh@gotplt.org>2019-10-15 16:21:36 -0400
committerSiddhesh Poyarekar <siddhesh@gotplt.org>2019-10-15 16:21:36 -0400
commit744a2ac0fab372c8ef633ffa15702387a24db204 (patch)
treed6c52cfb5e5452005e83a35ffd1ea2336d19be6a /numpy/polynomial/polyutils.py
parentea66b1d154a99ed7e4325150ef1bf509b7a2b268 (diff)
downloadnumpy-744a2ac0fab372c8ef633ffa15702387a24db204.tar.gz
BUG: Do not rely on undefined behaviour to cast from float to datetime
A cast from float to signed integer is only valid for the range of integer, which means that a cast of a NaN to int is undefined. On x86 cvttd2si conveniently seems to put the mantissa into the long (I haven't done an exhaustive check to see if that is what it does, but seems that way), which works for conversion from NaN to NaT. On aarch64 however, the corresponding fcvtzs sets the value to 0 for all undefined ranges, thus breaking the cast. This explicitly checks for NaN for conversions from floating point types to DATETIME and TIMEDELTA and sets the target value as NaT, which should make the behaviour well defined for NaN to NaT translations.
Diffstat (limited to 'numpy/polynomial/polyutils.py')
0 files changed, 0 insertions, 0 deletions