3232 shape_zoom_affine ,
3333 rec2dict )
3434
35- from ..casting import FloatingError , floor_log2 , type_info , best_float
35+ from ..casting import ( floor_log2 , type_info , best_float , OK_FLOATS )
3636
3737from numpy .testing import (assert_array_almost_equal ,
3838 assert_array_equal )
@@ -426,17 +426,6 @@ def check_against(f1, f2):
426426 assert_equal (better_float_of ('i4' , 'i8' , 'f8' ), np .float64 )
427427
428428
429- def have_longer_double ():
430- # True if longdouble has more precision than float64, and longdouble is
431- # something we can rely on
432- nmant_64 = type_info (np .float64 )['nmant' ] # should be 52
433- try :
434- nmant_ld = type_info (np .longdouble )['nmant' ]
435- except FloatingError :
436- return False
437- return nmant_ld > nmant_64
438-
439-
440429def test_best_write_scale_ftype ():
441430 # Test best write scaling type
442431 # Types return better of (default, array type) unless scale overflows.
@@ -453,7 +442,7 @@ def test_best_write_scale_ftype():
453442 better_float_of (dtt , np .float32 ))
454443 # Overflowing ints with scaling results in upcast
455444 best_vals = ((np .float32 , np .float64 ),)
456- if have_longer_double () :
445+ if np . longdouble in OK_FLOATS :
457446 best_vals += ((np .float64 , np .longdouble ),)
458447 for lower_t , higher_t in best_vals :
459448 # Information on this float
0 commit comments