Skip to content

Commit

Permalink
Showing 2 changed files with 29 additions and 8 deletions.
29 changes: 29 additions & 0 deletions opal/corelib/math.rb
Original file line number Diff line number Diff line change
@@ -186,6 +186,35 @@ def erf(x)
Math.checked :erf, Math.float!(x)
end

unless defined?(`Math.erfc`)
%x{
Math.erfc = function(x) {
var z = Math.abs(x),
t = 1.0 / (0.5 * z + 1.0);
var A1 = t * 0.17087277 + -0.82215223,
A2 = t * A1 + 1.48851587,
A3 = t * A2 + -1.13520398,
A4 = t * A3 + 0.27886807,
A5 = t * A4 + -0.18628806,
A6 = t * A5 + 0.09678418,
A7 = t * A6 + 0.37409196,
A8 = t * A7 + 1.00002368,
A9 = t * A8,
A10 = -z * z - 1.26551223 + A9;
var a = t * Math.exp(A10);
if (x < 0.0) {
return 2.0 - a;
}
else {
return a;
}
}
}
end

def erfc(x)
Math.checked :erfc, Math.float!(x)
end
8 changes: 0 additions & 8 deletions spec/filters/bugs/math.rb

This file was deleted.

0 comments on commit 9a0fc2a

Please sign in to comment.