# Reference: sgn

sgn(x) returns the sign of the real number x, i.e. sgn(x) = 1 if x > 0 and sgn(x) = -1 if x < 0. In AlgoSim, sgn(0) = 0, so that it is not entirely true that sgn(x) is the derivative of abs(x).

Homepage |
Screenshots |
Gallery of Visualisation |
User's Guide |
Function Reference |
Download |
FAQ |
Support |
Bugs and Solutions |
Donate

sgn(x) returns the sign of the real number x, i.e. sgn(x) = 1 if x > 0 and sgn(x) = -1 if x < 0. In AlgoSim, sgn(0) = 0, so that it is not entirely true that sgn(x) is the derivative of abs(x).