Skip to main content

Function: signedSquare()

signedSquare(x): number

Defined in: math/signed-square.ts:17

Computes the signed square of a number.

The result is the input number multiplied by its absolute value, preserving the sign of the original number.

Parameters

x

number

The input number to be squared with sign preserved.

Returns

number

The signed square of the input number.

Example

signedSquare(3);   // 9
signedSquare(-3); // -9
signedSquare(0); // 0