Skip to content

Commit 342e8d5

Browse files
committed
BF: fix tests for binary128 / longdouble
Tests for windows float96 failing because of a change in the logic of the type_info routine, so the routine was not returning after it identifies windows float96. Test for binary128 failing because Intel 80 float128 has the same exponent precision and width, on 64 bit platforms. Add nmant == 112 test.
1 parent f2b665f commit 342e8d5

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

nibabel/casting.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ def type_info(np_type):
252252
# at float64 precision. The finfo values give nexp == 15 (as for intel
253253
# 80) but in calculations nexp in fact appears to be 11 as for float64
254254
ret.update(dict(width=width))
255+
return ret
255256
# Oh dear, we don't recognize the type information. Try some known types
256257
# and then give up. At this stage we're expecting exotic longdouble or their
257258
# complex equivalent.

nibabel/tests/test_floating.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,8 @@ def test_floor_exact():
263263
def test_usable_binary128():
264264
# Check for usable binary128
265265
yes = have_binary128()
266-
abf = np.longdouble(2) ** 16383
266+
exp_test = np.longdouble(2) ** 16383
267267
assert_equal(yes,
268-
abf.dtype.itemsize == 16 and
269-
np.isfinite(abf))
268+
exp_test.dtype.itemsize == 16 and
269+
np.isfinite(exp_test) and
270+
_check_nmant(np.longdouble, 112))

0 commit comments

Comments
 (0)