Skip to content

Commit 7b4b4aa

Browse files
committed
Expand rationale
1 parent ac43762 commit 7b4b4aa

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

doc/rationale.md

+16
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,19 @@ logic required for wah.
2222
# Could it be implemented in ClojureScript?
2323

2424
Sure! It might even already work in ClojureScript, I just haven't tried yet. PRs welcome!
25+
26+
# Why port Simple Statistics to WebAssembly?
27+
28+
Two reasons: speed is the most obvious, but the other is consistency.
29+
30+
As I've learned from talking to the [stdlib](https://github.com/stdlib-js/stdlib) project,
31+
one of the things standing in the way from JavaScript being a great environment
32+
for mathematical reasoning is that the mathematical builtins are inconsistent:
33+
when you use `Math.sin`, it can use different estimations and have different
34+
results in different JavaScript environments.
35+
36+
WebAssembly, instead, requires you to write your basics from scratch - even
37+
just for the error function, I had to write `Math.exp` and `Math.pow` for myself.
38+
But the rudimentary methods that it does support have guaranteed behavior. So
39+
you can start lower and make better guarantees about the robustness of the system,
40+
without making big sacrifices in performance.

0 commit comments

Comments
 (0)