Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions math.scss
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,26 @@
$ret: 0;
$n: 1;
$dx: .001;

@while $n <= $x {
$ret: $ret + $dx / $n;

$n: $n + $dx;
}

@return $ret;
}

@function sqrt($x) {
@function sqrt($x) {
@return exp(0.5 * ln($x));
}

@function atan ($x) {
$ret: 0;

@for $n from 0 to 25 {
$ret: $ret + power(-1, $n) * power($x, 2 * $n + 1) / (2 * $n + 1);
}

@return $ret;
}
3 changes: 2 additions & 1 deletion test.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<div class="test" id="test-exp">e^x function</div><!-- e^x --><br />
<div class="test" id="test-ln">ln function</div><!-- ln -->
<div class="test" id="test-sqrt">Sqrt function</div><!-- sqrt -->
<div class="test" id="test-atan">Atan function</div><!-- sqrt -->
</body>

</html>
</html>
8 changes: 7 additions & 1 deletion test.scss
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@
#test-ln {
@if ln(exp(1)) != 1.001 { background-color:red; };
}

#test-sqrt {
@if sqrt(4) != 2 { background-color:red; };
}
}

#test-atan {
@if atan(0) != 0 { background-color: red; }
//@if atan(1) != 0.79539 { background-color: red; }
}