Function reference · Complex

csgn

Returns the sign of a complex number: 1 or -1.

It is the sign of the real part, or of the imaginary part when the real part is 0; csgn(0) is 0. If the sign can't be decided, the call is returned unevaluated. In JavaScript it is nerdamer.csgn.

Notation

csgn(x)

Write it in an expression: nerdamer('csgn(3+2*i)'), or in the Playground.

nerdamer.csgn

nerdamer.csgn(x: ExpressionInput): Expression

A method on the default import. Arguments can be strings, as in Notation.

Examples

Positive real part.

csgn(3+2*i)
// → 1
Open in Playground

Negative real part.

csgn(-3+2*i)
// → -1
Open in Playground

Real part 0: the imaginary part decides.

csgn(2*i)
// → 1
Open in Playground

Unknown sign: unevaluated.

csgn(x+2*i)
// → csgn(x+2*i)
Open in Playground

← Back to Function reference