diff options
| author | Rémi Verschelde | 2016-05-01 11:37:46 +0200 |
|---|---|---|
| committer | Rémi Verschelde | 2016-05-01 12:28:01 +0200 |
| commit | 26c2e0d09dc9c61d6d49b6d43f47a484e7eff49f (patch) | |
| tree | 4ce4b394e839cbc01279102eec619d06a503ff93 | |
| parent | 0b49d78a3f9d175b0a2cc9088bf5c2f748a70cee (diff) | |
| download | godot-26c2e0d09dc9c61d6d49b6d43f47a484e7eff49f.tar.gz godot-26c2e0d09dc9c61d6d49b6d43f47a484e7eff49f.tar.zst godot-26c2e0d09dc9c61d6d49b6d43f47a484e7eff49f.zip | |
math: Fix rounding error for 0 in Math::round (#4495)
Thus revert the previous workaround in commit b123bc4a2a9c07fcfd27a84109960bda158b3b9d.
Fixes #3221.
(cherry picked from commit 6883325f926af425cf1db7606506f5538b7a205a)
| -rw-r--r-- | core/math/math_funcs.cpp | 4 | ||||
| -rw-r--r-- | scene/gui/range.cpp | 4 |
2 files changed, 3 insertions, 5 deletions
diff --git a/core/math/math_funcs.cpp b/core/math/math_funcs.cpp index 07f114725..0fbd03121 100644 --- a/core/math/math_funcs.cpp +++ b/core/math/math_funcs.cpp @@ -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); diff --git a/scene/gui/range.cpp b/scene/gui/range.cpp index b00fcfe42..e056c55f7 100644 --- a/scene/gui/range.cpp +++ b/scene/gui/range.cpp @@ -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; |
