Post Reply 
[WP-34S] DEG and RAD - diffs
06-06-2014, 01:31 AM
Post: #14
RE: [WP-34S] DEG and RAD - diffs
(06-05-2014 10:32 PM)Paul Dale Wrote:  
(06-05-2014 09:38 PM)Claudio L. Wrote:  Smaller angles are harder test cases and have more errors on trig function algorithms.

Why?

This must depend greatly on the algorithm used.

For example, using a Maclaurin series for the trigonometric functions gives very good results for all of the trig functions for small inputs.


- Pauli

Indeed: For very small angles, a couple terms of Taylor gives you great results. The smaller the value the less terms you need.
However, CORDIC accumulate angles from large to small, adding smaller and smaller numbers to bring a target to zero. This is really bad for precision, because it forces you to start adding large terms first that cancel each other. I was able to get good results by starting the loop at a more advanced stage, where angles are in the same order of magnitude as the argument to avoid the large errors. This way I was able to obtain good accuracy on all digits even for small angles, but the price was to triple the storage space since I need calibrated constants to start the loop arbitrarily at any location.
If the implementation doesn't do this, it loses a lot of digits.
There's other cases where this can't be avoided: cosh() for example. The small angles case has a result that's very close to one (you never have this with the normal COS() since you have to calculate sin(PI/2-alpha)). I found a way around it by storing the (COSH-1) instead of COSH (which gives me back the digits when the result is close to one), and also needed extra iterations. Unless you take all those precautions, CORDIC is very prone to error on small angles, and I suspect many implementations in the early days were very crude.

Claudio
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
[WP-34S] DEG and RAD - diffs - pito - 06-05-2014, 12:08 AM
RE: DEG and RAD - diffs - Paul Dale - 06-05-2014, 12:53 AM
RE: DEG and RAD - diffs - pito - 06-05-2014, 06:27 AM
RE: [WP-34S] DEG and RAD - diffs - pito - 06-05-2014, 01:38 PM
RE: [WP-34S] DEG and RAD - diffs - Dieter - 06-05-2014, 11:12 AM
RE: [WP-34S] DEG and RAD - diffs - pito - 06-05-2014, 06:04 PM
RE: [WP-34S] DEG and RAD - diffs - pito - 06-05-2014, 07:57 PM
RE: [WP-34S] DEG and RAD - diffs - pito - 06-05-2014, 10:07 PM
RE: [WP-34S] DEG and RAD - diffs - Claudio L. - 06-06-2014 01:31 AM
RE: [WP-34S] DEG and RAD - diffs - Dieter - 06-06-2014, 05:27 PM
RE: [WP-34S] DEG and RAD - diffs - pito - 06-07-2014, 12:57 PM



User(s) browsing this thread: 1 Guest(s)