Post Reply 
[42S] MANT Challenge
01-23-2014, 12:07 PM
Post: #21
RE: [42S] MANT Challenge
(01-23-2014 11:05 AM)Gerson W. Barbosa Wrote:  I think I'll stick to the WP 34S and use MANT instead :-)

I share your feelings and appreciate your decision.

d;-)
Find all posts by this user
Quote this message in a reply
01-23-2014, 03:15 PM (This post was last modified: 01-23-2014 03:26 PM by Dieter.)
Post: #22
RE: [42S] MANT Challenge
(01-23-2014 11:05 AM)Gerson W. Barbosa Wrote:  
(01-23-2014 11:02 AM)Werner Wrote:  Hi Gerson!
Fails for 1 e-499, I'm afraid
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
Find all posts by this user
Quote this message in a reply
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
01-23-2014, 08:19 PM
Post: #24
RE: [42S] MANT Challenge
(01-22-2014 09:40 AM)Werner Wrote:  On the 41, you can use Synthetic Programming to come up with a short and efficient routine that returns the mantissa.

The 42s problem has been solved, but I have to admit that my skills in Synthetic Programming are more than limited (or less than, if you prefer). Would you mind posting such a short and efficient synthetic MANT routine for the 41-series?

Dieter
Find all posts by this user
Quote this message in a reply
01-23-2014, 09:06 PM (This post was last modified: 01-23-2014 09:19 PM by Werner.)
Post: #25
RE: [42S] MANT Challenge
The MT routine as listed on page 339 of the PPC ROM manual, which is included in the MoHPC CDs/DVD:

29 LBL "MT"
30 CLA
31 STO M
32 ASTO M
33 INT
34 X!=0?
35 (Append x'00')
36 X=0?
37 (Append x'A0')
38 CLX
39 ST+ M
40 X<> M
41 RTN

Btw your latest code is almost the same as the one I posted before ;-)

41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE
Find all posts by this user
Quote this message in a reply
01-23-2014, 09:53 PM
Post: #26
RE: [42S] MANT Challenge
(01-23-2014 09:06 PM)Werner Wrote:  The MT routine as listed on page 339 of the PPC ROM manual, which is included in the MoHPC CDs/DVD:

Thank you.

(01-23-2014 09:06 PM)Werner Wrote:  Btw your latest code is almost the same as the one I posted before ;-)

Well, you will know that German proverb: Zwei Dumme, ein Gedanke! ;-))

Dieter
Find all posts by this user
Quote this message in a reply
01-24-2014, 12:06 AM
Post: #27
RE: [42S] MANT Challenge
(01-23-2014 09:53 PM)Dieter Wrote:  
(01-23-2014 09:06 PM)Werner Wrote:  Btw your latest code is almost the same as the one I posted before ;-)

Well, you will know that German proverb: Zwei Dumme, ein Gedanke! ;-))

Dieter

Please allow me to offer a translation:

Great minds think alike!
Find all posts by this user
Quote this message in a reply
01-24-2014, 06:16 AM
Post: #28
RE: [42S] MANT Challenge
It sounds better in English than in German ;-)

41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE
Find all posts by this user
Quote this message in a reply
01-24-2014, 08:15 AM
Post: #29
RE: [42S] MANT Challenge
(01-24-2014 12:06 AM)Gerson W. Barbosa Wrote:  
(01-23-2014 09:53 PM)Dieter Wrote:  Well, you will know that German proverb: Zwei Dumme, ein Gedanke! ;-))

Dieter

Please allow me to offer a translation:

Great minds think alike!

Almost, Gerson, almost!

d;-)
Find all posts by this user
Quote this message in a reply
01-24-2014, 09:15 AM
Post: #30
RE: [42S] MANT Challenge
(01-24-2014 06:16 AM)Werner Wrote:  It sounds better in English than in German ;-)

I know, that's why I should be working at the UN Interpretation Service :-)
Find all posts by this user
Quote this message in a reply
Post Reply 




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