Speeduino
|
Macros | |
#define | DIV_ROUND_DOWN -1 |
Rounding behavior: always round down. | |
#define | DIV_ROUND_UP 1 |
Rounding behavior: always round up. | |
#define | DIV_ROUND_NEAREST 0 |
Rounding behavior: round to nearest. | |
#define | DIV_ROUND_BEHAVIOR DIV_ROUND_NEAREST |
Integer division rounding behavior. | |
#define | DIV_ROUND_CORRECT(d, t) ((t)(((d)>>1U)+(t)DIV_ROUND_BEHAVIOR)) |
Computes the denominator correction for rounding division based on our rounding behavior. | |
#define DIV_ROUND_BEHAVIOR DIV_ROUND_NEAREST |
Integer division rounding behavior.
Computes the denominator correction for rounding division based on our rounding behavior.
d | The divisor (an integer) |
t | The type of the result. E.g. uint16_t |
#define DIV_ROUND_DOWN -1 |
Rounding behavior: always round down.
#define DIV_ROUND_NEAREST 0 |
Rounding behavior: round to nearest.
This rounds 0.5 away from zero. This is the same behavior as the standard library round() function.
#define DIV_ROUND_UP 1 |
Rounding behavior: always round up.