I'm curious whether there's an accepted notation for a function that takes in a number and returns only $\pm 1$ where the sign is the same as the sign of the input. What I'm trying to achieve feels similar to normalizing a vector where the "direction" is only either positive or negative.

$$ \text{sign}(n) = \frac{n}{\left|n\right|} $$

Examples being that $\text{sign}(-4) = -1$ and $\text{sign}(\pi^e) = 1$ .

I ask the question because of a problem where I'm taking a square root of number that has been squared ($\sqrt{a^2}$ where $a$ is not directly known) with the sign of $a$ being indicated by a different but related number $b$. I'm wanting, if one exists, a recognizable way of concisely writing what I've defined as $\sqrt{a^2}=\text{sign}(b) \times a$ without having to define my own notation where some may already exist.

  • $\begingroup$ What would be the sign of $i$ with $i^2=-1$? $\endgroup$ Aug 11, 2020 at 20:36
  • $\begingroup$ It hardly seems worth posting this as an answer: Sign function - Wikipedia. $\endgroup$ Aug 11, 2020 at 20:37
  • 1
    $\begingroup$ I have seen $\operatorname{sign}$ used as you describe. I have also seen $\operatorname{sgn}$ and $\operatorname{signum}$ used in this way. $\endgroup$
    – Xander Henderson
    Aug 11, 2020 at 20:37
  • $\begingroup$ @DietrichBurde OP seems to be defining sign as the function $re^{i\theta}\mapsto e^{i\theta}$. Under that assumption, the sign of $i$ is $i$. OP, I've also seen sign used this way, but I've seen \sgn more often. $\endgroup$ Aug 11, 2020 at 20:37
  • 1
    $\begingroup$ @DietrichBurde: why this discussion about complex numbers ? The OP stays in the reals, doesn't he ? $\endgroup$
    – user65203
    Aug 11, 2020 at 20:40

1 Answer 1


The sign function is commonly written $\text{sgn}$.


What you discuss in your post seems to be related to the "sign transfer" operation,

$$\text{sgn(b)}|a|,$$ for which I don't think there is a usage (it is defined along with some programming languages).

A typical use of the sign function is in the expression of the numerically stable solution of the quadratic equation,



You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .