summaryrefslogtreecommitdiff
path: root/numpy/core/numeric.py
diff options
context:
space:
mode:
authorSebastian Berg <sebastian@sipsolutions.net>2019-01-24 18:22:47 +0100
committerCharles Harris <charlesr.harris@gmail.com>2019-01-24 10:22:47 -0700
commit7e3d558aeee5a8a5eae5ebb6aef03de892a92ebd (patch)
treea7acbb60f94d2a4365472e24f5c4460980f69c45 /numpy/core/numeric.py
parenta5cace49b79690795df29c6da3587e7a45a41591 (diff)
downloadnumpy-7e3d558aeee5a8a5eae5ebb6aef03de892a92ebd.tar.gz
BUG: Fix rounding of denormals in double and float to half casts … (#12722)
* BUG: Fix rounding of denormals in double and float to half casts Previously the significand was shifted right to align denormals of different magnitude. This loses some bits that can make a difference for rounding. This is fixed: 1. For floats, by inspecting the original last bits when this may make a difference (should happen rarely) 2. For doubles by shifting the bits left to align the denromals and thus not lose the lowest orginal bits. * TST: Test half denormal rounding The test assumes that half to even is active, if this is ever changed or allowed to change, the test will fail. * Fixup: Fixup for halffloat.c The one code path cannot be used. The other must have been a typo, but is a valid bug, a new test for it in the next commit. * TST: half casting lower bits are not lost for denormal results The first test only tested the off by one, this one specifically tests that all bits are used to decide if "round to nearest even" should be used, in the example of rounding towards 0. * TST: Test not just denormals but all positive finite float16s * DOC: Add lots of comments and add a short release note.
Diffstat (limited to 'numpy/core/numeric.py')
0 files changed, 0 insertions, 0 deletions