Something wrong in scalblnl()

Bruce Evans brde at
Fri Jan 30 07:40:00 UTC 2015

On Fri, 30 Jan 2015, Pedro Giffuni wrote:

> Looking at the clang checker report:
> <>
> in the scalblnl() implementation we are assigning a value to “in” and but we are ignoring it for the calculation. looking at the family of similar functions nearby, it looks clear that we have a typo in the return value.

The second-last line should use 'in', as in the other functions.

This shows that exceptional cases in scalbnl() were never tested.

Things to fix nearby:
- gnu-style parentheses
- the conversion can be done a bit more cleanly using

 	in = (n > MAX) ? MAX : (n < MIN) ? MIN : n;

   where MAX and MIN can be INT_MAX and INT_MIN or just +- of a large value
   related to the maximum exponent.


More information about the freebsd-numerics mailing list