The **unaryMinus ( -)** operator negates a number.

`-number unaryMinus(number)`

Unary negation *negates* a number; it does not simply make it negative. This means you can use it to make a negative number positive.

This is useful to keep in mind since unaryPlus does not make a number positive; it converts non-numeric data to a number.

You can also use the function version, `unaryMinus()`

.

**Good to know: **A *unary *operator only has a single operand, while a *binary *operator has two. unaryMinus and unaryPlus are, as their names imply, unary operators. Examples of binary operators include add, divide, pow, etc.

## Example Formulas

```
-42 // Output: -42
-(-42) // Output: 42
unaryMinus(42) // Output: -42
```

### Expressing Negative Values

It’s important to know that Notion’s formula editor will sometimes interpret the `-`

symbol as a unaryMinus in situations where you’re trying to express a truly negative value.

This can happen with the mod (`%`

) operator when the divisor is a hard-coded negative number.

```
19 % -12 // Outputs incorrect value of -11.81
19 % (-12) // Correctly outputs 7
// Negative value passed via a property does not need to
// be wrapped in () symbols
prop("negative num") == -12
19 % prop("negative num") // Output: 7
```

As shown in the code block above, this does not apply to negative values passed via a property. Those values will be truly negative since a property can’t add a unaryMinus operator (or any operator) to your formula.

You can read more about this distinction in the Negative Divisors section of the mod article.

Good to know: Parentheses `()`

have the highest operator precedence in Notion formulas, so you can avoid all sorts of confusion by using them to make the order of your formula’s operation explicitly defined.

### Type Conversion with unaryPlus

Unlike in JavaScript, unaryMinus does not convert other data types (such as strings or Booleans) to numbers in Notion.

However, you can combine it with unaryPlus to quickly convert a numeric string or boolean to a number. You can also combine it with toNumber, which can convert dates to numbers (unaryPlus cannot do this).

```
-+"42" // Output: -42
-+"-42" // Output: 42
-+true // Output: -1
-toNumber(now()) // Output: -165479808000 (will change with now()'s timestamp)
```

## Example Database

The table below uses unaryMinus with an if statement to create a manual absolute value function. Notion comes with abs, so building this is just useful as a proof-of-concept.

### View and Duplicate Database

### “Abs” Property Formula

```
// Compressed
if(prop("Num 1") - prop("Num 2") < 0, -(prop("Num 1") - prop("Num 2")), prop("Num 1") - prop("Num 2"))
// Expanded
if(
prop("Num 1") - prop("Num 2") < 0,
-(
prop("Num 1") - prop("Num 2")
),
prop("Num 1") - prop("Num 2")
)
```

This formula checks whether the difference between Num 1 and Num 2 is less than zero. If it is, it applies the `-`

operator to the entire equation in order to get the absolute value.

**Other formula components used in this example**