Please enable JavaScript to view this site.

Knowledge Base

Navigation: Scripting Language > Functions

sign

We've made some changes. Use 'Ctrl-F5' to clear your browser cache.
Scroll Prev Top Next More

Returns the sign of a number.

 

Supported Product: FDTD, MODE, DEVICE, INTERCONNECT

 

Syntax

Description

out = sign(data);

If data is real:

sign = 0 for data=0

sign = 1 for data>0

sign =-1 for data<0

 

If data is complex:

sign = 0 for data=0+0i

sign = data/abs(data) for data different from zero

 

Example

Example output from sign function.

# real numbers

data = [2; 0; -2];

?sign(data);

 

# complex numbers

data = [2+2i; 0+0i; -2+0i];

?sign(data);

?abs( sign(data) ); 

 

result: 

1  

0  

-1  

result: 

0.707107+0.707107i  

0+0i  

-1+0i  

result: 

1  

0  

1   

 

See Also

Functions, floor, ceil

Copyright Lumerical Inc. | Privacy | Site Map