Post Reply 
Name that calculator - from the program listing...
11-12-2018, 03:20 PM (This post was last modified: 11-12-2018 03:23 PM by Ángel Martin.)
Post: #8
RE: Name that calculator - from the program listing...
ok, to put this one to bed - below is the optimized code for the same example. It uses one intermediate calculation for the discriminant, which saves a ton of bytes in the strings:

Code:
01  LBL  "QRT"
02  "00XYZ"
03  SFHL
04  "b^2-4*a*c"
05  EVAL$
06  "X<0"
07  IF
08    "Q(#X)/2/a"
09    EVALY
10    "#b/2/a"
11  ELSE
12    "#(Q(X)+b)/2/a"
13    EVALY
14    "(Q(X)-b)/2/a"
15  ENDIF
16  EVAL$
17  END

ÁM

"To live or die by your own sword one must first learn to wield it aptly."
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Name that calculator - from the program listing... - Ángel Martin - 11-12-2018 03:20 PM



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