On Fri, Dec 21, 2018 at 08:59:04PM +0200, Janne Blomqvist wrote: > On Fri, Dec 21, 2018 at 7:59 PM Steve Kargl < > > > > D.3853 = *i; > > __result_foo = scalbnq (c, > > (integer(kind=4)) MAX_EXPR <MIN_EXPR <D.3853, 2147483647>, > > -2147483647>); > > > > The range [-32443,32443] is a subset of [-huge(),huge(0)]. > > > > True. I guess the advantage of scalbln* would be to avoid the MAX/MIN_EXPR > and casting for kind int64. >
fdlibm-based libm has #define NMAX 65536 #define NMIN -65536 double scalbln(double x, long n) { return (scalbn(x, (n > NMAX) ? NMAX : (n < NMIN) ? NMIN : (int)n)); } A search for glibc's libm locates https://tinyurl.com/ybcy8w4t which is a bit-twiddling routine. Not sure it's worth the effort. Joseph Myers might have an opinion. -- Steve