Post Reply 
[42S] MANT Challenge
01-23-2014, 06:07 PM
Post: #23
RE: [42S] MANT Challenge
(01-23-2014 03:15 PM)Dieter Wrote:  
(01-23-2014 11:05 AM)Gerson W. Barbosa Wrote:  So does the HP-15C version for 1e-99...

Yes, that's why my previous version handles these cases separately. However, this can be done more elegantly, even shorter and without an explicit constant (-499 resp. -99), so it should work on the 42s as well as on the 15C and many other HPs.

Code:
01 ABS
02 1
03 0
04 X<Y?
05 1/x
06 *
07 ENTER
08 X≠0?
09 LOG
10 INT    ' or IP on later models
11 10^x
12 /
13 1
14 X>Y?
15 10^x
16 *

All input values are shifted by one magnitude towards 10, so that over-/underflow can not occur.

Dieter
Also, this preserves most of the stack (only T is lost). Very nice!

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


Messages In This Thread
[42S] MANT Challenge - Werner - 01-22-2014, 09:40 AM
RE: [42S] MANT Challenge - Dieter - 01-22-2014, 08:58 PM
RE: [42S] MANT Challenge - Dieter - 01-22-2014, 09:40 PM
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 - 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 - 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 - walter b - 01-24-2014, 08:15 AM
RE: [42S] MANT Challenge - Werner - 01-24-2014, 06:16 AM



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