The sass:math module ships seven read-only variables: math.$pi, math.$e, math.$epsilon, math.$max-number, math.$min-number, math.$max-safe-integer, and math.$min-safe-integer. All are unitless numbers.
Load them with @use "sass:math". math.$pi and math.$e arrived in Dart Sass 1.25+, alongside the rest of the math module.
Official values.
math.$pi is 3.1415926536 and math.$e is 2.7182818285. The safe-integer limits are 9007199254740991 and -9007199254740991.
Inside calculations.
Plain CSS calc(pi) and calc(e) also work—see calculations. Use math.$pi when you need the number in ordinary Sass math.
Read-only.
You cannot assign to a built-in constant. math.$pi: 3; is a compile error.
Syntax
Syntax
SCSS
@use "sass:math";
math.$pi; // 3.1415926536
math.$e; // 2.7182818285
math.$epsilon; // tiny; prints as 0
math.$max-number; // largest Sass number (about 1.8e308)
math.$min-number; // smallest positive number; prints as 0
math.$max-safe-integer; // 9007199254740991
math.$min-safe-integer; // -9007199254740991
// Circumference of a circle with radius 45
2 * math.$pi * 45; // 282.7433388231
// Module API — prefer math.$pi after @use "sass:math"
Pattern: @use "sass:math" → read the constant → combine it with math.pow(), math.log(), or trig functions.
Reference
The Seven Constants
What each constant is for:
Constant
Value
Typical use
math.$pi
3.1415926536
Circles, angles, trigonometry
math.$e
2.7182818285
Natural growth, math.log / math.pow
math.$epsilon
About 0.00000000001; prints 0
The gap below which Sass treats numbers as equal
math.$max-number
About 1.8 × 10³⁰⁸
Sentinel for finding a minimum
math.$min-number
Smallest positive number; prints 0
Lower bound sentinel
math.$max-safe-integer
9007199254740991
Largest integer Sass can count exactly
math.$min-safe-integer
-9007199254740991
Smallest integer Sass can count exactly
Precision.
Sass prints numbers with ten decimal places, so very small constants such as $epsilon and $min-number appear as 0.
$epsilon and $min-number print as 0 at Sass’s precision.
Constants are unitless—add units after the math.
One line: after @use "sass:math", read math.$pi, math.$e, and the limit constants as unitless numbers.
Practice
Compile Notes
Practical checklist:
checklist.txt
1. @use "sass:math"
2. Read math.$pi or math.$e directly
3. Add units after the math (math.$pi * 10px)
4. Use math.$max-number as a minimum-search sentinel
5. Never assign to a math constant
Frequently Asked Questions
The sass:math module provides math.$pi, math.$e, math.$epsilon, math.$max-number, math.$min-number, math.$max-safe-integer, and math.$min-safe-integer.
math.$pi is 3.1415926536 and math.$e is 2.7182818285, both unitless numbers.
They are far smaller than the ten decimal places Sass prints, so they appear as 0 even though they are tiny positive numbers.
No. Assigning to math.$pi or any built-in variable is a compile error. Copy it into your own variable instead.
math.$max-safe-integer is 9007199254740991 and math.$min-safe-integer is -9007199254740991. Beyond them, whole numbers are no longer exact.
calc(pi) is the CSS calculation constant. math.$pi is a Sass variable you can use in ordinary Sass math outside calculations.