Post Reply 
[WP-34S] DEG and RAD - diffs
06-06-2014, 07:53 PM
Post: #27
RE: [WP-34S] DEG and RAD - diffs
(06-06-2014 05:42 PM)Thomas Klemm Wrote:  You can do without using the constant K. Calculate:
\[\tan(\theta)=\frac{K\cdot\sin(\theta)}{K\cdot\cos(\theta)}\]
From this you can calculate:
\[\sin(\theta)=\frac{\tan(\theta)}{\sqrt{1+\tan(\theta)^2}}\]

How normal do you consider the implementation used in most HP-calculators?

Cheers
Thomas

That seems easy to do, but then you have to do a division, a multiplication and a square root, on top of your sin/cos which both come together from CORDIC.
The square root alone will take about half the time of the sin, so you'd increase your time by 50%.
Yes, this will be faster than having to compute the constants alongside but still much worse than having a precomputed constant ready.

Also, when x is close to zero, doing sqrt(1+x^2) is really bad for precision. The x^2 "spreads" your useful digits throughout your exponent range, then the square root compresses them back, and you lost about half of them at the end (see what I meant with "small angles are tougher on precision loss").
For hyperbolics, I'm using the double-angle formulae with much better results since you don't have the square roots.

For now, I'd rather have the constants precalculated, so after CORDIC, one multiplication and I got the final result. However, if we run out of space in ROM and I have to remove my constants, we'll have no choice but to use that trick (thanks, BTW).
I'm not sure a similar trick will work well for hyperbolics, exp() and ln(), though.

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 - Dieter - 06-06-2014, 05:27 PM
RE: [WP-34S] DEG and RAD - diffs - Claudio L. - 06-06-2014 07:53 PM
RE: [WP-34S] DEG and RAD - diffs - pito - 06-07-2014, 12:57 PM



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