On Fri, 21 Dec 2018, Steve Kargl wrote: > 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.
Such comparisons are needed in the scalbn / scalbln implementations anyway to deal with large exponents. I suppose where there's a suitable scalbln implementation, and you don't know if the arguments are within the range of int, calling scalbln at least saves code size in the caller and avoids duplicating those range checks. -- Joseph S. Myers jos...@codesourcery.com