Add declarations and docs for float/long double versions of existing functions.

This commit is contained in:
Stephen Heumann 2021-11-21 14:38:30 -06:00
parent 4ebdb4ad04
commit b2874b8bf6
4 changed files with 142 additions and 26 deletions

View File

@ -62,43 +62,65 @@ int __fpcompare(long double, long double, short);
#endif
double acos(double);
float acosf(float);
long double acosl(long double);
double asin(double);
float asinf(float);
long double asinl(long double);
double atan(double);
double cos(double);
double cosh(double);
double exp(double);
double log(double);
double log10(double);
double sin(double);
double sinh(double);
double sqrt(double);
double tan(double);
double tanh(double);
float atanf(float);
long double atanl(long double);
double atan2(double, double);
double ceil(double);
double fabs(double);
double floor(double);
double fmod(double, double);
double frexp(double, int *);
double ldexp(double, int);
double modf(double, double *);
double pow(double, double);
float atan2f(float, float);
long double atan2l(long double, long double);
double cbrt(double);
float cbrtf(float);
long double cbrtl(long double);
double ceil(double);
float ceilf(float);
long double ceill(long double);
double copysign(double, double);
float copysignf(float, float);
long double copysignl(long double, long double);
double cos(double);
float cosf(float);
long double cosl(long double);
double cosh(double);
float coshf(float);
long double coshl(long double);
double exp(double);
float expf(float);
long double expl(long double);
double exp2(double);
float exp2f(float);
long double exp2l(long double);
double expm1(double);
float expm1f(float);
long double expm1l(long double);
double fabs(double);
float fabsf(float);
long double fabsl(long double);
double floor(double);
float floorf(float);
long double floorl(long double);
double fmod(double, double);
float fmodf(float, float);
long double fmodl(long double, long double);
double frexp(double, int *);
float frexpf(float, int *);
long double frexpl(long double, int *);
int ilogb(double);
int ilogbf(float);
int ilogbl(long double);
double ldexp(double, int);
float ldexpf(float, int);
long double ldexpl(long double, int);
double log(double);
float logf(float);
long double logl(long double);
double log10(double);
float log10f(float);
long double log10l(long double);
double log1p(double);
float log1pf(float);
long double log1pl(long double);
@ -111,6 +133,12 @@ long double logbl(long double);
long lrint(double);
long lrintf(float);
long lrintl(long double);
double modf(double, double *);
float modff(float, float *);
long double modfl(long double, long double *);
double pow(double, double);
float powf(float, float);
long double powl(long double, long double);
double remainder(double, double);
float remainderf(float, float);
long double remainderl(long double, long double);
@ -123,6 +151,21 @@ long double rintl(long double);
double scalbn(double, int);
float scalbnf(float, int);
long double scalbnl(long double, int);
double sin(double);
float sinf(float);
long double sinl(long double);
double sinh(double);
float sinhf(float);
long double sinhl(long double);
double sqrt(double);
float sqrtf(float);
long double sqrtl(long double);
double tan(double);
float tanf(float);
long double tanl(long double);
double tanh(double);
float tanhf(float);
long double tanhl(long double);
double trunc(double);
float truncf(float);
long double truncl(long double);

View File

@ -73,6 +73,8 @@ int rand(void);
void *realloc(void *, size_t);
void srand(unsigned);
double strtod(const char *, char **);
float strtof(const char *, char **);
long double strtold(const char *, char **);
long strtol(const char *, char **, int);
unsigned long strtoul(const char *, char **, int);
#if defined(__ORCAC_HAS_LONG_LONG__) || __STDC_VERSION__ >= 199901L

View File

