math: Fix rounding error for 0 in Math::round (#4495)

Thus revert the previous workaround in commit b123bc4a2a.
Fixes #3221.
This commit is contained in:
Rémi Verschelde 2016-05-01 11:37:46 +02:00
parent 78adbf4790
commit 6883325f92
2 changed files with 3 additions and 5 deletions

View File

@ -135,18 +135,20 @@ double Math::rad2deg(double p_y) {
double Math::round(double p_val) {
if (p_val>0) {
if (p_val>=0) {
return ::floor(p_val+0.5);
} else {
p_val=-p_val;
return -::floor(p_val+0.5);
}
}
double Math::asin(double p_x) {
return ::asin(p_x);
}
double Math::acos(double p_x) {
return ::acos(p_x);

View File

@ -78,10 +78,6 @@ void Range::set_val(double p_val) {
if (p_val<shared->min)
p_val=shared->min;
//avoid to set -0
if (p_val == 0)
p_val = 0;
if (shared->val==p_val)
return;