better efiRound implementation
This commit is contained in:
parent
373da8607f
commit
148fea5574
|
@ -21,10 +21,17 @@ int minI(int i1, int i2) {
|
||||||
return i1 < i2 ? i1 : i2;
|
return i1 < i2 ? i1 : i2;
|
||||||
}
|
}
|
||||||
|
|
||||||
float efiRound(float value, float precision) {
|
/*
|
||||||
|
float efiFloat(float value, float precision) {
|
||||||
int a = (int) (value / precision);
|
int a = (int) (value / precision);
|
||||||
return a * precision;
|
return a * precision;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
float efiRound(float value, float precision) {
|
||||||
|
float a = rintf (value / precision);
|
||||||
|
return a * precision;
|
||||||
|
}
|
||||||
|
|
||||||
float absF(float value) {
|
float absF(float value) {
|
||||||
return value > 0 ? value : -value;
|
return value > 0 ? value : -value;
|
||||||
|
|
|
@ -51,6 +51,10 @@ int atoi(const char *string);
|
||||||
|
|
||||||
int absI(int32_t value);
|
int absI(int32_t value);
|
||||||
float absF(float value);
|
float absF(float value);
|
||||||
|
/**
|
||||||
|
* Rounds value to specified precision.
|
||||||
|
* @param precision some pow of 10 value - for example, 100 for two digit precision
|
||||||
|
*/
|
||||||
float efiRound(float value, float precision);
|
float efiRound(float value, float precision);
|
||||||
int maxI(int i1, int i2);
|
int maxI(int i1, int i2);
|
||||||
int minI(int i1, int i2);
|
int minI(int i1, int i2);
|
||||||
|
|
Loading…
Reference in New Issue