[comp.os.os9] basic09 calculations

wynkoop@esquire.UUCP (Brett Wynkoop) (12/26/89)

Greeting-
     Why does the following line of code yeild the wrong answer under
basic09?
It works fine under microsoft basic on my model 102, and ECB on my coco.
It
even works fine on my hp67.  Help!

distance =60*(acs((sin(lat1)*sin(lat2))+(cos(lat1)*cos(lat2)*cos(dlong))))

By the way everything is dimed as real.


-Brett

pete@wlbr.IMSD.CONTEL.COM (Pete Lyall) (12/30/89)

For the benefit of others who aren't on CIS, Brett received a response
to his Trig formula problem... It turns out that BASIC09 defaults to
working in RADIANS. If you select DEGREES as the unit of measure, that
should yield appropriate results.

Pete

-- 
Pete Lyall                                                   Contel Corporation
Compuserve: 76703,4230              OS9_Net: (805) 375-1401 (24hr 300/1200/2400)
Internet: pete@wlbr.imsd.contel.com     UUCP: {hacgate,jplgodo,voder}!wlbr!pete 

jejones@mcrware.UUCP (James Jones) (01/03/90)

In article <1692@esquire.UUCP> wynkoop@esquire.UUCP (Brett Wynkoop) writes:
>     Why does the following line of code yield the wrong answer under BASIC09?
>It works fine under microsoft basic on my model 102, and ECB on my coco.
>It even works fine on my hp67.  Help!
>
>distance =60*(acs((sin(lat1)*sin(lat2))+(cos(lat1)*cos(lat2)*cos(dlong))))

I post the answer here for the general public; Mr. Wynkoop has already received
replies via CIS.  BASIC09 comes up in the mode of presuming arguments to trig
functions (or results of the inverse trig functions) to be in *radians*; one
can switch that to degrees with the DEG command (and back with RAD, which
Valley Dudes should appreciate :-).  Mr. W. got the answer he expected with
DEG.

	James Jones