This was fun to write. Raise or lower a number to any power, although you are limited to five digits of precision. Any number of greater precision is rounded off to the nearest whole number, so you couldn’t have an rem font-size equal to the gravitational constant (not that I’d want to do this):

```
#gravitationally-awesome {
// font-size: 0rem;
font-size: #{6.674 * power(10,-11)}rem;
}
```

```
/**
* Exponential Number
* -----------------------------------------------------------------------------
* Raise a number to a given power.
*
* @param number $number Number to raise.
* @param number $power Power to which it should be raised.
* @return number $exponent Number raised to exponent.
*/
@function power($number, $power) {
$exponent: 1;
@if $power > 0 {
@for $i from 1 through $power {
$exponent: $exponent * $number;
}
} @else if $power < 0 {
@for $i from 1 through $power {
$exponent: $exponent / $number;
}
}
@return $exponent;
}
```

J. Hogue #

Any idea how this might be done with a decimal exponent? I’m trying to create a series of functions and mixins that calculate colors with passing WCAG color contrast grade, but it requires a way to raise a number to the power of 2.4. Here is the WCAG guide as to how to calculate luminance: https://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef

Mark Grealish #

Nope, sorry dude!