Update to the latest s_scalbln.c from msun.

This commit is contained in:
Viral B. Shah 2015-02-20 23:56:48 +05:30
parent 763da44606
commit a2f4e102f2

View file

@ -24,55 +24,30 @@
* SUCH DAMAGE.
*/
#include "cdefs-compat.h"
//__FBSDID("$FreeBSD: src/lib/msun/src/s_scalbln.c,v 1.2 2005/03/07 04:57:50 das Exp $");
#include <sys/cdefs.h>
#include <limits.h>
#include <openlibm_math.h>
#include "math_private.h"
#define NMAX 65536
#define NMIN -65536
DLLEXPORT double
scalbln (double x, long n)
scalbln(double x, long n)
{
int in;
in = (int)n;
if (in != n) {
if (n > 0)
in = INT_MAX;
else
in = INT_MIN;
}
return (scalbn(x, in));
return (scalbn(x, (n > NMAX) ? NMAX : (n < NMIN) ? NMIN : (int)n));
}
DLLEXPORT float
scalblnf (float x, long n)
scalblnf(float x, long n)
{
int in;
in = (int)n;
if (in != n) {
if (n > 0)
in = INT_MAX;
else
in = INT_MIN;
}
return (scalbnf(x, in));
return (scalbnf(x, (n > NMAX) ? NMAX : (n < NMIN) ? NMIN : (int)n));
}
DLLEXPORT long double
scalblnl (long double x, long n)
scalblnl(long double x, long n)
{
int in;
in = (int)n;
if (in != n) {
if (n > 0)
in = INT_MAX;
else
in = INT_MIN;
}
return (scalbnl(x, (int)n));
return (scalbnl(x, (n > NMAX) ? NMAX : (n < NMIN) ? NMIN : (int)n));
}