Reduce confusion in scalbnl() family of functions.

The changes unrelated to the bug in r277948 made
the code very difficult to understand to both
coverity and regular humans so take a step back
to something that is much easier to understand
for both and follows better the original code.

CID:	1267992, 1267993, 1267994
Discussed with:	kargl
This commit is contained in:
Pedro F. Giffuni 2015-02-03 14:17:29 +00:00
parent 98173b7fa7
commit 73c031c5d4

View File

@ -35,7 +35,9 @@ scalbln (double x, long n)
{
int in;
in = (n > INT_MAX) ? INT_MAX : (n < INT_MIN) ? INT_MIN : n;
in = (int)n;
if (in != n)
in = (n > 0) ? INT_MAX: INT_MIN;
return (scalbn(x, in));
}
@ -44,7 +46,9 @@ scalblnf (float x, long n)
{
int in;
in = (n > INT_MAX) ? INT_MAX : (n < INT_MIN) ? INT_MIN : n;
in = (int)n;
if (in != n)
in = (n > 0) ? INT_MAX: INT_MIN;
return (scalbnf(x, in));
}
@ -53,6 +57,9 @@ scalblnl (long double x, long n)
{
int in;
in = (n > INT_MAX) ? INT_MAX : (n < INT_MIN) ? INT_MIN : n;
in = (int)n;
if (in != n) {
in = (n > 0) ? INT_MAX: INT_MIN;
}
return (scalbnl(x, in));
}