Hi Peter,
Try these. If they are okay, I will add them to the maths library.
double a,b
a=2.4
b=-2.7
deff floor
'=========
sub esp,8 : fstcw [esp] : fstcw [esp+2] : or [esp],0xc00
fldz
fcomip st0
(
jae exit
fchs
)
frndint
(
jae exit
fchs
)
fldcw [esp+2] : add esp,8
end deff
deff ceil
'========
fld st0
frndint
(
fcomip st1
jz exit
fldz
sub esp,8 : fstcw [esp] : fstcw [esp+2] : or [esp],0xc00
fcomip st0
(
jae exit
fchs
)
fld1
faddp st1
frndint
(
jae exit
fchs
)
fldcw [esp+2] : add esp,8
)
end deff
print floor(a) " " ceil(a)
print floor(b) " " ceil(b)
Charles