[WP34S] DEG and RAD  diffs

06062014, 01:31 AM
Post: #14




RE: [WP34S] DEG and RAD  diffs
(06052014 10:32 PM)Paul Dale Wrote:(06052014 09:38 PM)Claudio L. Wrote: Smaller angles are harder test cases and have more errors on trig function algorithms. 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/2alpha)). I found a way around it by storing the (COSH1) 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 

« Next Oldest  Next Newest »

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