Re: Accuracy of tan()?

From: John Morrison (john.morrison_at_tesco.net)
Date: 06/23/04


Date: Wed, 23 Jun 2004 23:42:09 -0000


"Everett M. Greene" <mojaveg@iwvisp.com> wrote in message
news:20040623.7A1BB70.A513@mojaveg.iwvisp.com...
> We have a situation where we have a tan() function
> implemented in single-precision floating point
> arithmetic and a test case is tan(-1.570796). We
> are getting results of
>
> - 3060018.
> - 3185560.75
> - 3185560.708
> - 3560236.5
> - 5340352.5
> -37320540.2
>
> depending on the implementation.
>
> How does one define the accuracy of the tangent function
> near the odd multiples of pi/2 and which of the above is
> the "better" result?
>
> As far as I'm concerned, any big number is good enough
> in the vicinity of odd multiples of pi/2 since one
> has an ill-formed problem if using tan() in these regions.

    In general, tan(Pi/2-z) = cot(z) = 1/tan(z).

    Does this help?

John
johnDOTmorrisonATtescoDOT net

-- 
"Some people are so are so gullible that they think that the word 'gullible'
means 'liable to be shat upon by members of the family <it>Laridae</it>'." -
Anon.
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.708 / Virus Database: 464 - Release Date: 18-Jun-04


Relevant Pages

  • Re: Accuracy of tan()?
    ... >implemented in single-precision floating point ... >near the odd multiples of pi/2 and which of the above is ... Does 1.570796 round to that number? ...
    (comp.lang.fortran)
  • Re: Accuracy of tan()?
    ... >implemented in single-precision floating point ... >near the odd multiples of pi/2 and which of the above is ... Does 1.570796 round to that number? ...
    (sci.math.num-analysis)
  • Accuracy of tan()?
    ... implemented in single-precision floating point ... near the odd multiples of pi/2 and which of the above is ... has an ill-formed problem if using tan() in these regions. ...
    (sci.math.num-analysis)
  • Re: Accuracy of tan()?
    ... > near the odd multiples of pi/2 and which of the above is ... > has an ill-formed problem if using tan() in these regions. ... "In a world in which the price of calculation continues to decrease ...
    (sci.math.num-analysis)
  • Re: Accuracy of tan()?
    ... > near the odd multiples of pi/2 and which of the above is ... > has an ill-formed problem if using tan() in these regions. ... "In a world in which the price of calculation continues to decrease ...
    (comp.lang.fortran)