Gwyddion – Free SPM (AFM, SNOM/NSOM, STM, MFM, …) data analysis software

Math Fallback

Math Fallback — Fallback implementations of standard mathematical functions

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 ()

Types and Values

#define pow10
#define cbrt
#define hypot
#define acosh
#define asinh
#define atanh
#define gwy_isinf
#define gwy_isnan
#define gwy_powi

Includes

#include <libgwyddion/gwymathfallback.h>

Description

Fallback functions gwy_math_fallback_foo 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 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.

Functions

gwy_math_fallback_pow10 ()

double
gwy_math_fallback_pow10 (double x);

Fallback for the standard mathematical function pow10.

Parameters

x

Floating point number.

 

Returns

10 raised to x .

Since: 2.9

gwy_math_fallback_cbrt ()

double
gwy_math_fallback_cbrt (double x);

Fallback for the standard mathematical function cbrt.

Parameters

x

Floating point number.

 

Returns

Cubic root of x .

Since: 2.9

gwy_math_fallback_hypot ()

double
gwy_math_fallback_hypot (double x,
                         double y);

Fallback for the standard mathematical function hypot.

Parameters

x

Floating point number.

 

y

Floating point number.

 

Returns

Length of hypotenuse of a right-angle triangle with sides of lengths x and y .

Since: 2.9

gwy_math_fallback_acosh ()

double
gwy_math_fallback_acosh (double x);

Fallback for the standard mathematical function acosh.

Parameters

x

Floating point number greater or equal to 1.0.

 

Returns

Inverse hyperbolic cosine of x .

Since: 2.9

gwy_math_fallback_asinh ()

double
gwy_math_fallback_asinh (double x);

Fallback for the standard mathematical function asinh.

Parameters

x

Floating point number.

 

Returns

Inverse hyperbolic sine of x .

Since: 2.9

gwy_math_fallback_atanh ()

double
gwy_math_fallback_atanh (double x);

Fallback for the standard mathematical function atanh.

Parameters

x

Floating point number in the range [-1, 1].

 

Returns

Inverse hyperbolic tangent of x .

Since: 2.9

gwy_math_fallback_powi ()

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.

Parameters

x

Floating point number.

 

i

Integer power.

 

Returns

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

gwy_math_fallback_isinf ()

int
gwy_math_fallback_isinf (double x);

Fallback for the standard mathematical function isinf.

Parameters

x

Floating point number.

 

Returns

TRUE if x is infinity, FALSE otherwise.

Since: 2.22

gwy_math_fallback_isnan ()

int
gwy_math_fallback_isnan (double x);

Fallback for the standard mathematical function isnan.

Parameters

x

Floating point number.

 

Returns

TRUE if x is infinity, FALSE otherwise.

Since: 2.22

Types and Values

pow10

#define pow10 exp10

Macro defined to gwy_math_fallback_pow10() if the platform does not provide pow10.

cbrt

#define cbrt gwy_math_fallback_cbrt

Macro defined to gwy_math_fallback_cbrt() if the platform does not provide cbrt.

hypot

#define hypot gwy_math_fallback_hypot

Macro defined to gwy_math_fallback_hypot() if the platform does not provide hypot.

acosh

#define acosh gwy_math_fallback_acosh

Macro defined to gwy_math_fallback_acosh() if the platform does not provide acosh.

asinh

#define asinh gwy_math_fallback_asinh

Macro defined to gwy_math_fallback_asinh() if the platform does not provide asinh.

atanh

#define atanh gwy_math_fallback_atanh

Macro defined to gwy_math_fallback_atanh() if the platform does not provide atanh.

gwy_isinf

#define gwy_isinf isinf

Macro defined to working isinf() implementation, either a system one or gwy_math_fallback_isinf().

Since: 2.22

gwy_isnan

#define gwy_isnan isnan

Macro defined to working isnan() implementation, either a system one or gwy_math_fallback_isnan().

Since: 2.22

gwy_powi

#  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

© David Nečas and Petr Klapetek

Home Download News Features Screenshots Documentation Communicate Participate Resources Publications Applications Site Map

Valid XHTML 1.0 Valid CSS