[42S] MANT Challenge
01-22-2014, 07:53 PM (This post was last modified: 01-22-2014 08:01 PM by Dieter.)
Post: #9
 Dieter Senior Member Posts: 2,397 Joined: Dec 2013
RE: [42S] MANT Challenge
(01-22-2014 09:40 AM)Werner Wrote:  A few borderline cases that may foil your first attempts (on a real 42S, not Free42):

0
1.00000000001e-01
-9.99999999999

The problem are values with a mantissa > 9,99999999988 or even > 9,99999998844 (near the end of the working range). Here the log10 will be rounded up to the next higher integer. So the idea is to divide by the next lower power of ten (which also handles cases < 0,1) and add a final adjustment if the result is beyond 10 (which is true for most cases > 1). The only left problem are values very close to the lower working limit (1E-499). Here the log10 may be returned as -499 so that a division by 10^-500 would result. This case is handled separately.

Code:
01 ABS 02 ENTER 03 X≠0? 04 LOG 05 IP 06 1 07 - 08 -499 09 X>Y? 10 X<>Y 11 RDN 12 10^x 13 / 14 10 15 X>Y? 16 SIGN 17 /

What about this one? Any errors or problematic values? At least my 35s handles all test cases correctly. And also all others I tried. Is this a solution or am I missing something?

Dieter
 « Next Oldest | Next Newest »

 Messages In This Thread [42S] MANT Challenge - Werner - 01-22-2014, 09:40 AM RE: [42S] MANT Challenge - Gerson W. Barbosa - 01-22-2014, 12:23 PM RE: [42S] MANT Challenge - Gerson W. Barbosa - 01-22-2014, 08:41 PM RE: [42S] MANT Challenge - Dieter - 01-22-2014, 08:58 PM RE: [42S] MANT Challenge - Gerson W. Barbosa - 01-22-2014, 09:14 PM RE: [42S] MANT Challenge - Dieter - 01-22-2014, 09:40 PM RE: [42S] MANT Challenge - Gerson W. Barbosa - 01-23-2014, 02:52 AM RE: [42S] MANT Challenge - Werner - 01-22-2014, 12:38 PM RE: [42S] MANT Challenge - Dieter - 01-22-2014, 01:46 PM RE: [42S] MANT Challenge - Gerson W. Barbosa - 01-23-2014, 10:47 AM RE: [42S] MANT Challenge - Werner - 01-22-2014, 02:17 PM RE: [42S] MANT Challenge - Dieter - 01-22-2014, 02:24 PM RE: [42S] MANT Challenge - Werner - 01-22-2014, 02:34 PM RE: [42S] MANT Challenge - Dieter - 01-22-2014, 06:50 PM RE: [42S] MANT Challenge - Dieter - 01-22-2014 07:53 PM RE: [42S] MANT Challenge - Thomas Klemm - 01-23-2014, 12:40 AM RE: [42S] MANT Challenge - Werner - 01-23-2014, 07:46 AM RE: [42S] MANT Challenge - Werner - 01-23-2014, 09:34 AM RE: [42S] MANT Challenge - Werner - 01-23-2014, 11:02 AM RE: [42S] MANT Challenge - Gerson W. Barbosa - 01-23-2014, 11:05 AM RE: [42S] MANT Challenge - walter b - 01-23-2014, 12:07 PM RE: [42S] MANT Challenge - Dieter - 01-23-2014, 03:15 PM RE: [42S] MANT Challenge - Gerson W. Barbosa - 01-23-2014, 06:07 PM RE: [42S] MANT Challenge - Dieter - 01-23-2014, 08:19 PM RE: [42S] MANT Challenge - Werner - 01-23-2014, 09:06 PM RE: [42S] MANT Challenge - Dieter - 01-23-2014, 09:53 PM RE: [42S] MANT Challenge - Gerson W. Barbosa - 01-24-2014, 12:06 AM RE: [42S] MANT Challenge - walter b - 01-24-2014, 08:15 AM RE: [42S] MANT Challenge - Werner - 01-24-2014, 06:16 AM RE: [42S] MANT Challenge - Gerson W. Barbosa - 01-24-2014, 09:15 AM

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