We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9dcd219 commit a75afb8Copy full SHA for a75afb8
builtin/misc.lua
@@ -106,13 +106,3 @@ function minetest.formspec_escape(str)
106
return str
107
end
108
109
-function math.hypot(x, y)
110
- local t
111
- x = math.abs(x)
112
- y = math.abs(y)
113
- t = math.min(x, y)
114
- x = math.max(x, y)
115
- t = t / x
116
- return x * math.sqrt(1 + t * t)
117
-end
118
-
builtin/misc_helpers.lua
@@ -91,4 +91,14 @@ function minetest.pos_to_string(pos)
91
return "(" .. pos.x .. "," .. pos.y .. "," .. pos.z .. ")"
92
93
94
+function math.hypot(x, y)
95
+ local t
96
+ x = math.abs(x)
97
+ y = math.abs(y)
98
+ t = math.min(x, y)
99
+ x = math.max(x, y)
100
+ if x == 0 then return 0 end
101
+ t = t / x
102
+ return x * math.sqrt(1 + t * t)
103
+end
104
0 commit comments