[futurebasic] Re: [FB] Great Circle Cal

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : January 1999 : Group Archive : Group : All Groups

From: Rick Brown <rbrown@...>
Date: Thu, 07 Jan 1999 20:22:44 -0600
Al wrote:

> FB doesn't have ARCSIN.

You can use this for ARCSIN:

LOCAL FN ArcSin#(x#)
  SELECT CASE x#
    CASE 1
      a# = 1.5707963268 '=pi/2
    CASE -1
      a# = -1.5707963268
    CASE ELSE
      a# = ATN(x# / SQR(1 - x#*x#))
  END SELECT
END FN = a#


> what is the "min" in the formula below...[min(1,sqrt(a))]
> I figured it means that if "sqrt(a) < 1" then "a" = 1

Close.  it means "the smaller of 1 and sqrt(a)."
So if sqrt(a) < 1, then min returns sqrt(a), but if
sqrt(a) > 1, then min returns 1.  The reason this appears here is that
the formula that calculates "a" is never _supposed_ to exceed 1, but
depending on the rounding errors of the particular computer, you could
possibly get a number slightly greater than 1.  the "min" is just a way
to limit the number to no greater than 1.

- Rick