Capy-Bearer Documentation

copysign

lib call

Capy

function copysign(magnitude : f32, sign : f32) f32
function copysign(magnitude : f64, sign : f64) f64

Description

copysign() copies the sign bit, so a negative zero and a negative NaN count as negative.

Parameters

magnitude : the number whose absolute value is kept

sign : the number whose sign is copied

Return Values

A number with the magnitude of magnitude and the sign of sign, in their type.

Example

Capy

print(copysign(2.5, -1.0), " ", copysign(-2.5, 1.0), "\n")

Output

-2.5 2.5