X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?a=blobdiff_plain;f=src%2Ffloat.4th;h=c256da93f6522a8fc26557adf7e0224dfa9bc4c9;hb=f675338306652fc8accf3c5ba154b915d0d24cdc;hp=74a4f08469578fcc8a922699f43d6265017ac562;hpb=73373387ae07d9da0ee049d96338555707b6d7b7;p=scheme.forth.jl.git diff --git a/src/float.4th b/src/float.4th index 74a4f08..c256da9 100644 --- a/src/float.4th +++ b/src/float.4th @@ -29,3 +29,68 @@ CODE f/ a = reinterpret(Float64, popPS()) pushPS(reinterpret(Int64, a/b)) END-CODE + +CODE f^ + b = reinterpret(Float64, popPS()) + a = reinterpret(Float64, popPS()) + pushPS(reinterpret(Int64, a^b)) +END-CODE + +CODE f> + b = reinterpret(Float64, popPS()) + a = reinterpret(Float64, popPS()) + pushPS(reinterpret(Int64, a>b)) +END-CODE + +CODE f< + b = reinterpret(Float64, popPS()) + a = reinterpret(Float64, popPS()) + pushPS(reinterpret(Int64, a= + b = reinterpret(Float64, popPS()) + a = reinterpret(Float64, popPS()) + pushPS(reinterpret(Int64, a>=b)) +END-CODE + +CODE flog + b = reinterpret(Float64, popPS()) + pushPS(reinterpret(Int64, log(a))) +END-CODE + +CODE fexp + b = reinterpret(Float64, popPS()) + pushPS(reinterpret(Int64, exp(a))) +END-CODE + +CODE i->f + pushPS(reinterpret(Int64, Float64(popPS()))) +END-CODE + +: f.scientific ( float -- ) +; + +: f.plain ( float -- ) + +; + +: f. ( float -- ) + dup dup 1000000 i->f f>= swap 1 i->f 10000 i->f f/ f< or if + f.scientific + else + f.plain + then +;