**Subject:** Re: bc (1)

**To:** None *<banshee@gabriella.resort.com>*

**From:** Mike Long *<mike.long@analog.com>*

**List:** current-users

**Date:** 06/21/1996 12:13:27
>Date: Fri, 21 Jun 1996 05:00:08 -0700 (PDT)
>From: John M Vinopal <banshee@gabriella.resort.com>
>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 <mike.long@analog.com> <URL:http://www.shore.net/~mikel>
VLSI Design Engineer finger mikel@shore.net for PGP public key
Analog Devices, CPD Division CCBF225E7D3F7ECB2C8F7ABB15D9BE7B
Norwood, MA 02062 USA (eq (opinion 'ADI) (opinion 'mike)) -> nil