- Implement scalblnl.

- In scalbln and scalblnf, check the bounds of the second argument.
  This is probably unnecessary, but strictly speaking, we should
  report an error if someone tries to compute scalbln(x, INT_MAX + 1ll).
This commit is contained in:
David Schultz 2005-03-07 04:57:50 +00:00
parent caacab9b5f
commit 7b6a19039d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=143219

View file

@ -27,18 +27,50 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <limits.h>
#include <math.h>
double
scalbln (double x, long n)
{
int in;
return (scalbn(x, (int)n));
in = (int)n;
if (in != n) {
if (n > 0)
in = INT_MAX;
else
in = INT_MIN;
}
return (scalbn(x, in));
}
float
scalblnf (float x, long n)
{
int in;
return (scalbnf(x, (int)n));
in = (int)n;
if (in != n) {
if (n > 0)
in = INT_MAX;
else
in = INT_MIN;
}
return (scalbnf(x, in));
}
long double
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));
}