sarmfsw: SMFSW Toolbox (for ARM & compatible with Arduino platform) 3.7
SMFSW collection of miscellaneous functions & macros (for ARM & compatible with Arduino platform)
|
Floating point manipulation inlines. More...
#include <math.h>
Data Structures | |
struct | sIntFrac |
Float representation on integers. More... | |
Macros | |
#define | SPLIT_FLOAT_TO_INTS(val, nb_frac) (SDWORD) (val), get_fp_dec((val), (nb_frac)) |
< | |
Typedefs | |
typedef struct sIntFrac | sIntFrac |
Functions | |
DWORD | get_fp_dec (const double f, const BYTE nb) |
Get floating point number decimal part (as absolute value) | |
void | float2sIntFrac (sIntFrac *const pIntFrac, const double f, const uint8_t nb_frac) |
Convert floating point representation to sIntFrac integers representation. | |
void | sIntFrac2float (double *const pFloat, const sIntFrac *const pIntFrac) |
Convert sIntFrac integers representation to floating point representation. | |
Floating point manipulation inlines.
#define SPLIT_FLOAT_TO_INTS | ( | val, | |
nb_frac ) (SDWORD) (val), get_fp_dec((val), (nb_frac)) |
<
val
into 2 integers with nb_frac fractional part digits typedef struct sIntFrac sIntFrac |
|
inline |
Convert floating point representation to sIntFrac integers representation.
[in,out] | pIntFrac | - Pointer to result structure |
[in] | f | - floating point value to convert |
[in] | nb_frac | - Number of decimal to get after floating point (limited to 9 internally for proper result on 32b return type) |
Get floating point number decimal part (as absolute value)
[in] | f | - floating point value |
[in] | nb | - Number of decimal to get after floating point (limited to 9 internally for proper result on 32b return type) |