On Thu, 19 Jan 2017, Tamar Christina wrote: > > The old code set orig_arg before converting IBM long double to double. > > Your code sets it after the conversion. The old code set min_exp based on > > a string set from REAL_MODE_FORMAT (orig_mode)->emin - 1; your code uses > > the adjusted mode. Both of those are incorrect for IBM long double. > > Hmm, this is correct, I've made the change to be like it was before, but > there's something I don't quite get about the old code, if it's building rmin > the orig_mode which is larger than mode, but then creating the real using > build_real (type, rmin) using the adjusted type, shouldn't it not be getting > truncated?
The value is a power of 2, which is *larger* than the minimum normal value for double (as they have the same least subnormal value). Looking further at the code, my only remaining comments are for the cases where you aren't using the integer path: in is_normal you use LT_EXPR to compare with +Inf, but need to use __builtin_isless, likewise in is_subnormal again you should be using __builtin_isless and __builtin_isgreater, in is_finite you should be using __builtin_islessequal. All the existing expressions will raise spurious "invalid" exceptions for quiet NaN arguments. (I'm presuming that the output of these functions goes through folding that converts __builtin_isless to !UNGE_EXPR, etc.) -- Joseph S. Myers jos...@codesourcery.com