math.copysign() function

The math.copysign() function returns a value with the magnitude of x and the sign of y.

*Output data type: Float*

  1. import "math"
  2. math.copysign(x: 1.0, y: 2.0)
  3. // Returns 1.0

Parameters

x

The magnitude used in the operation.

*Data type: Float*

y

The sign used in the operation.

*Data type: Float*