Post Reply 
Dismal Arithmetic & 3 Progs for 49G & Others
04-22-2015, 07:04 AM
Post: #6
RE: Dismal Arithmetic with Two Programmes for the HP 49G
(04-21-2015 09:19 PM)Didier Lachieze Wrote:  
(04-21-2015 04:18 PM)Gerald H Wrote:  I eagerly await the appearance of some dismal arithmetic programmes on the Prime.

Here is my version of DPLUS and DMULT for the Prime:

Code:
EXPORT DPLUS(a,b)
BEGIN
LOCAL dlg,la,lb;
  la:=ASC(STRING(a)); lb:=ASC(STRING(b));
  dlg:=SIZE(la)-SIZE(lb);
  IF dlg<0 THEN la:=CONCAT(MAKELIST(0,X,1,−dlg),la); END;
  IF dlg>0 THEN lb:=CONCAT(MAKELIST(0,X,1,dlg),lb); END;
  EXPR(CHAR(MAX(la,lb)));
END;

EXPORT DMULT(a,b)
BEGIN
LOCAL la,lb,i,p;
  la:=ASC(STRING(a)); lb:=ASC(STRING(b));
  FOR i FROM 1 TO SIZE(lb) DO
    p:=DPLUS(p*10,EXPR(CHAR(MIN(la,lb(i)))));
  END;
END;

The programmes are nicely short & may work - I started to type them into the Prime & gave up due to the obscurity of the keyboard.

I guess I'll have to wait until I'm issued with new eyes as I expect that'll happen before a better keyboard is produced.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Dismal Arithmetic with Two Programmes for the HP 49G - Gerald H - 04-22-2015 07:04 AM



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