The math.copysign()
function returns a float with the magnitude (absolute value) of the first argument and the sign of the second argument.
math.copysign(x, y)
copy
Where x
is a numeric value (can be a float or an integer) and y
is the sign value, which can be an integer or float, positive or negative.
The function returns the absolute value of x
with the sign of y
.