Basic math functions, macros and constants used in the Speect Engine.
S_ABS | Get the absolute value of the given number. |
S_MIN | Get the minimum of two given values. |
S_MAX | Get the maximum of two given values. |
S_NUM_LE | Test if number is larger or equal to another number, A >= X. |
S_NUM_SE | Test if number is smaller or equal to another number, A <= X. |
S_NUM_IN_RANGE | Test if a number is in a range, X <= A <= Y. |
s_rel_diff | Get the relative difference between two floating point values. |
s_float_equal | Test if two floating point numbers are equal within a certain tolerance. |
s_log2 | Return the logarithm (base 2) of the given number. |
Definition of floating point difference tollerance.
Definition of Pi to 20 decimal places.
Get the absolute value of the given number.
Parameters: |
|
---|---|
Return: | Absolute value of X. |
Note: | Macro is type independent. |
Get the minimum of two given values.
Parameters: |
|
---|---|
Return: | The minimum of X and Y. |
Note: | Macro is type independent. |
Get the maximum of two given values.
Parameters: |
|
---|---|
Return: | The maximum of X and Y. |
Note: | Macro is type independent. |
Test if number is larger or equal to another number, A >= X.
Parameters: |
|
---|---|
Return: | 1 if A is larger or equal to X, else 0. |
Note: | Macro is type independent. |
Test if number is smaller or equal to another number, A <= X.
Parameters: |
|
---|---|
Return: | 1 if A is smaller or equal to X, else 0. |
Note: | Macro is type independent. |
Test if a number is in a range, X <= A <= Y.
Tests whether the given number lies in the given range (inclusive).
Parameters: |
|
---|---|
Return: | 0 if not in range, else 1. |
Note: | Macro is type independent. |
Get the relative difference between two floating point values.
Relative distance is defined as the ratio of the difference to the larger of the two values.
Parameters: |
|
---|---|
Return: | Relative difference between a and b. |
Test if two floating point numbers are equal within a certain tolerance.
If the relative difference (s_rel_diff) between the two values are less or equal to S_FLOAT_TOLERANCE then they are equal.
Parameters: |
|
---|---|
Return: |
Return the logarithm (base 2) of the given number.
Parameters: |
|
---|---|
Return: | logarithm (base 2) or -HUGE_VAL if a is s_float_equal to 0. |