Lua MathExtra

From Spring
Revision as of 14:25, 9 October 2013 by Deadnight warrior (talk | contribs) (Created page with "== Additional math functions == '''math.hypot''' ( number x, number y ) -> number <span class="note">Returns the length of hypotenuse of right angle triangle with sides x ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Additional math functions

math.hypot

 ( number x, number y ) -> number
 Returns the length of hypotenuse of right angle triangle with sides x and y, equivalent
 to sqrt(x*x + y*y), but has better numerical stability and internaly handles intermediate
 overflows/underflows, but is also slower.

math.diag

 ( number x1 [, ... ] ] ) -> number
 Returns the length of diagonal of an n-dimensional box. Rather quick method that does not
 handle intermediate overflows/underflows nor is made for numerical stability.

math.clamp

 ( number x, number min, number max ) -> number
 Returns x clamped to min and max boundaries.