@ -12,13 +12,6 @@
#include <math.h>
/*
* Note: This header currently contains only some of the macros specified
* in the C99 and later standards. Others are not present because the
* corresponding functions either are not available at all or have only
* an unsuffixed version available.
*/
#define __tg_real_x(fn,x) _Generic((x), \
float: fn##f, \
long double: fn##l, \
@ -39,19 +32,43 @@
long double: fn##l, \
default: _Generic((y), long double: fn##l, default: fn))((x),(y),(other))
#define __tg_x(fn,x) __tg_real_x(fn,(x))
#define __tg_x_y(fn,x,y) __tg_real_x_y(fn,(x),(y))
#define acos(x) __tg_x(acos,(x))
#define asin(x) __tg_x(asin,(x))
#define atan(x) __tg_x(atan,(x))
#define atan2(y,x) __tg_real_x_y(atan2,(y),(x))
#define cbrt(x) __tg_real_x(cbrt,(x))
#define ceil(x) __tg_real_x(ceil,(x))
#define cos(x) __tg_x(cos,(x))
#define cosh(x) __tg_x(cosh,(x))
#define copysign(x,y) __tg_real_x_y(copysign,(x),(y))
#define exp(x) __tg_x(exp,(x))
#define exp2(x) __tg_real_x(exp2,(x))
#define expm1(x) __tg_real_x(expm1,(x))
#define fabs(x) __tg_real_x(fabs,(x))
#define floor(x) __tg_real_x(floor,(x))
#define fmod(x,y) __tg_real_x_y(fmod,(x),(y))
#define frexp(x,nptr) __tg_real_x_other(frexp,(x),(nptr))
#define ilogb(x) __tg_real_x(ilogb,(x))
#define ldexp(x,n) __tg_real_x_other(ldexp,(x),(n))
#define log(x) __tg_x(log,(x))
#define log10(x) __tg_real_x(log10,(x))
#define log1p(x) __tg_real_x(log1p,(x))
#define log2(x) __tg_real_x(log2,(x))
#define logb(x) __tg_real_x(logb,(x))
#define lrint(x) __tg_real_x(lrint,(x))
#define pow(x,y) __tg_x_y(pow,(x),(y))
#define remainder(x,y) __tg_real_x_y(remainder,(x),(y))
#define remquo(x,y,quo) __tg_real_x_y_other(remquo,(x),(y),(quo))
#define rint(x) __tg_real_x(rint,(x))
#define scalbn(x,n) __tg_real_x_other(scalbn,(x),(n))
#define sin(x) __tg_x(sin,(x))
#define sinh(x) __tg_x(sinh,(x))
#define sqrt(x) __tg_x(sqrt,(x))
#define tan(x) __tg_x(tan,(x))
#define tanh(x) __tg_x(tanh,(x))
#define trunc(x) __tg_real_x(trunc,(x))
#endif

View File

@ -973,6 +973,60 @@ long double truncl(long double x);
These functions truncate x to an integer (discarding the fractional part).
There are also added functions that correspond to existing <math.h> functions, but using float or long double for their argument and return types. In ORCA/C, most of these actually behave identically to the existing un-suffixed versions. An exception is the modf family of functions, which differ in the type of the location in which the integer part of the value is stored.
#include <math.h>
float acosf(float x);
long double acosl(long double x);
float asinf(float x);
long double asinl(long double x);
float atanf(float x);
long double atanl(long double x);
float atan2f(float y, float x);
long double atan2l(long double y, long double x);
float ceilf(float x);
long double ceill(long double x);
float cosf(float x);
long double cosl(long double x);
float coshf(float x);
long double coshl(long double x);
float expf(float x);
long double expl(long double x);
float fabsf(float x);
long double fabsl(long double x);
float floorf(float x);
long double floorl(long double x);
float fmodf(float x, float y);
long double fmodl(long double x, long double y);
float frexpf(float x, int *nptr);
long double frexpl(long double x, int *nptr);
float ldexpf(float x, int n);
long double ldexpl(long double x, int n);
float logf(float x);
long double logl(long double x);
float log10f(float x);
long double log10l(long double x);
float modff(float x, float *nptr);
long double modfl(long double x, long double *nptr);
float powf(float x, float y);
long double powl(long double x, long double y);
float sinf(float x);
long double sinl(long double x);
float sinhf(float x);
long double sinhl(long double x);
float sqrtf(float x);
long double sqrtl(long double x);
float tanf(float x);
long double tanl(long double x);
float tanhf(float x);
long double tanhl(long double x);
Similarly, there are float and long double analogs of the string conversion function strtod. As currently implemented in ORCA/C, all of these functions behave identically, giving values with the precision and range of long double.
#include <stdlib.h>
float strtof(const char * restrict str, char ** restrict ptr);
long double strtold(const char * restrict str, char ** restrict ptr);
-- Compiler changes introduced in C 2.1.0 -----------------------------------
The Default .h File