mirror of
https://git.planet-casio.com/Lephenixnoir/OpenLibm.git
synced 2024-12-28 04:23:41 +01:00
Update to the latest s_scalbln.c from msun.
This commit is contained in:
parent
763da44606
commit
a2f4e102f2
1 changed files with 9 additions and 34 deletions
|
@ -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));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue