You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-06 12:20:30 +00:00
math: Fix rounding error for 0 in Math::round (#4495)
Thus revert the previous workaround in commitb123bc4a2a. Fixes #3221. (cherry picked from commit6883325f92)
This commit is contained in:
committed by
Rémi Verschelde
parent
0b49d78a3f
commit
26c2e0d09d
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user