Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions garrysmod/lua/includes/extensions/math.lua
Original file line number Diff line number Diff line change
Expand Up @@ -267,3 +267,13 @@ function math.IsNearlyEqual( a, b, tolerance )

return math.abs( a - b ) <= tolerance
end

-- Returns x with the same sign as y
function math.copysign( x, y )
if ( y >= 0 ) then
return math.abs( x )
else
return -math.abs( x )
end
end