Created
October 18, 2012 12:31
-
-
Save Tenderfeel/3911497 to your computer and use it in GitHub Desktop.
test
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($a, $b) { | |
@for $a from 1 through $b { | |
$a: $a * $a; | |
} | |
@return $a; | |
} | |
//√nを計算 | |
@function sqrt($n) { | |
$z: 0; | |
$k: 0; | |
@for $j from 0 through 3 { | |
$m : pow(10, $j); | |
@for $i from 0 through max(10, $n) { | |
@if (($z + $i/$m) * ($z + $i/$m)) <= $n { | |
$k : $i; | |
} | |
} | |
$z: $z + ($k / $m); | |
} | |
@return $z; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment