Post Reply 
Dismal Arithmetic & 3 Progs for 49G & Others
04-21-2015, 09:19 PM
Post: #2
RE: Dismal Arithmetic with Two Programmes for the HP 49G
(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;
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 - Didier Lachieze - 04-21-2015 09:19 PM



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