From bccbcb132b130e9f337445d56748c5aa68390419 Mon Sep 17 00:00:00 2001 From: Stephen Heumann Date: Fri, 24 Dec 2021 15:57:29 -0600 Subject: [PATCH] Add headers and docs for additional functions. --- ORCACDefs/math.h | 9 +++++++++ ORCACDefs/tgmath.h | 3 +++ cc.notes | 25 +++++++++++++++++++++++-- 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/ORCACDefs/math.h b/ORCACDefs/math.h index ca28cd4..956132b 100644 --- a/ORCACDefs/math.h +++ b/ORCACDefs/math.h @@ -75,9 +75,15 @@ long double acoshl(long double); double asin(double); float asinf(float); long double asinl(long double); +double asinh(double); +float asinhf(float); +long double asinhl(long double); double atan(double); float atanf(float); long double atanl(long double); +double atanh(double); +float atanhf(float); +long double atanhl(long double); double atan2(double, double); float atan2f(float, float); long double atan2l(long double, long double); @@ -126,6 +132,9 @@ long double fmodl(long double, long double); double frexp(double, int *); float frexpf(float, int *); long double frexpl(long double, int *); +double hypot(double, double); +float hypotf(float, float); +long double hypotl(long double, long double); int ilogb(double); int ilogbf(float); int ilogbl(long double); diff --git a/ORCACDefs/tgmath.h b/ORCACDefs/tgmath.h index f78d7b9..cf3ef25 100644 --- a/ORCACDefs/tgmath.h +++ b/ORCACDefs/tgmath.h @@ -38,7 +38,9 @@ #define acos(x) __tg_x(acos,(x)) #define acosh(x) __tg_x(acosh,(x)) #define asin(x) __tg_x(asin,(x)) +#define asinh(x) __tg_x(asinh,(x)) #define atan(x) __tg_x(atan,(x)) +#define atanh(x) __tg_x(atanh,(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)) @@ -55,6 +57,7 @@ #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 hypot(x,y) __tg_real_x_y(hypot,(x),(y)) #define ilogb(x) __tg_real_x(ilogb,(x)) #define ldexp(x,n) __tg_real_x_other(ldexp,(x),(n)) #define llrint(x) __tg_real_x(llrint,(x)) diff --git a/cc.notes b/cc.notes index 8d9882b..16dc252 100644 --- a/cc.notes +++ b/cc.notes @@ -457,7 +457,7 @@ Generic selection expressions are primarily useful within macros, which can give 23. (C11) Character constants and string literals may now have prefixes indicating they should use Unicode encodings. The prefixes u8, u, and U indicate UTF-8, UTF-16, and UTF-32 encodings, respectively. The u8 prefix may only be used on string literals. The U and u prefixes may be used on string literals or character constants. U- and u-prefixed character constants have the types char32_t and char16_t (as defined in ); U- and u-prefixed string literals are treated as arrays of those types. For example, the string literal U"abc" designates an array with four members of type char32_t: the three letters encoded in UTF-32, plus a null terminator. -24. (C99) Floating-point constants may now be expressed in a hexadecimal format. These consist of a leading 0X or 0x, followed by a sequence of hexadecimal digits optionally containing a period, then P or p, then an exponent expressed as a sequence of decimal digits optionally preceded by + or -. These designate the number given by the hexadecimal digit sequence (with any digits after the period being the fractional part) multiplied by 2 raised to the specified exponent. For example, the constant 0xF.8p-1 is equivalent to 7.75. +24. (C99) Floating-point constants may now be expressed in a hexadecimal format. These consist of a leading 0X or 0x, followed by a sequence of hexadecimal digits optionally containing a period, then P or p, then an exponent expressed as a sequence of decimal digits optionally preceded by + or -. These designate the number given by the hexadecimal digit sequence (with any digits after the period being the fractional part) multiplied by 2 raised to the specified exponent. For example, the constant 0xF.8p-1 is equivalent to 7.75. Note that ORCA/C currently only supports this hexadecimal floating-point format in C source code, not as an input or output format for any library functions. 25. (C99) When a function parameter is declared with an array type, type qualifiers and/or the keyword "static" may be included within the angle brackets that designate the array type. For example, a function may be defined as: @@ -897,12 +897,26 @@ These macros accept arguments of any real floating types, i.e. float, double, or Also, note that under ORCA/C these functions generally will not set errno for error conditions (e.g. domain and range errors). However, they do set floating-point exceptions as appropriate. The functions documented above can be used to retrieve these exceptions, allowing errors to be detected. #include -dou acosh(double x); +double acosh(double x); float acoshf(float x); long double acoshl(long double x); These functions return the (non-negative) inverse hyperbolic cosine of x. +#include +double asinh(double x); +float asinhf(float x); +long double asinhl(long double x); + +These functions return the inverse hyperbolic sine of x. + +#include +double atanh(double x); +float atanhf(float x); +long double atanhl(long double x); + +These functions return the inverse hyperbolic tangent of x. + #include double cbrt(double x); float cbrtf(float x); @@ -950,6 +964,13 @@ long double fminl(long double x, long double y); These functions return the minimum numeric value of their arguments. If one argument is a NaN, the other argument is returned. +#include +double hypot(double x, double y); +float hypotf(float x, float y); +long double hypotl(long double x, long double y); + +These functions return the square root of x^2 + y^2, without undue overflow or underflow. + #include int ilogb(double x); int ilogbf(float x);