sign

Navigation:  Language Reference > Functions > Arithmetic >

sign

Previous pageReturn to chapter overviewNext page

Syntax

Y = sign(X);

Description

Returns the sign of X or the elements of X.

 

X = < 0 : Y = -1

X = 0: Y = 0

X > 0: Y = 1

 

Examples

X

sign(X)

1

1

2.1

1

-2.6

-1

0

0

[1,2.1;-2.6,0]

[1,1;-1,0]

Limitations

X and Y must have the same size.