@@ -233,15 +233,19 @@ def type_info(np_type):
233
233
if vals in ((112 , 15 , 16 ), # binary128
234
234
(info_64 .nmant , info_64 .nexp , 8 ), # float64
235
235
(63 , 15 , 12 ), (63 , 15 , 16 )): # Intel extended 80
236
- pass # these are OK
237
- elif vals in ((52 , 15 , 12 ), # windows float96
238
- (52 , 15 , 16 )): # windows float128?
236
+ return ret # these are OK without modification
237
+ # The remaining types are longdoubles with bad finfo values. Some we
238
+ # correct, others we wait to hear of errors.
239
+ # We start with float64 as basis
240
+ ret = type_info (np .float64 )
241
+ if vals in ((52 , 15 , 12 ), # windows float96
242
+ (52 , 15 , 16 )): # windows float128?
239
243
# On windows 32 bit at least, float96 is Intel 80 storage but operating
240
244
# at float64 precision. The finfo values give nexp == 15 (as for intel
241
245
# 80) but in calculations nexp in fact appears to be 11 as for float64
242
- return type_info ( np . float64 ) .update (dict (width = width ))
246
+ ret .update (dict (width = width ))
243
247
elif vals == (1 , 1 , 16 ) and processor () == 'powerpc' : # broken PPC
244
- ret = type_info ( np . float64 ) .update (dict (nmant = 106 , width = width ))
248
+ ret .update (dict (nmant = 106 , width = width ))
245
249
else : # don't recognize the type
246
250
raise FloatingError ('We had not expected type %s' % np_type )
247
251
return ret
@@ -549,7 +553,7 @@ def ok_floats():
549
553
Remove longdouble if it has no higher precision than float64
550
554
"""
551
555
floats = sorted (np .sctypes ['float' ], key = lambda f : type_info (f )['nmant' ])
552
- if best_float () != np .longdouble :
556
+ if best_float () != np .longdouble and np . longdouble in floats :
553
557
floats .remove (np .longdouble )
554
558
return floats
555
559
0 commit comments