# Notation for Taking the Sign of a Number

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.

• What would be the sign of $i$ with $i^2=-1$? Aug 11, 2020 at 20:36
• It hardly seems worth posting this as an answer: Sign function - Wikipedia. Aug 11, 2020 at 20:37
• I have seen $\operatorname{sign}$ used as you describe. I have also seen $\operatorname{sgn}$ and $\operatorname{signum}$ used in this way. Aug 11, 2020 at 20:37
• @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. Aug 11, 2020 at 20:37
• @DietrichBurde: why this discussion about complex numbers ? The OP stays in the reals, doesn't he ?
– user65203
Aug 11, 2020 at 20:40

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

https://en.wikipedia.org/wiki/Sign_function

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,

$$x_0=\frac{-b-\text{sgn}(b)\sqrt{b^2-4ac}}{2a},\\x_1=\frac{2c}{{-b-\text{sgn}(b)\sqrt{b^2-4ac}}}.$$