Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
5 changes: 0 additions & 5 deletions src/libc/acosh.c → src/libc/acoshf.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,3 @@ float acoshf(float x)
}

double acosh(double) __attribute__((alias("acoshf")));

long double acoshl(long double x)
{
return logl(x + sqrtl(x * x - 1));
}
6 changes: 6 additions & 0 deletions src/libc/acoshl.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include <math.h>

long double acoshl(long double x)
{
return logl(x + sqrtl(x * x - 1));
}
37 changes: 0 additions & 37 deletions src/libc/asin.c

This file was deleted.

37 changes: 37 additions & 0 deletions src/libc/asinf.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/* Copyright (c) 2000-2008 Zilog, Inc. */

/**
* asin(arg) return the arcsin of arg.
* arctan is called after appropriate range reduction.
*/

#include <errno.h>
#include <math.h>

#define pio2 1.57079632679490

float _asinf_c(float arg) {
float sign, temp;

sign = 1.;
if(arg < 0) {
arg = -arg;
sign = -1.;
}

if(arg > 1.) {
errno = EDOM;
return(0.);
}

temp = sqrtf(1. - arg*arg);
if(arg > 0.7) {
temp = pio2 - atanf(temp/arg);
} else {
temp = atanf(arg/temp);
}

return(sign*temp);
}

double _asin_c(double) __attribute__((alias("_asinf_c")));
File renamed without changes.
5 changes: 0 additions & 5 deletions src/libc/asinh.c → src/libc/asinhf.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,3 @@ float asinhf(float x)
}

double asinh(double) __attribute__((alias("asinhf")));

long double asinhl(long double x)
{
return logl(x + sqrtl(x * x + 1));
}
6 changes: 6 additions & 0 deletions src/libc/asinhl.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include <math.h>

long double asinhl(long double x)
{
return logl(x + sqrtl(x * x + 1));
}
84 changes: 0 additions & 84 deletions src/libc/atan.c

This file was deleted.

28 changes: 0 additions & 28 deletions src/libc/atan2.c

This file was deleted.

28 changes: 28 additions & 0 deletions src/libc/atan2f.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/* Copyright (c) 2000-2008 Zilog, Inc. */
#include <math.h>

#define pio2 1.57079632679489e0

float _atan2f_c(float arg1,float arg2) {
float satan(float);

if((arg1+arg2)==arg1) {
if(arg1 >= 0.) {
return(pio2);
} else {
return(-pio2);
}
} else if(arg2 < 0.) {
if(arg1 >= 0.) {
return(pio2+pio2 - satan(-arg1/arg2));
} else {
return(-pio2-pio2 + satan(arg1/arg2));
}
} else if(arg1 > 0) {
return(satan(arg1/arg2));
} else {
return(-satan(-arg1/arg2));
}
}

double _atan2_c(double, double) __attribute__((alias("_atan2f_c")));
File renamed without changes.
84 changes: 84 additions & 0 deletions src/libc/atanf.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/* Copyright (c) 2000-2008 Zilog, Inc. */

/**
* floating-point arctangent
*
* atan returns the value of the arctangent of its
* argument in the range [-pi/2,pi/2].
*
* atan2 returns the arctangent of arg1/arg2
* in the range [-pi,pi].
*
* there are no error returns.
*
* coefficients are #5077 from Hart & Cheney. (19.56D)
*/
#include <math.h>

#define sq2p1 2.41421356237309e0
#define sq2m1 0.414213562373095e0
#define pio2 1.57079632679489e0
#define pio4 0.785398163397448e0
#define p4 0.161536412982230e2
#define p3 0.268425481955040e3
#define p2 0.115302935154049e4
#define p1 0.178040631643320e4
#define p0 0.896785974036639e3
#define q4 0.589569705084446e2
#define q3 0.536265374031215e3
#define q2 0.166678381488163e4
#define q1 0.207933497444541e4
#define q0 0.896785974036639e3

/**
* atan makes its argument positive and
* calls the inner routine satan.
*/

float _atanf_c(float arg) {
float satan(float);

if(arg>0) {
return(satan(arg));
} else {
return(-satan(-arg));
}
}

double _atan_c(double) __attribute__((alias("_atanf_c")));

/**
* atan2 discovers what quadrant the angle
* is in and calls atan.
*/


/**
* xatan evaluates a series valid in the
* range [-0.414...,+0.414...].
*/

static float xatan(float arg) {
float argsq;
float value;

argsq = arg*arg;
value = ((((p4*argsq + p3)*argsq + p2)*argsq + p1)*argsq + p0);
value = value/(((((argsq + q4)*argsq + q3)*argsq + q2)*argsq + q1)*argsq + q0);
return(value*arg);
}

/**
* satan reduces its argument (known to be positive)
* to the range [0,0.414...] and calls xatan.
*/

float satan(float arg) {
if(arg < sq2m1) {
return(xatan(arg));
} else if(arg > sq2p1) {
return(pio2 - xatan(1.0/arg));
} else {
return(pio4 + xatan((arg-1.0)/(arg+1.0)));
}
}
File renamed without changes.
5 changes: 0 additions & 5 deletions src/libc/atanh.c → src/libc/atanhf.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,3 @@ float atanhf(float x)
}

double atanh(double) __attribute__((alias("atanhf")));

long double atanhl(long double x)
{
return .5l * logl((1 + x) / (1 - x));
}
6 changes: 6 additions & 0 deletions src/libc/atanhl.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include <math.h>

long double atanhl(long double x)
{
return .5L * logl((1 + x) / (1 - x));
}
Loading
Loading