1 \ Floating point arithmetic
3 ( Cheating for now by using forth.jl CODE/END-CODE to
4 access Julia's floating point support. This isn't
5 at all portable. That said, the year is 2016 and most
6 CPUs implement these operations - even the trig functions,
7 so I don't feel too bad! )
10 b = reinterpret(Float64, popPS())
11 a = reinterpret(Float64, popPS())
12 pushPS(reinterpret(Int64, a+b))
16 b = reinterpret(Float64, popPS())
17 a = reinterpret(Float64, popPS())
18 pushPS(reinterpret(Int64, a-b))
22 b = reinterpret(Float64, popPS())
23 a = reinterpret(Float64, popPS())
24 pushPS(reinterpret(Int64, a*b))
28 b = reinterpret(Float64, popPS())
29 a = reinterpret(Float64, popPS())
30 pushPS(reinterpret(Int64, a/b))
34 b = reinterpret(Float64, popPS())
35 a = reinterpret(Float64, popPS())
36 pushPS(reinterpret(Int64, a^b))
40 b = reinterpret(Float64, popPS())
41 a = reinterpret(Float64, popPS())
42 pushPS(reinterpret(Int64, a>b))
46 b = reinterpret(Float64, popPS())
47 a = reinterpret(Float64, popPS())
48 pushPS(reinterpret(Int64, a<b))
52 b = reinterpret(Float64, popPS())
53 a = reinterpret(Float64, popPS())
54 pushPS(reinterpret(Int64, a=b))
58 b = reinterpret(Float64, popPS())
59 a = reinterpret(Float64, popPS())
60 pushPS(reinterpret(Int64, a<=b))
64 b = reinterpret(Float64, popPS())
65 a = reinterpret(Float64, popPS())
66 pushPS(reinterpret(Int64, a>=b))
70 b = reinterpret(Float64, popPS())
71 pushPS(reinterpret(Int64, log(a)))
75 b = reinterpret(Float64, popPS())
76 pushPS(reinterpret(Int64, exp(a)))
80 pushPS(reinterpret(Int64, Float64(popPS())))