Post Reply 
A quick precision test
06-05-2014, 09:25 PM
Post: #49
RE: A quick precision test
(06-05-2014 12:06 PM)Paul Dale Wrote:  There are other rounding cases. What about nnnnm|500000000|1 when m is odd and you are rounding to even? Or nnnnn|000000000|1 when you are rounding towards +infinity? Assuming you support rounding modes of course.

Yes, there's one case for each rounding mode, so it's still 1 in 10^9 chance no matter which mode you select.

(06-05-2014 12:06 PM)Paul Dale Wrote:  Agreed, the chance of being incorrect - if your internal result is correct - is low but it is still there. Correct rounding is a worthwhile, if somewhat quixotic, goal. One ULP is far more achievable.

Are you sure all of your guard digits are correct or even all the digits in your result? In general they (the guard digits) won't all be. There are many pitfalls for the unwary here. Even changing the order of operations can cause problems. You need to be amazingly careful to get all digits correct, if indeed this is even possible (which it isn't in general).

No, I cannot guarantee that all my guard digits are all correct, and that's one more reason not to obsess about rounding.
As long as the most significant of my guard digits is good, there's only 0.5 ULP worst-case error (if I round the last digit up or down incorrectly).

On the other hand, when I implemented transcendentals, I thought it this way:
* The user should have 2000 good digits, that was my target. Since the library works in groups of 9 digits, you actually get 2007 (multiple of nine).
* For me to be able to get guard digits, I calculated all the CORDIC constants with 2016 digits (9 digits more).
* In the CORDIC loop, I set the precision to 9 digits more (2025) for all intermediate operations. It may seem dumb, because the constants have only 2016, but it actually helps get me a few more good digits.

With this, I can get transcendentals correct to the last digit that will be displayed to the user on all the test cases I tried (except the ones where you lose precision, like your COS(near PI) case, but that comes from the argument, not the algorithm).

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


Messages In This Thread
A quick precision test - pito - 06-02-2014, 10:37 PM
RE: A quick precison test - Paul Dale - 06-02-2014, 11:04 PM
RE: A quick precison test - pito - 06-03-2014, 12:07 AM
RE: A quick precison test - Paul Dale - 06-03-2014, 12:13 AM
RE: A quick precison test - pito - 06-03-2014, 12:27 AM
RE: A quick precison test - Paul Dale - 06-03-2014, 12:36 AM
RE: A quick precision test - Claudio L. - 06-04-2014, 01:25 PM
RE: A quick precision test - walter b - 06-04-2014, 01:33 PM
RE: A quick precision test - Claudio L. - 06-04-2014, 01:42 PM
RE: A quick precision test - Paul Dale - 06-04-2014, 09:47 PM
RE: A quick precison test - walter b - 06-03-2014, 11:24 AM
RE: A quick precision test - Dieter - 06-04-2014, 01:08 PM
RE: A quick precision test - walter b - 06-04-2014, 01:23 PM
RE: A quick precison test - HP67 - 06-03-2014, 09:06 AM
RE: A quick precision test - everettr - 06-03-2014, 02:11 PM
RE: A quick precison test - pito - 06-03-2014, 07:23 AM
RE: A quick precison test - HP67 - 06-03-2014, 11:50 AM
RE: A quick precison test - Paul Dale - 06-03-2014, 12:25 PM
RE: A quick precision test - walter b - 06-03-2014, 01:52 PM
RE: A quick precision test - Paul Dale - 06-03-2014, 10:10 PM
RE: A quick precison test - HP67 - 06-03-2014, 12:41 PM
RE: A quick precision test - HP67 - 06-03-2014, 01:01 PM
RE: A quick precision test - walter b - 06-03-2014, 01:56 PM
RE: A quick precision test - pito - 06-04-2014, 01:38 PM
RE: A quick precision test - Claudio L. - 06-04-2014, 02:17 PM
RE: A quick precision test - Paul Dale - 06-04-2014, 10:09 PM
RE: A quick precision test - Claudio L. - 06-05-2014, 01:18 AM
RE: A quick precision test - Paul Dale - 06-05-2014, 02:00 AM
RE: A quick precision test - Claudio L. - 06-05-2014, 11:03 AM
RE: A quick precision test - Dieter - 06-05-2014, 11:23 AM
RE: A quick precision test - Paul Dale - 06-05-2014, 12:06 PM
RE: A quick precision test - Claudio L. - 06-05-2014, 09:08 PM
RE: A quick precision test - Paul Dale - 06-05-2014, 10:09 PM
RE: A quick precision test - Claudio L. - 06-06-2014, 12:57 AM
RE: A quick precision test - Claudio L. - 06-06-2014, 01:15 AM
RE: A quick precision test - Paul Dale - 06-06-2014, 01:35 AM
RE: A quick precision test - pito - 06-06-2014, 11:16 AM
RE: A quick precision test - Claudio L. - 06-06-2014, 12:04 PM
RE: A quick precision test - Paul Dale - 06-06-2014, 10:55 PM
RE: A quick precision test - pito - 06-07-2014, 11:56 AM
RE: A quick precision test - Paul Dale - 06-07-2014, 12:20 PM
RE: A quick precision test - pito - 06-07-2014, 04:44 PM
RE: A quick precision test - walter b - 06-08-2014, 05:28 PM
RE: A quick precision test - Claudio L. - 06-05-2014 09:25 PM
RE: A quick precision test - Paul Dale - 06-05-2014, 10:20 PM
RE: A quick precision test - Claudio L. - 06-06-2014, 01:03 AM
RE: A quick precision test - Paul Dale - 06-06-2014, 01:46 AM
RE: A quick precision test - pito - 06-04-2014, 02:12 PM
RE: A quick precision test - pito - 06-04-2014, 02:31 PM
RE: A quick precision test - pito - 06-05-2014, 08:49 PM
RE: A quick precision test - walter b - 06-05-2014, 09:07 PM
RE: A quick precision test - pito - 06-05-2014, 09:13 PM
RE: A quick precision test - Mark Hardman - 06-05-2014, 09:21 PM
RE: A quick precision test - pito - 06-06-2014, 12:19 PM
RE: A quick precision test - pito - 06-08-2014, 12:44 PM
RE: A quick precision test - walter b - 06-08-2014, 01:57 PM
RE: A quick precision test - pito - 06-08-2014, 02:07 PM
RE: A quick precision test - walter b - 06-08-2014, 03:00 PM
RE: A quick precision test - Paul Dale - 06-08-2014, 10:46 PM



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