Compass Math Helpers

Sass math functions are sufficient for most cases, but in those moments of extreme geekiness these additional functions can really come in handy.

pi()

Returns the value of π.

sin($number)

Returns the sine of a number. If the number is unitless or has a unit of deg then it will return a unitless result. Unless the number has a unit of deg it will be evaluated as radians. Degrees will first be converted to radians. If the number is any other unit, the units will be passed thru to the result, and the number will be treated as radians.

cos($number)

Returns the cosine of a number. If the number is unitless or has a unit of deg then it will return a unitless result. Unless the number has a unit of deg it will be evaluated as radians. Degrees will first be converted to radians. If the number is any other unit, the units will be passed thru to the result, and the number will be treated as radians.

tan($number)

Returns the tangent of a number. If the number is unitless or has a unit of deg then it will return a unitless result. Unless the number has a unit of deg it will be evaluated as radians. Degrees will first be converted to radians. If the number is any other unit, the units will be passed thru to the result, and the number will be treated as radians.

e()

Returns the value of e.

logarithm($number, $base)

Calculates the logarithm of a number to a base. Base defaults to e.

sqrt($number)

Calculates the square root of a number.

pow($number, $exponent)

Calculates the value of a number raised to the power of an exponent.