Post Reply 
Dismal Arithmetic & 3 Progs for 49G & Others
04-22-2015, 07:45 AM
Post: #8
RE: Dismal Arithmetic with Two Programmes for the HP 49G
Here is a slightly improved version of DPLUS using this trick for string padding:

Code:
EXPORT DPLUS(a,b)
BEGIN
LOCAL la,lb;
  la:=ASC(REPLACE("",13-DIM(STRING(a)),STRING(a))); 
  lb:=ASC(REPLACE("",13-DIM(STRING(b)),STRING(b))); 
  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-22-2015 07:45 AM



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