UNPKG

626 Btext/coffeescriptView Raw
1### erf =====================================================================
2
3Tags
4----
5scripting, JS, internal, treenode, general concept
6
7Authors
8-------
9philippe.billet@noos.fr
10
11Parameters
12----------
13x
14
15General description
16-------------------
17Error function erf(x).
18erf(-x)=erf(x)
19
20###
21
22
23
24Eval_erf = ->
25 push(cadr(p1))
26 Eval()
27 yerf()
28
29yerf = ->
30 save()
31 yyerf()
32 restore()
33
34yyerf = ->
35 d = 0.0
36
37 p1 = pop()
38
39 if (isdouble(p1))
40 d = 1.0 - erfc(p1.d)
41 push_double(d)
42 return
43
44 if (isnegativeterm(p1))
45 push_symbol(ERF)
46 push(p1)
47 negate()
48 list(2)
49 negate()
50 return
51
52 push_symbol(ERF)
53 push(p1)
54 list(2)
55 return
56