"Sputnik" help  
Sputnik Help
CopySign(<value1>, <value2>)

Description

Performs the operation of copying the sign from one value to another.

Parameters

<value1> The value from which the sign will be copied.
<value2> The value whose sign will be applied to value1.

Return Value

Success: Returns result of copying the sign from value2 to value1.
Failure: Returns null.

Remarks

The CopySign function supports different data types, including floating-point numbers, integers, and unsigned integers. It handles the sign manipulation based on the types of the input values. If the input values are floating-point numbers, the function internally converts them to their bit representations and performs the sign manipulation using bitwise operations. For integers and unsigned integers, the sign manipulation is applied directly to the input values. The function then returns the modified value with the sign copied from value2.

Related

Example

Example of usage:

my $a = 3;
my $b = -7;
my $result = CopySign($a, $b);
println($result);

my $x = 3.14;
my $y = -7.2;
my $result2 = CopySign($x, $y);
println($result2);

// PRINTS
// -3
// -3.14

 


Contact
Cheryl (uberfox@hotmail.com)
Homepage
http://ubersoft.org