Math Fallback — Fallback implementations of standard mathematical functions
double | gwy_math_fallback_pow10 () |
double | gwy_math_fallback_cbrt () |
double | gwy_math_fallback_hypot () |
double | gwy_math_fallback_acosh () |
double | gwy_math_fallback_asinh () |
double | gwy_math_fallback_atanh () |
double | gwy_math_fallback_powi () |
int | gwy_math_fallback_isinf () |
int | gwy_math_fallback_isnan () |
#define | pow10 |
#define | cbrt |
#define | hypot |
#define | acosh |
#define | asinh |
#define | atanh |
#define | gwy_isinf |
#define | gwy_isnan |
#define | gwy_powi |
#include <libgwyddion/gwymathfallback.h>
Fallback functions gwy_math_fallback_
are defined for
mathematical functions foo
that might not be implemented on all
platforms and are commonly used in Gwyddion. These functions are always defined (as foo
static
inline
), however, you should not use them as they can be less efficient or precise than the standard
functions.
For each unavailable function (and only for those), this header file defines a replacement macro expanding to the
name of the fallback function. Therefore after including it, you can use for instance cbrt
regardless if the platform provides it or not. Note this header has to be included explicitly to avoid possible
inadvertent clashes with other definitions of cbrt
.
Since all replacement macros expand to names of functions, it is possible to take the address of any of them.
double
gwy_math_fallback_pow10 (double x
);
Fallback for the standard mathematical function pow10
.
x |
Floating point number. |
10 raised to x
.
Since: 2.9
double
gwy_math_fallback_cbrt (double x
);
Fallback for the standard mathematical function cbrt
.
x |
Floating point number. |
Cubic root of x
.
Since: 2.9
double gwy_math_fallback_hypot (double x
,double y
);
Fallback for the standard mathematical function hypot
.
x |
Floating point number. |
|
y |
Floating point number. |
Length of hypotenuse of a right-angle triangle with sides of lengths x
and y
.
Since: 2.9
double
gwy_math_fallback_acosh (double x
);
Fallback for the standard mathematical function acosh
.
x |
Floating point number greater or equal to 1.0. |
Inverse hyperbolic cosine of x
.
Since: 2.9
double
gwy_math_fallback_asinh (double x
);
Fallback for the standard mathematical function asinh
.
x |
Floating point number. |
Inverse hyperbolic sine of x
.
Since: 2.9
double
gwy_math_fallback_atanh (double x
);
Fallback for the standard mathematical function atanh
.
x |
Floating point number in the range [-1, 1]. |
Inverse hyperbolic tangent of x
.
Since: 2.9
double gwy_math_fallback_powi (double x
,int i
);
Fallback for the integer power function.
It provides the same functionality as GCC's __builtin_powi()
for finite fast math, without any precision guarantee.
x |
Floating point number. |
|
i |
Integer power. |
Value of x
raised to i
-th power. If i
is zero, the return values is 1, even when x
is zero.
Since: 2.53
int
gwy_math_fallback_isinf (double x
);
Fallback for the standard mathematical function isinf
.
x |
Floating point number. |
TRUE
if x
is infinity, FALSE
otherwise.
Since: 2.22
int
gwy_math_fallback_isnan (double x
);
Fallback for the standard mathematical function isnan
.
x |
Floating point number. |
TRUE
if x
is infinity, FALSE
otherwise.
Since: 2.22
#define pow10 exp10
Macro defined to gwy_math_fallback_pow10()
if the platform does not provide pow10
.
#define cbrt gwy_math_fallback_cbrt
Macro defined to gwy_math_fallback_cbrt()
if the platform does not provide cbrt
.
#define hypot gwy_math_fallback_hypot
Macro defined to gwy_math_fallback_hypot()
if the platform does not provide hypot
.
#define acosh gwy_math_fallback_acosh
Macro defined to gwy_math_fallback_acosh()
if the platform does not provide acosh
.
#define asinh gwy_math_fallback_asinh
Macro defined to gwy_math_fallback_asinh()
if the platform does not provide asinh
.
#define atanh gwy_math_fallback_atanh
Macro defined to gwy_math_fallback_atanh()
if the platform does not provide atanh
.
#define gwy_isinf isinf
Macro defined to working isinf()
implementation, either a system one or gwy_math_fallback_isinf()
.
Since: 2.22
#define gwy_isnan isnan
Macro defined to working isnan()
implementation, either a system one or gwy_math_fallback_isnan()
.
Since: 2.22
# define gwy_powi gwy_math_fallback_powi
Macro defined to working integer power implementation, either a compiler provided one or gwy_math_fallback_powi()
.
Since: 2.53