# <calc-constant>

The `<calc-constant>` CSS data type represents well-defined constants such as `e` and `pi`. Rather than require authors to manually type out several digits of these mathematical constants or calculate them, a few of them are provided directly by CSS for convenience.

## Syntax

The `<calc-constant>` type defines numeric constants that can be used in CSS math functions.

### Values

`e`

The base of the natural logarithm, approximately equal to `2.7182818284590452354`.

`pi`

The ratio of a circle's circumference to its diameter, approximately equal to `3.1415926535897932`.

`infinity` & `-infinity`

An infinite value, used to indicate the largest/smallest possible value.

`NaN`

A value representing "Not a Number" canonical casing.

Serializing the arguments inside `calc()` follows the IEEE-754 standard for floating point math which means there's a few cases to be aware of regarding constants like `infinity` and `NaN`:

• Dividing by zero will return positive or negative `infinity` depending on the sign of the numerator.
• Adding, subtracting or multiplying `infinity` to anything will return `infinity` unless it produces `NaN` (see below).
• Any operation with at least one `NaN` argument will return `NaN`. This means `0 / 0`, `infinity / infinity`, `0 * infinity`, `infinity + (-infinity)`, and `infinity - infinity` will all return `NaN`.
• Positive and negative zero are possible values (`0⁺` and `0⁻`). This has the following effects:
• Multiplication or division that produces zero with exactly one negative argument (`-5 * 0` or `1 / (-infinity)`) or negative result from combinations in the other math functions will return `0⁻`.
• `0⁻ + 0⁻` or `0⁻ - 0` will return `0⁻`. All other additions or subtractions that would produce a zero will return `0⁺`.
• Multiplying or dividing `0⁻` with a positive number (including `0⁺`) will return a negative result (either `0⁻` or `-infinity`), while multiplying or dividing `0⁻` with a negative number will return a positive result.

Examples of how these rules apply are shown in the Infinity, NaN, and division by zero section.

Note: It's rare to need to use `infinity` as an argument in `calc()`, but it can be used to avoid hardcoded "magic numbers" or making sure a certain value is always larger than another value. It may be useful if you need to make it obvious that a property has "the largest possible value" for that data type.