Skip to content

Instantly share code, notes, and snippets.

@jamiebuilds
Created November 19, 2013 02:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jamiebuilds/7539127 to your computer and use it in GitHub Desktop.
Save jamiebuilds/7539127 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// Sass (v3.3.0.rc.1)
// Compass (v0.13.alpha.10)
// ----
@function pow ($base, $exp) {
@if $exp == floor($exp) {
$r: 1;
$s: 0;
@if $exp < 0 {
$exp: $exp * -1;
$s: 1;
}
@while $exp > 0 {
@if $exp % 2 == 1 {
$r: $r * $base;
}
$exp: floor($exp * 0.5);
$base: $base * $base;
}
@return if($s != 0, 1 / $r, $r);
} @else {
@return exp(log($base) * $exp);
}
}
test {
test: pow(14, 33) == 66408730383449729837806206197059026944;
}
test {
test: true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment