Created
July 26, 2013 11:41
-
-
Save ceee/6088235 to your computer and use it in GitHub Desktop.
Provides a Sass function, which rounds a number by the given precision
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 precision($value, $precision) | |
{ | |
$base: 10; | |
$divisor: 1; | |
@for $i from 1 through $precision | |
{ | |
$divisor: $divisor * $base; | |
} | |
@return round( $value * $divisor ) / $divisor; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment