copysign (Function)

Signature: copysign(x: float, y: float) -> float

Description: x's magnitude with y's sign. Total; a NaN keeps its payload and takes y's sign bit.

Parameters

  • x (float): The magnitude
  • y (float): The sign donor

Returns: float

Example

print(copysign(3.0, -1.0))  // -3.0
print (copysign (3.0, -1.0))  // -3.0