CODE f*
b = reinterpret(Float64, popPS())
a = reinterpret(Float64, popPS())
- pushPS(reinterpret(Int64, a*b))
+ pushPS(reinterpret(Int64, a*b + 0.0))
END-CODE
CODE f/
b = reinterpret(Float64, popPS())
a = reinterpret(Float64, popPS())
- pushPS(reinterpret(Int64, a/b))
+ pushPS(reinterpret(Int64, a/b + 0.0))
END-CODE
CODE f^
b = reinterpret(Float64, popPS())
a = reinterpret(Float64, popPS())
- pushPS(reinterpret(Int64, a^b))
+ pushPS(reinterpret(Int64, a^b + 0.0))
END-CODE
CODE fsqrt
CODE fmod
b = reinterpret(Float64, popPS())
a = reinterpret(Float64, popPS())
- pushPS(reinterpret(Int64, a%b))
+ pushPS(reinterpret(Int64, a%b + 0.0))
END-CODE
CODE flog
pushPS(reinterpret(Int64, abs(a)))
END-CODE
+CODE fround
+ a = reinterpret(Float64, popPS())
+ pushPS(reinterpret(Int64, round(a)))
+END-CODE
+
: f/mod
2dup fmod -rot f/ ;
: flog10
flog [ 10 i->f flog ] literal f/ ;
+: truncate
+ dup 1.0 fmod f- ;
+
: floor
dup 0.0 f>= if
- dup 1.0 fmod f-
+ truncate
else
dup 1.0 fmod dup 0.0 <> if
f- 1.0 f-
then
;
+: ceiling
+ dup 0.0 f>= if
+ dup 1.0 fmod dup 0.0 <> if
+ f- 1.0 f+
+ else
+ drop
+ then
+ else
+ truncate
+ then
+;
+
: fasin ( float -- res )
dup
dup f* 1.0 swap f- fsqrt
swap floor swap
; 1 make-fa-primitive flo:floor
+:noname ( flonum -- flonum )
+ swap ceiling swap
+; 1 make-fa-primitive flo:ceiling
+
+:noname ( flonum -- flonum )
+ swap truncate swap
+; 1 make-fa-primitive flo:truncate
+
+:noname ( flonum -- flonum )
+ swap fround swap
+; 1 make-fa-primitive flo:round
+
+:noname ( flonum -- flonum )
+ drop floor f->i fixnum-type
+; 1 make-fa-primitive flo:floor->exact
+
+:noname ( flonum -- flonum )
+ drop ceiling f->i fixnum-type
+; 1 make-fa-primitive flo:ceiling->exact
+
+:noname ( flonum -- flonum )
+ drop truncate f->i fixnum-type
+; 1 make-fa-primitive flo:truncate->exact
+
+:noname ( flonum -- flonum )
+ drop f->i fixnum-type
+; 1 make-fa-primitive flo:round->exact
+
+:noname ( flonum flonum -- flonum )
+ drop swap drop f/ fatan flonum-type
+; 2 make-fa-primitive flo:atan2
+
\ }}}
\ ==== Pairs and Lists ==== {{{