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))
37 val = parse(Float64, getString(addr, len))
38 pushPS(reinterpret(Int64, val))
43 print(reinterpret(Float64, popPS()))