Fungsi Math Arduino
Fungsi Math Arduino
Fungsi Math Arduino
#define M_E 2.7182818284590452354
#define M_PI 3.14159265358979323846 /* pi */
#define NAN __builtin_nan("")
#define INFINITY __builtin_inf()
#define cosf cos
#define sinf sin
#define tanf tan
#define fabsf fabs
#define fmodf fmod
#define cbrtf cbrt
#define hypotf hypot
#define squaref square
#define floorf floor
#define ceilf ceil
#define frexpf frexp
#define ldexpf ldexp
#define expf exp
#define coshf cosh
#define sinhf sinh
#define tanhf tanh
#define acosf acos
#define asinf asin
#define atanf atan
#define atan2f atan2
#define logf log
#define log10f log10
#define powf pow
#define isnanf isnan
#define isinff isinf
#define isfinitef isfinite
#define copysignf copysign
#define signbitf signbit
#define fdimf fdim
#define fmaf fma
#define fmaxf fmax
#define fminf fmin
#define truncf trunc
#define roundf round
#define lroundf lround
#define lrintf lrint
Functions
double cos (double __x)
float sqrtf (float)
Detailed Description
#include <math.h>
Notes:
#define acosf acos
#define asinf asin
#define atan2f atan2
#define atanf atan
The alias for atan().
#define cbrtf cbrt
#define ceilf ceil
#define copysignf copysign
#define cosf cos
#define coshf cosh
#define expf exp
#define fabsf fabs
#define fdimf fdim
#define floorf floor
#define fmaf fma
#define fminf fmin
#define fmodf fmod
#define frexpf frexp
#define hypotf hypot
#define INFINITY __builtin_inf()
INFINITY constant.
#define isfinitef isfinite
#define isinff isinf
#define isnanf isnan
#define ldexpf ldexp
#define log10f log10
The alias for log10().
#define logf log
#define lrintf lrint
#define lroundf lround
The constant 1/pi.
The constant 2/pi.
The constant 2/sqrt(pi).
#define M_E 2.7182818284590452354
The constant e.
#define M_PI 3.14159265358979323846 /* pi */
The constant pi.
The constant pi/2.
The constant pi/4.
The constant 1/sqrt(2).
#define NAN __builtin_nan("")
NAN constant.
#define powf pow
#define roundf round
#define signbitf signbit
#define sinf sin
The alias for sin().
#define sinhf sinh
#define squaref square
#define tanf tan
#define tanhf tanh
#define truncf trunc
Function Documentation
The acos() function computes the principal value of the arc cosine of __x. The returned value is in
the range [0, pi] radians. A domain error occurs for arguments not in the range [-1, +1].
The asin() function computes the principal value of the arc sine of __x. The returned value is in the
range [-pi/2, pi/2] radians. A domain error occurs for arguments not in the range [-1, +1].
The atan() function computes the principal value of the arc tangent of __x. The returned value is in
the range [-pi/2, pi/2] radians.
The atan2() function computes the principal value of the arc tangent of __y / __x, using the signs of
both arguments to determine the quadrant of the return value. The returned value is in the range [-pi,
+pi] radians.
The ceil() function returns the smallest integral value greater than or equal to __x, expressed as a
floating-point number.
The copysign() function returns __x but with the sign of __y. They work even if __x or __y are NaN
or zero.
The fdim() function returns max(__x - __y, 0). If __x or __y or both are NaN, NaN is returned.
The floor() function returns the largest integral value less than or equal to __x, expressed as a
floating-point number.
The fma() function performs floating-point multiply-add. This is the operation (__x * __y) + __z, but
the intermediate result is not rounded to the destination type. This can sometimes improve the
precision of a calculation.
The fmax() function returns the greater of the two values __x and __y. If an argument is NaN, the
other argument is returned. If both arguments are NaN, NaN is returned.
The fmin() function returns the lesser of the two values __x and __y. If an argument is NaN, the
other argument is returned. If both arguments are NaN, NaN is returned.
The frexp() function breaks a floating-point number into a normalized fraction and an integral power
of 2. It stores the integer in the int object pointed to by __pexp.
If __x is a normal float point number, the frexp() function returns the value v, such that v has a
magnitude in the interval [1/2, 1) or zero, and __x equals v times 2 raised to the power __pexp.
If __x is zero, both parts of the result are zero. If __x is not a finite number,
the frexp() returns __x as is and stores 0 by __pexp.
Note
This implementation permits a zero pointer as a directive to skip a storing the exponent.
The isfinite() function returns a nonzero value if __x is finite: not plus or minus infinity, and not NaN.
The function isinf() returns 1 if the argument __x is positive infinity, -1 if __x is negative infinity, and
0 otherwise.
Note
The GCC 4.3 can replace this function with inline code that returns the 1 value for both
infinities (gcc bug #35509).
The lrint() function rounds __x to the nearest integer, rounding the halfway cases to the even integer
direction. (That is both 1.5 and 2.5 values are rounded to 2). This function is similar to rint() function,
but it differs in type of return value and in that an overflow is possible.
Returns
The rounded long integer value. If __x is not a finite number or an overflow was, this
realization returns the LONG_MIN value (0x80000000).
The lround() function rounds __x to the nearest integer, but rounds halfway cases away from zero
(instead of to the nearest even integer). This function is similar to round() function, but it differs in
type of return value and in that an overflow is possible.
Returns
The rounded long integer value. If __x is not a finite number or an overflow was, this
realization returns the LONG_MIN value (0x80000000).
Note
This implementation skips writing by zero pointer. However, the GCC 4.3 can replace this
function with inline code that does not permit to use NULL address for the avoiding of
storing.
An alias for modf().
The round() function rounds __x to the nearest integer, but rounds halfway cases away from zero
(instead of to the nearest even integer). Overflow is impossible.
Returns
The rounded value. If __x is an integral or infinite, __x itself is returned. If __x is NaN,
then NaN is returned.
The signbit() function returns a nonzero value if the value of __x has its sign bit set. This is not the
same as `__x < 0.0', because IEEE 754 floating point allows zero to be signed. The comparison `-
0.0 < 0.0' is false, but `signbit (-0.0)' will return a nonzero value.
An alias for sqrt().
Note
This function does not belong to the C standard definition.