[futurebasic] Re: [FB] Can I OVERRIDE the SINE function?

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : July 2002 : Group Archive : Group : All Groups

From: Robert Purves <robert.purves@...>
Date: Mon, 22 Jul 2002 17:01:14 +1200
> I would like to modify FB^3's trig functions to work with degrees 
> automatically, rather than radian measurements for angles. I think 
> OVERRIDE is the way to go but have not found a workable routine yet.


override runtime sin#
dim as double  a
a = floatacc
a = a*pi/180.0
beginassem
    mfspr    r0,lr
    stw      r0,8(SP)
    stwu     SP,-64(SP)
    lfd       fp1,^a
    _sin
    fmr      fp14,fp1
    addi     SP,SP,64
    lwz      r0,8(SP)
    mtspr    lr,r0
endassem
end fn


window 1
print sin( 0.0), sin( 90.0 ), sin( 180.0 ), sin (270.0 )
do
HandleEvents
until 0



Robert P.