Created
March 20, 2017 09:29
-
-
Save jonathanwork/ef47b44c59623a8965fc974d8d0ab1f6 to your computer and use it in GitHub Desktop.
power function in sass
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@function pow($number, $exponent) | |
@if (round($exponent) != $exponent) | |
@return exp($exponent * ln($number)) | |
$value: 1 | |
@if $exponent > 0 | |
@for $i from 1 through $exponent | |
$value: $value * $number | |
@else if $exponent < 0 | |
@for $i from 1 through -$exponent | |
$value: $value / $number | |
@return $value |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment