Subject: Re: bc (1)
To: None <>
From: Mike Long <>
List: current-users
Date: 06/21/1996 12:13:27
>Date: Fri, 21 Jun 1996 05:00:08 -0700 (PDT)
>From: John M Vinopal <>

>does someone familiar with this utility know why it chooses to recode
>series approximations for sin(), cos(), atan() rather than calling the
>(hopefully) functional and accurate library ones?

bc(1) uses "unlimited precision arithmetic", while the libm functions
only accept and return doubles.

You can use trig identities to get asin() and acos() from atan():

asin(x) = atan(sqrt(1-x*x)/x)
acos(x) = atan(x/sqrt(1-x*x))

...for 0 < x < 1.  Getting the signs correct and checking for
divide-by-zero is left as an exercise for the reader. :-)
Mike Long <>     <URL:>
VLSI Design Engineer         finger for PGP public key
Analog Devices, CPD Division          CCBF225E7D3F7ECB2C8F7ABB15D9BE7B
Norwood, MA 02062 USA       (eq (opinion 'ADI) (opinion 'mike)) -> nil