defines, structs and C-functions More...
#include <stdio.h>Go to the source code of this file.
Classes | |
| union | BM_STATUS |
| basic math status (BM_STATUS) informations More... | |
Defines | |
| #define | __INT64_DEFINED__ |
| indicates that the data type int64 now is defined | |
| #define | EXA (1.E18) |
| Multiplier for SI units. | |
| #define | PETA (1.E15) |
| #define | TERA (1.E12) |
| #define | GIGA (1.E9) |
| #define | MEGA (1.E6) |
| #define | KILO (1.E3) |
| #define | MILLI (1.E-3) |
| #define | MICRO (1.E-6) |
| #define | NANO (1.E-9) |
| #define | PICO (1.E-12) |
| #define | FEMTO (1.E-15) |
| #define | ATTO (1.E-18) |
| #define | ONE_DIV_3 (1.0 / 3.0) |
| simple and often used constants | |
| #define | ONE_DIV_4 (1.0 / 4.0) |
| #define | PI (3.1415926535897932384626433832795) |
| angle circular measure: radian = degree * PI / 180 | |
| #define | PI1 (PI / 180.0) |
| #define | PI18 (PI / 10.0) |
| #define | PI20 (PI / 9.0) |
| #define | PI30 (PI / 6.0) |
| #define | PI36 (PI / 5.0) |
| #define | PI40 (2.0 * PI / 9.0) |
| #define | PI45 (PI / 4.0) |
| #define | PI54 (3.0 * PI / 10.0) |
| #define | PI60 (PI / 3.0) |
| #define | PI72 (2.0 * PI / 5.0) |
| #define | PI90 (PI / 2.0) |
| #define | PI108 (3.0 * PI / 5.0) |
| #define | PI120 (2.0 * PI / 3.0) |
| #define | PI135 (3.0 * PI / 4.0) |
| #define | PI180 (PI) |
| #define | PI240 (2.0 * PI120) |
| #define | PI270 (3.0 * PI / 2.0) |
| #define | PI360 (2.0 * PI) |
| #define | DEG1 (180.0 / PI) |
| #define | SQRT2 (1.4142135623730950488016887242097) |
| #define | SQRT3 (1.7320508075688772935274463415059) |
Typedefs | |
| typedef long long | int64 |
| 64 bit signed integer | |
| typedef unsigned long long | uint64 |
| 64 bit unsigned integer | |
Functions | |
| void | printBM_STATUS (const BM_STATUS bms, FILE *file) |
| prints a basic math status (BM_STATUS) to file | |
| int | isDouble (const double *value, BM_STATUS *bms) |
| tests for a valid 64 bit floating point value (double) | |
| int | isI64 (const int64 *value, BM_STATUS *bms) |
| tests for a valid 64 bit integer value (int64) | |
| double | doubleAddDouble (const double augend, const double addend, BM_STATUS *bms) |
| safe addition | |
| int64 | i64AddI64 (const int64 augend, const int64 addend, BM_STATUS *bms) |
| safe addition | |
| double | doubleSubDouble (const double minuend, const double subtrahend, BM_STATUS *bms) |
| safe subtraction | |
| int64 | i64SubI64 (const int64 minuend, const int64 subtrahend, BM_STATUS *bms) |
| safe subtraction | |
| double | doubleMulDouble (const double multiplier, const double multiplicand, BM_STATUS *bms) |
| safe multiplication | |
| int64 | i64MulI64 (const int64 multiplier, const int64 multiplicand, BM_STATUS *bms) |
| safe multiplication | |
| double | doubleDivDouble (const double numerator, const double denominator, BM_STATUS *bms) |
| safe division | |
| int64 | i64DivI64 (const int64 numerator, const int64 denominator, BM_STATUS *bms) |
| safe division | |
| double | doubleModDouble (const double numerator, const double denominator, BM_STATUS *bms) |
| safe modulo | |
| int64 | i64ModI64 (const int64 numerator, const int64 denominator, BM_STATUS *bms) |
| safe modulo | |
| double | reciprocDouble (const double value, BM_STATUS *bms) |
| safe reciproc (1/x) | |
| double | ceilDouble (const double value, BM_STATUS *bms) |
| Calculates the ceiling of value. | |
| double | floorDouble (const double value, BM_STATUS *bms) |
| Calculates the floor of value. | |
| int64 | doubleToInt64 (const double value, double *intDbl, BM_STATUS *bms) |
| strips the decimal places from value and returns the integer (int64) | |
| double | i64ToDouble (const int64 value) |
| converts from int64 to a value in double format | |
| double | roundDouble (const double value, const int decPlaces, BM_STATUS *bms) |
| rounds value to a specified number of decimal places | |
| int | doubleCompareDouble (const double value1, const double value2, const double diff, BM_STATUS *bms) |
| compares value1 with value2 | |
| int | i64CompareI64 (const int64 value1, const int64 value2, const int64 diff) |
| compares value1 with value2 | |
| int | isEvenI64 (const int64 value) |
| returns 1 if value is even (.. -4, -2, 0, +2, +4, ..) | |
| double | positiveDouble (const double value, BM_STATUS *bms) |
| calculates the absolute value of value | |
| int64 | positiveI64 (const int64 value, BM_STATUS *bms) |
| calculates the absolute value of value | |
| double | negativeDouble (const double value, BM_STATUS *bms) |
| calculates the negative absolute value of value | |
| int64 | negativeI64 (const int64 value) |
| calculates the negative absolute value of value | |
| double | invertSignDouble (const double value, BM_STATUS *bms) |
| inverts the sign of value | |
| int64 | invertSignI64 (const int64 value, BM_STATUS *bms) |
| inverts the sign of value | |
| double | doublePow_2 (const double base, BM_STATUS *bms) |
| safe square (power 2) | |
| int64 | i64Pow_2 (const int64 base, BM_STATUS *bms) |
| safe square (power 2) | |
| double | doublePow_3 (const double base, BM_STATUS *bms) |
| safe cube (power 3) | |
| int64 | i64Pow_3 (const int64 base, BM_STATUS *bms) |
| safe cube (power 3) | |
| double | doublePow_4 (const double base, BM_STATUS *bms) |
| safe power 4 | |
| int64 | i64Pow_4 (const int64 base, BM_STATUS *bms) |
| safe power 4 | |
| double | doublePowDouble (const double base, const double exponent, BM_STATUS *bms) |
| safe power, calculates base pow exponent | |
| int64 | i64PowI64 (const int64 base, const int64 exponent, BM_STATUS *bms) |
| safe power, calculates base pow exponent | |
| double | doubleRoot_2 (const double radicand, BM_STATUS *bms) |
| safe square root | |
| int64 | i64Root_2 (const int64 radicand, BM_STATUS *bms) |
| safe square root | |
| double | doubleRoot_3 (const double radicant, BM_STATUS *bms) |
| safe cube root | |
| double | doubleRoot_4 (const double radicant, BM_STATUS *bms) |
| safe 4th root | |
| double | doubleRootDouble (const double radicant, const double rootExponent, BM_STATUS *bms) |
| safe exp-th root | |
| int64 | i64RootI64 (const int64 radicant, const int64 rootExponent, BM_STATUS *bms) |
| safe exp-th root | |
| double | doubleLogDouble (const double base, const double value, BM_STATUS *bms) |
| returns the base-logarithm of value | |
| int64 | i64LogI64 (const int64 base, const int64 value, BM_STATUS *bms) |
| returns the base-logarithm of value | |
| void | sortAscendantDouble (double *values, const unsigned long count, BM_STATUS *bms) |
| sorts an array of values in ascendant order | |
| void | sortAscendantI64 (int64 *values, const unsigned long count) |
| sorts an array of values in ascendant order | |
| long | doubleSolveP1norm (double *xr, const double *pf) |
| solves the normalized polynom function of first degree | |
| long | doubleSolveP1 (double *xr, const double *pf) |
| solves the polynom function of first degree | |
| long | doubleSolveP2norm (double *xr, const double *pf) |
| solves the normalized polynom function of second degree | |
| long | doubleSolveP2 (double *xr, const double *pf) |
| solves the polynom function of second degree | |
| long | doubleSolveP3norm (double *xr, const double *pf) |
| solves the normalized polynom function of third degree | |
| long | doubleSolveP3 (double *xr, const double *pf) |
| solves the polynom function of third degree | |
| long | doubleSolveP4norm (double *xr, const double *pf) |
| solves the normalized polynom function of fourth degree | |
| long | doubleSolveP4 (double *xr, const double *pf) |
| solves the polynom function of fourth degree | |
| long | doubleGetPolyFactors1 (double *pf, const double *xz) |
| calculates the polynom factors of the given zero condition(s) | |
| BM_STATUS | doubleGetPolyFactors2 (double *pf, const double *xz) |
| calculates the polynom factors of the given zero condition(s) | |
| BM_STATUS | doubleGetPolyFactors3 (double *pf, const double *xz) |
| calculates the polynom factors of the given zero condition(s) | |
| BM_STATUS | doubleGetPolyFactors4 (double *pf, const double *xz) |
| calculates the polynom factors of the given zero condition(s) | |
| double | deg2RadDouble (const double degree, BM_STATUS *bms) |
| converts degree into radian | |
| double | rad2DegDouble (const double radian, BM_STATUS *bms) |
| converts radian into degree | |
| double | stringToDouble (const char *stringValue, BM_STATUS *bms) |
| converts stringValue into double | |
| int64 | stringToI64 (const char *stringValue, char **stopChar, BM_STATUS *bms) |
| converts stringValue into int64 | |
| double | strToDouble (const char *str, BM_STATUS *bms) |
| converts a null terminated string into a 80 bit floating point value (double) | |
| BM_STATUS | doubleSolveL1 (double *xr, const double *lf) |
| solves the linear equation with 1 unknown value | |
| BM_STATUS | doubleSolveL2 (double *xr, double *lf[2]) |
| solves the linear equations with 2 unknown values | |
| void | printDoubleBitpattern (double value, FILE *file) |
| prints the bitpattern of a double value in hex format | |
| void | printDoubleBitpatternFormatted (double value, FILE *file) |
| prints the formatted bitpattern of a double value (sign mantisse exponent) | |
| double | sinDouble (const double rad, BM_STATUS *bms) |
| calculates the sinus of rad | |
| double | asinDouble (const double value, BM_STATUS *bms) |
| calculates the arcus sinus of value [-1 .. +1] | |
| double | cosDouble (const double rad, BM_STATUS *bms) |
| calculates the cosinus of rad | |
| double | acosDouble (const double value, BM_STATUS *bms) |
| calculates the arcus cosinus of value [-1 .. +1] | |
| double | tanDouble (const double rad, BM_STATUS *bms) |
| calculates the tangent of rad | |
| double | atanDouble (const double value, BM_STATUS *bms) |
| calculates the arcus tangent of value | |
| double | cotDouble (const double rad, BM_STATUS *bms) |
| calculates the cotangent of rad | |
| double | acotDouble (const double value, BM_STATUS *bms) |
| calculates the arcus cotangent of value | |
| int | findDouble (const double *element1, const unsigned int count, const double elem) |
| looks for a same element in the array | |
| int | findI64 (const __int64 *element1, const unsigned int count, const __int64 elem) |
| looks for a same element in the array | |
defines, structs and C-functions
This file contains all definitions, structures and C-style functions for safe basic numeric mathematical operations
| #define ATTO (1.E-18) |
is a prefix in the metric system denoting 10^-18 or 0.000000000000000001
| #define DEG1 (180.0 / PI) |
1 rad converted to degree = 57.295779513082320876798154814105 deg
| #define EXA (1.E18) |
Multiplier for SI units.
is a prefix in the metric system denoting 10^18 or 1000000000000000000
| #define FEMTO (1.E-15) |
is a prefix in the metric system denoting 10^-15 or 0.000000000000001
| #define GIGA (1.E9) |
is a prefix in the metric system denoting 10^9 or 1000000000
| #define KILO (1.E3) |
is a prefix in the metric system denoting 10^3 or 1000
| #define MEGA (1.E6) |
is a prefix in the metric system denoting 10^6 or 1000000
| #define MICRO (1.E-6) |
is a prefix in the metric system denoting 10^-6 or 0.000001
| #define MILLI (1.E-3) |
is a prefix in the metric system denoting 10^-3 or 0.001
| #define NANO (1.E-9) |
is a prefix in the metric system denoting 10^-9 or 0.000000001
| #define ONE_DIV_3 (1.0 / 3.0) |
simple and often used constants
(1/3) as define
| #define ONE_DIV_4 (1.0 / 4.0) |
(1/4) as define
| #define PETA (1.E15) |
is a prefix in the metric system denoting 10^15 or 1000000000000000
| #define PI (3.1415926535897932384626433832795) |
angle circular measure: radian = degree * PI / 180
80 bit resolution, 32 digits
| #define PI1 (PI / 180.0) |
1 degree converted to radian
| #define PI108 (3.0 * PI / 5.0) |
108 degree converted to radian
| #define PI120 (2.0 * PI / 3.0) |
120 degree converted to radian
| #define PI135 (3.0 * PI / 4.0) |
135 degree converted to radian
| #define PI18 (PI / 10.0) |
18 degree converted to radian
| #define PI180 (PI) |
180 degree converted to radian
| #define PI20 (PI / 9.0) |
20 degree converted to radian
| #define PI240 (2.0 * PI120) |
240 degree converted to radian
| #define PI270 (3.0 * PI / 2.0) |
270 degree converted to radian
| #define PI30 (PI / 6.0) |
30 degree converted to radian
| #define PI36 (PI / 5.0) |
36 degree converted to radian
| #define PI360 (2.0 * PI) |
270 degree converted to radian
| #define PI40 (2.0 * PI / 9.0) |
40 degree converted to radian
| #define PI45 (PI / 4.0) |
45 degree converted to radian
| #define PI54 (3.0 * PI / 10.0) |
54 degree converted to radian
| #define PI60 (PI / 3.0) |
60 degree converted to radian
| #define PI72 (2.0 * PI / 5.0) |
72 degree converted to radian
| #define PI90 (PI / 2.0) |
90 degree converted to radian
| #define PICO (1.E-12) |
is a prefix in the metric system denoting 10^-12 or 0.000000000001
| #define SQRT2 (1.4142135623730950488016887242097) |
sqrt(2.0)
| #define SQRT3 (1.7320508075688772935274463415059) |
sqrt(3.0)
| #define TERA (1.E12) |
is a prefix in the metric system denoting 10^12 or 1000000000000
| double acosDouble | ( | const double | value, | |
| BM_STATUS * | bms | |||
| ) |
calculates the arcus cosinus of value [-1 .. +1]
result = acos( value )
| value | [-1 .. +1] | |
| bms | [out,opt] A pointer to receive basic math status informations (can be null). bms remains unchanged if there is no error in this operation. bms acts accumulative. |
| double acotDouble | ( | const double | value, | |
| BM_STATUS * | bms | |||
| ) |
calculates the arcus cotangent of value
result = acot( value );
| value | [in] the value for this calculation | |
| bms | [out,opt] A pointer to receive basic math status informations (can be null). bms remains unchanged if there is no error in this operation. bms acts accumulative. |
| double asinDouble | ( | const double | value, | |
| BM_STATUS * | bms | |||
| ) |
calculates the arcus sinus of value [-1 .. +1]
result = asin( value )
| value | [-1 .. +1] | |
| bms | [out,opt] A pointer to receive basic math status informations (can be null). bms remains unchanged if there is no error in this operation. bms acts accumulative. |
| double atanDouble | ( | const double | value, | |
| BM_STATUS * | bms | |||
| ) |
calculates the arcus tangent of value
result = atan( value )
| value | [-DBL_MAX .. +DBL_MAX] | |
| bms | [out,opt] A pointer to receive basic math status informations (can be null). bms remains unchanged if there is no error in this operation. bms acts accumulative. |
| double ceilDouble | ( | const double | value, | |
| BM_STATUS * | bms | |||
| ) |
Calculates the ceiling of value.
Calculates the smallest integer that is greater than or equal to value
| value | [in] the value for this calculation | |
| bms | [out,opt] A pointer to receive basic math status informations (can be null). bms remains unchanged if there is no error in this operation. bms acts accumulative. |
| double cosDouble | ( | const double | rad, | |
| BM_STATUS * | bms | |||
| ) |
calculates the cosinus of rad
result = cos( rad )
| rad | the angle [-DBL_MAX .. +DBL_MAX] | |
| bms | [out,opt] A pointer to receive basic math status informations (can be null). bms remains unchanged if there is no error in this operation. bms acts accumulative. |
| double cotDouble | ( | const double | rad, | |
| BM_STATUS * | bms | |||
| ) |
calculates the cotangent of rad
result = cos( rad ) / sin( rad ) = 1 / tan( rad )
| rad | [in] the value for this calculation | |
| bms | [out,opt] A pointer to receive basic math status informations (can be null). bms remains unchanged if there is no error in this operation. bms acts accumulative. |
| double deg2RadDouble | ( | const double | degree, | |
| BM_STATUS * | bms | |||
| ) |
converts degree into radian
rad = (degree / 180) * pi
| degree | [in] the degree value | |
| bms | [out,opt] A pointer to receive basic math status informations (can be null). bms remains unchanged if there is no error in this operation. bms acts accumulative. |
| double doubleAddDouble | ( | const double | augend, | |
| const double | addend, | |||
| BM_STATUS * | bms | |||
| ) |
safe addition
adds addend to augend and returns the result of this operation
| augend | [in] the first value for this operation | |
| addend | [in] the second value for this operation | |
| bms | [out,opt] A pointer to receive basic math status informations (can be null). bms remains unchanged if there is no error in this operation. bms acts accumulative. |
| int doubleCompareDouble | ( | const double | value1, | |
| const double | value2, | |||
| const double | diff, | |||
| BM_STATUS * | bms | |||
| ) |
compares value1 with value2
| value1 | the 64 bit floating point value | |
| value2 | the second value to be compared with value1 | |
| diff | minimum difference to detect equality | |
| bms | [out,opt] A pointer to receive basic math status informations (can be null). bms remains unchanged if there is no error in this operation. bms acts accumulative. |
| double doubleDivDouble | ( | const double | numerator, | |
| const double | denominator, | |||
| BM_STATUS * | bms | |||
| ) |
safe division
divides numerator with denominator and returns the result of this operation
| numerator | [in] the first value for this operation | |
| denominator | [in] the second value for this operation | |
| bms | [out,opt] A pointer to receive basic math status informations (can be null). bms remains unchanged if there is no error in this operation. bms acts accumulative. |
| long doubleGetPolyFactors1 | ( | double * | pf, | |
| const double * | xz | |||
| ) |
calculates the polynom factors of the given zero condition(s)
solves (x - xz[0]) = 0 -->> pf[0] = -xz[0]
| pf | [out] result for the polynom factor(s) pf[0] = offset | |
| xz | [in] zero condition(s) for the polynom |
| BM_STATUS doubleGetPolyFactors2 | ( | double * | pf, | |
| const double * | xz | |||
| ) |
calculates the polynom factors of the given zero condition(s)
solves (x - xz[1])*(x - xz[0]) = 0 -->> pf[0,1]
| pf | [out] result for the polynom factor(s) pf[0] = offset pf[1] = x-factor | |
| xz | [in] zero condition(s) for the polynom |
| BM_STATUS doubleGetPolyFactors3 | ( | double * | pf, | |
| const double * | xz | |||
| ) |
calculates the polynom factors of the given zero condition(s)
solves (x - xz[2])*(x - xz[1])*(x - xz[0]) = 0 -->> pf[0,1,2]
| pf | [out] result for the polynom factor(s) pf[0] = offset pf[1] = x-factor pf[2] = x^2-factor | |
| xz | [in] zero condition(s) for the polynom |
| BM_STATUS doubleGetPolyFactors4 | ( | double * | pf, | |
| const double * | xz | |||
| ) |
calculates the polynom factors of the given zero condition(s)
solves (x - xz[3])*(x - xz[2])*(x - xz[1])*(x - xz[0]) = 0 -->> pf[0,1,2,3]
| pf | [out] result for the polynom factor(s) pf[0] = offset pf[1] = x-factor pf[2] = x^2-factor pf[3] = x^3-factor | |
| xz | [in] zero condition(s) for the polynom |
| double doubleLogDouble | ( | const double | base, | |
| const double | value, | |||
| BM_STATUS * | bms | |||
| ) |
returns the base-logarithm of value
the log-function solves the equation
base pow result = value
and returns result in double format
| base | the base of the logarithm (useful >= 2) | |
| value | the logarithm's result | |
| bms | [out,opt] A pointer to receive basic math status informations (can be null). bms remains unchanged if there is no error in this operation. bms acts accumulative. |
| double doubleModDouble | ( | const double | numerator, | |
| const double | denominator, | |||
| BM_STATUS * | bms | |||
| ) |
safe modulo
divides numerator with denominator and returns the remainder as result of this operation
| numerator | [in] the first value for this operation | |
| denominator | [in] the second value for this operation | |
| bms | [out,opt] A pointer to receive basic math status informations (can be null). bms remains unchanged if there is no error in this operation. bms acts accumulative. |
| double doubleMulDouble | ( | const double | multiplier, | |
| const double | multiplicand, | |||
| BM_STATUS * | bms | |||
| ) |
safe multiplication
multiplies multiplier with multiplicand and returns the result of this operation
| multiplier | [in] the first value for this operation | |
| multiplicand | [in] the second value for this operation | |
| bms | [out,opt] A pointer to receive basic math status informations (can be null). bms remains unchanged if there is no error in this operation. bms acts accumulative. |
| double doublePow_2 | ( | const double | base, | |
| BM_STATUS * | bms | |||
| ) |
safe square (power 2)
calculates base raised to the power of 2 and returns the result of this operation
| base | [in] the base value for this operation | |
| bms | [out,opt] A pointer to receive basic math status informations (can be null). bms remains unchanged if there is no error in this operation. bms acts accumulative. |
| double doublePow_3 | ( | const double | base, | |
| BM_STATUS * | bms | |||
| ) |
safe cube (power 3)
calculates base raised to the power of 3 and returns the result of this operation
| base | [in] the base value for this operation | |
| bms | [out,opt] A pointer to receive basic math status informations (can be null). bms remains unchanged if there is no error in this operation. bms acts accumulative. |
| double doublePow_4 | ( | const double | base, | |
| BM_STATUS * | bms | |||
| ) |
safe power 4
calculates base raised to the power of 4 and returns the result of this operation
| base | [in] the base value for this operation | |
| bms | [out,opt] A pointer to receive basic math status informations (can be null). bms remains unchanged if there is no error in this operation. bms acts accumulative. |
| double doublePowDouble | ( | const double | base, | |
| const double | exponent, | |||
| BM_STATUS * | bms | |||
| ) |
safe power, calculates base pow exponent
calculates base raised to the power of exponent and returns the result of this operation
| base | [in] the base value for this operation | |
| exponent | [in] the exponent value for this operation | |
| bms | [out,opt] A pointer to receive basic math status informations (can be null). bms remains unchanged if there is no error in this operation. bms acts accumulative. |
| double doubleRoot_2 | ( | const double | radicand, | |
| BM_STATUS * | bms | |||
| ) |
safe square root
calculates the square root of radicand and returns the result of this operation
| radicand | [in] the value for this operation | |
| bms | [out,opt] A pointer to receive basic math status informations (can be null). bms remains unchanged if there is no error in this operation. bms acts accumulative. |
| double doubleRoot_3 | ( | const double | radicant, | |
| BM_STATUS * | bms | |||
| ) |
safe cube root
calculates the cube root of radicant and returns the result of this operation
| radicant | [in] the value for this operation | |
| bms | [out,opt] A pointer to receive basic math status informations (can be null). bms remains unchanged if there is no error in this operation. bms acts accumulative. |
| double doubleRoot_4 | ( | const double | radicant, | |
| BM_STATUS * | bms | |||
| ) |
safe 4th root
calculates the 4th root of radicant and returns the result of this operation
| radicant | [in] the value for this operation | |
| bms | [out,opt] A pointer to receive basic math status informations (can be null). bms remains unchanged if there is no error in this operation. bms acts accumulative. |
| double doubleRootDouble | ( | const double | radicant, | |
| const double | rootExponent, | |||
| BM_STATUS * | bms | |||
| ) |
safe exp-th root
calculates the exp-th root of radicant and returns the result of this operation
| radicant | [in] the value for this operation | |
| rootExponent | [in] the exponent of the root | |
| bms | [out,opt] A pointer to receive basic math status informations (can be null). bms remains unchanged if there is no error in this operation. bms acts accumulative. |
| BM_STATUS doubleSolveL1 | ( | double * | xr, | |
| const double * | lf | |||
| ) |
solves the linear equation with 1 unknown value
equation lf[1] * xr[0] - lf[0] = 0 will be solved for xr[0] = lf[0] / lf[1]
| xr | [out] the result(s) of the linear equation(s) | |
| lf | [in] the linear factors of the equation |
| BM_STATUS doubleSolveL2 | ( | double * | xr, | |
| double * | lf[2] | |||
| ) |
solves the linear equations with 2 unknown values
equation 1: lf[0][2] * b + lf[0][1] * a = lf[0][0]
equation 1: lf[1][2] * b + lf[1][1] * a = lf[1][0]
-->> xr[0] = result for a
-->> xr[1] = result for b
| xr | [out] the result(s) of the linear equation(s) | |
| lf | [in] the linear factors of the equation |
| long doubleSolveP1 | ( | double * | xr, | |
| const double * | pf | |||
| ) |
solves the polynom function of first degree
solves pf[1]*x + pf[0] = 0 -->> xr[0] = -pf[0] / pf[1]
| xr | [out] pointer to store the solution(s) | |
| pf | [in] polynom factor(s) |
| long doubleSolveP1norm | ( | double * | xr, | |
| const double * | pf | |||
| ) |
solves the normalized polynom function of first degree
solves x + pf[0] = 0 -->> xr[0] = -pf[0]
| xr | [out] pointer to store the solution(s) | |
| pf | [in] polynom factor(s) |
| long doubleSolveP2 | ( | double * | xr, | |
| const double * | pf | |||
| ) |
solves the polynom function of second degree
solves pf[2]*x^2 + pf[1]*x + pf[0] = 0 -->> xr[0,1]
| xr | [out] pointer to store the solution(s) the solution values are stored in ascendant order | |
| pf | [in] polynom factor(s) |
| long doubleSolveP2norm | ( | double * | xr, | |
| const double * | pf | |||
| ) |
solves the normalized polynom function of second degree
solves x^2 + pf[1]*x + pf[0] = 0 -->> xr[0,1]
| xr | [out] pointer to store the solution(s) the solution values are stored in ascendant order | |
| pf | [in] polynom factor(s) |
| long doubleSolveP3 | ( | double * | xr, | |
| const double * | pf | |||
| ) |
solves the polynom function of third degree
solves pf[3]*x^3 + pf[2]*x^2 + pf[1]*x + pf[0] = 0 -->> xr[0,1,2]
| xr | [out] pointer to store the solution(s) the solution values are stored in ascendant order | |
| pf | [in] polynom factor(s) |
| long doubleSolveP3norm | ( | double * | xr, | |
| const double * | pf | |||
| ) |
solves the normalized polynom function of third degree
solves x^3 + pf[2]*x^2 + pf[1]*x + pf[0] = 0 -->> xr[0,1,2]
| xr | [out] pointer to store the solution(s) the solution values are stored in ascendant order | |
| pf | [in] polynom factor(s) |
| long doubleSolveP4 | ( | double * | xr, | |
| const double * | pf | |||
| ) |
solves the polynom function of fourth degree
solves pf[4]*x^4 + pf[3]*x^3 + pf[2]*x^2 + pf[1]*x + pf[0] = 0 -->> xr[0,1,2,3]
| xr | [out] pointer to store the solution(s) the solution values are stored in ascendant order | |
| pf | [in] polynom factor(s) |
| long doubleSolveP4norm | ( | double * | xr, | |
| const double * | pf | |||
| ) |
solves the normalized polynom function of fourth degree
solves x^4 + pf[3]*x^3 + pf[2]*x^2 + pf[1]*x + pf[0] = 0 -->> xr[0,1,2,3]
| xr | [out] pointer to store the solution(s) the solution values are stored in ascendant order | |
| pf | [in] polynom factor(s) |
| double doubleSubDouble | ( | const double | minuend, | |
| const double | subtrahend, | |||
| BM_STATUS * | bms | |||
| ) |
safe subtraction
subtracts subtrahend from minuend and returns the result of this operation
| minuend | [in] the first value for this operation | |
| subtrahend | [in] the second value for this operation | |
| bms | [out,opt] A pointer to receive basic math status informations (can be null). bms remains unchanged if there is no error in this operation. bms acts accumulative. |
strips the decimal places from value and returns the integer (int64)
Extracts the integer part from value
| value | [in] the value which will be converted from double to int64 | |
| intDbl | [out,opt] (can be null) A pointer to a double to receive the integer in double format. | |
| bms | [out,opt] A pointer to receive basic math status informations (can be null). bms remains unchanged if there is no error in this operation. bms acts accumulative. |
| int findDouble | ( | const double * | element1, | |
| const unsigned int | count, | |||
| const double | elem | |||
| ) |
looks for a same element in the array
and returns the zero based index into the array if an equal element is found
| element1 | pointer to the element in the array where to start | |
| count | number of relevant elements in the array beginning at element1 | |
| elem | the element to be searched for |
| int findI64 | ( | const __int64 * | element1, | |
| const unsigned int | count, | |||
| const __int64 | elem | |||
| ) |
looks for a same element in the array
and returns the zero based index into the array if an equal element is found
| element1 | pointer to the element in the array where to start | |
| count | number of relevant elements in the array beginning at element1 | |
| elem | the element to be searched for |
| double floorDouble | ( | const double | value, | |
| BM_STATUS * | bms | |||
| ) |
Calculates the floor of value.
Calculates the largest integer that is less than or equal to value
| value | the value for this operation | |
| bms | [out,opt] A pointer to receive basic math status informations (can be null). bms remains unchanged if there is no error in this operation. bms acts accumulative. |
safe addition
adds addend to augend and returns the result of this operation
| augend | [in] the first value for this operation | |
| addend | [in] the second value for this operation | |
| bms | [out,opt] A pointer to receive basic math status informations (can be null). bms remains unchanged if there is no error in this operation. bms acts accumulative. |
compares value1 with value2
| value1 | the first value to be compared with value2 | |
| value2 | the second value to be compared with value1 | |
| diff | difference to detect value1 != value2 |
safe division
divides numerator with denominator and returns the result of this operation
| numerator | [in] the first value for this operation | |
| denominator | [in] the second value for this operation | |
| bms | [out,opt] A pointer to receive basic math status informations (can be null). bms remains unchanged if there is no error in this operation. bms acts accumulative. |
returns the base-logarithm of value
the log-function solves the equation
base pow result = value
and returns result in double format
| base | the base of the logarithm (useful >= 2) | |
| value | the logarithm's result | |
| bms | [out,opt] A pointer to receive basic math status informations (can be null). bms remains unchanged if there is no error in this operation. bms acts accumulative. |
safe modulo
divides numerator with denominator and returns the remainder as result of this operation
| numerator | [in] the first value for this operation | |
| denominator | [in] the second value for this operation | |
| bms | [out,opt] A pointer to receive basic math status informations (can be null). bms remains unchanged if there is no error in this operation. bms acts accumulative. |
safe multiplication
multiplies multiplier with multiplicand and returns the result of this operation
| multiplier | [in] the first value for this operation | |
| multiplicand | [in] the second value for this operation | |
| bms | [out,opt] A pointer to receive basic math status informations (can be null). bms remains unchanged if there is no error in this operation. bms acts accumulative. |
safe square (power 2)
calculates base raised to the power of 2 and returns the result of this operation
| base | [in] the base value for this operation | |
| bms | [out,opt] A pointer to receive basic math status informations (can be null). bms remains unchanged if there is no error in this operation. bms acts accumulative. |
safe cube (power 3)
calculates base raised to the power of 3 and returns the result of this operation
| base | [in] the base value for this operation | |
| bms | [out,opt] A pointer to receive basic math status informations (can be null). bms remains unchanged if there is no error in this operation. bms acts accumulative. |
safe power 4
calculates base raised to the power of 4 and returns the result of this operation
| base | [in] the base value for this operation | |
| bms | [out,opt] A pointer to receive basic math status informations (can be null). bms remains unchanged if there is no error in this operation. bms acts accumulative. |
safe power, calculates base pow exponent
calculates base raised to the power of exponent and returns the result of this operation
| base | [in] the base value for this operation | |
| exponent | [in] the exponent value for this operation | |
| bms | [out,opt] A pointer to receive basic math status informations (can be null). bms remains unchanged if there is no error in this operation. bms acts accumulative. |
safe square root
calculates the square root of radicand and returns the result of this operation
| radicand | [in] the value for this operation | |
| bms | [out,opt] A pointer to receive basic math status informations (can be null). bms remains unchanged if there is no error in this operation. bms acts accumulative. |
safe exp-th root
calculates the exp-th root of radicant and returns the result of this operation
| radicant | [in] the value for this operation | |
| rootExponent | [in] the exponent of the root | |
| bms | [out,opt] A pointer to receive basic math status informations (can be null). bms remains unchanged if there is no error in this operation. bms acts accumulative. |
safe subtraction
subtracts subtrahend from minuend and returns the result of this operation
| minuend | [in] the first value for this operation | |
| subtrahend | [in] the second value for this operation | |
| bms | [out,opt] A pointer to receive basic math status informations (can be null). bms remains unchanged if there is no error in this operation. bms acts accumulative. |
| double i64ToDouble | ( | const int64 | value | ) |
converts from int64 to a value in double format
| value | [in] the value which will be converted from int64 to double |
| double invertSignDouble | ( | const double | value, | |
| BM_STATUS * | bms | |||
| ) |
inverts the sign of value
result = -value
| value | [in] the value for this operation | |
| bms | [out,opt] A pointer to receive basic math status informations (can be null). bms remains unchanged if there is no error in this operation. bms acts accumulative. |
inverts the sign of value
result = -value
| value | [in] the value for this operation | |
| bms | [out,opt] A pointer to receive basic math status informations (can be null). bms remains unchanged if there is no error in this operation. bms acts accumulative. |
| int isDouble | ( | const double * | value, | |
| BM_STATUS * | bms | |||
| ) |
tests for a valid 64 bit floating point value (double)
| value | a pointer to the double value to be tested | |
| bms | [out,opt] A pointer to receive basic math status informations (can be null). bms remains unchanged if there is no error in this operation. bms acts accumulative. |
| int isEvenI64 | ( | const int64 | value | ) |
returns 1 if value is even (.. -4, -2, 0, +2, +4, ..)
| value | [in] the value to be checked |
tests for a valid 64 bit integer value (int64)
| value | a pointer to the value to be tested | |
| bms | [out,opt] A pointer to receive basic math status informations (can be null). bms remains unchanged if there is no error in this operation. bms acts accumulative. |
| double negativeDouble | ( | const double | value, | |
| BM_STATUS * | bms | |||
| ) |
calculates the negative absolute value of value
result = -fabs( value )
| value | [in] the value for this operation | |
| bms | [out,opt] A pointer to receive basic math status informations (can be null). bms remains unchanged if there is no error in this operation. bms acts accumulative. |
calculates the negative absolute value of value
result = -abs( value )
| value | [in] the value for this operation |
| double positiveDouble | ( | const double | value, | |
| BM_STATUS * | bms | |||
| ) |
calculates the absolute value of value
result = fabs( value )
| value | [in] the value for this operation | |
| bms | [out,opt] A pointer to receive basic math status informations (can be null). bms remains unchanged if there is no error in this operation. bms acts accumulative. |
calculates the absolute value of value
result = abs( value )
| value | [in] the value for this operation | |
| bms | [out,opt] A pointer to receive basic math status informations (can be null). bms remains unchanged if there is no error in this operation. bms acts accumulative. |
| void printBM_STATUS | ( | const BM_STATUS | bms, | |
| FILE * | file | |||
| ) |
prints a basic math status (BM_STATUS) to file
| bms | basic math status to be printed | |
| file | pointer to a open FILE with write access. If file=0 (default) this function prints to stdout. If file is a valid pointer this function prints to file. |
| void printDoubleBitpattern | ( | double | value, | |
| FILE * | file | |||
| ) |
prints the bitpattern of a double value in hex format
| value | the value to be printed | |
| file | pointer to a open FILE with write access. If file=0 (default) this function prints to stdout. If file is a valid pointer this function prints to file. |
| void printDoubleBitpatternFormatted | ( | double | value, | |
| FILE * | file | |||
| ) |
prints the formatted bitpattern of a double value (sign mantisse exponent)
| value | the value to be printed | |
| file | pointer to a open FILE with write access. If file=0 (default) this function prints to stdout. If file is a valid pointer this function prints to file. |
| double rad2DegDouble | ( | const double | radian, | |
| BM_STATUS * | bms | |||
| ) |
converts radian into degree
degree = (rad / pi) * 180
| radian | [in] the radian value | |
| bms | [out,opt] A pointer to receive basic math status informations (can be null). bms remains unchanged if there is no error in this operation. bms acts accumulative. |
| double reciprocDouble | ( | const double | value, | |
| BM_STATUS * | bms | |||
| ) |
safe reciproc (1/x)
returns the result of 1 / x
| value | [in] the value for this operation | |
| bms | [out,opt] A pointer to receive basic math status informations (can be null). bms remains unchanged if there is no error in this operation. bms acts accumulative. |
| double roundDouble | ( | const double | value, | |
| const int | decPlaces, | |||
| BM_STATUS * | bms | |||
| ) |
rounds value to a specified number of decimal places
decPlaces can be negative
| value | [in] the value to be rounded | |
| decPlaces | [in] Positive number indicates how many places to the right of the decimal are included in the rounding. If omitted (decPlaces=0), assignRound() rounds to integer. Negative number indicates how many places to the left of the decimal are included in the rounding. | |
| bms | [out,opt] A pointer to receive basic math status informations (can be null). bms remains unchanged if there is no error in this operation. bms acts accumulative. |
| double sinDouble | ( | const double | rad, | |
| BM_STATUS * | bms | |||
| ) |
calculates the sinus of rad
result = sin( rad )
| rad | the angle [-DBL_MAX .. +DBL_MAX] | |
| bms | [out,opt] A pointer to receive basic math status informations (can be null). bms remains unchanged if there is no error in this operation. bms acts accumulative. |
| void sortAscendantDouble | ( | double * | values, | |
| const unsigned long | count, | |||
| BM_STATUS * | bms | |||
| ) |
sorts an array of values in ascendant order
| values | [in,out] the values to be sorted returns the sorted values in the same array | |
| count | [in] number of values in values | |
| bms | [out,opt] A pointer to receive basic math status informations (can be null). bms remains unchanged if there is no error in this operation. bms acts accumulative. |
| void sortAscendantI64 | ( | int64 * | values, | |
| const unsigned long | count | |||
| ) |
sorts an array of values in ascendant order
| values | [in,out] the values to be sorted returns the sorted values in the same array | |
| count | [in] number of values in values |
| double stringToDouble | ( | const char * | stringValue, | |
| BM_STATUS * | bms | |||
| ) |
converts stringValue into double
| stringValue | pointer to the first character in the string where the value begins | |
| bms | [out,opt] A pointer to receive basic math status informations (can be null). bms remains unchanged if there is no error in this operation. bms acts accumulative. |
converts stringValue into int64
| stringValue | pointer to the first character in the string where the value begins | |
| stopChar | [out,opt] (can be null) pointer into stringValue where the scanner stopped | |
| bms | [out,opt] A pointer to receive basic math status informations (can be null). bms remains unchanged if there is no error in this operation. bms acts accumulative. |
| double strToDouble | ( | const char * | str, | |
| BM_STATUS * | bms | |||
| ) |
converts a null terminated string into a 80 bit floating point value (double)
returns the value represented by the string
| str | [in] the zero terminated string fpvalue ::= {whitespace}[sign]value[echar[sign]integer] whitespace ::= ' ' | '\t' | '\n' | '\r' //blank or tabulator or linefeed or carriage return sign ::= '+' | '-' //plus or minus seperator ::= ',' | '_' //comma or underline digit ::= '0' ... '9' //a value in the range 0..9 integer ::= digit {digit} //integer has at least one digit int_sep ::= digit {[seperator]digit} //integer begins and ends always //with a digit, not with a seperator value ::= (integer) | (integer'.') | (integer'.'integer) | ('.'integer) echar ::= 'd' | 'D' | 'e' | 'E' //one of these characters indicates the //power to base 10 | |
| bms | [out,opt] A pointer to receive basic math status informations (can be null). bms remains unchanged if there is no error in this operation. bms acts accumulative. |
| double tanDouble | ( | const double | rad, | |
| BM_STATUS * | bms | |||
| ) |
calculates the tangent of rad
result = tan( rad )
| rad | the angle [-DBL_MAX .. +DBL_MAX] | |
| bms | [out,opt] A pointer to receive basic math status informations (can be null). bms remains unchanged if there is no error in this operation. bms acts accumulative. |
1.6.3