LONGCALC.TXT (c) www.merlyn.demon.co.uk >= 2001-08-30 The definitive Help for longcalc.pas (and therefore longcalc.exe and vastcalc.exe) is in comment at the end of longcalc.pas. This is a snapshot, taken 2001-08-30 in order to have a TXT file readable on the Web. The number 7424, and how to square root its square, are from Peggy Tolmie. RPN is Reverse Polish Notation : the command string is read left-to-right, values (numbers, strings, addresses) encountered are placed on top of a stack, and operators are performed immediately on the top element(s) of the stack, generally replacing their inputs with their outputs. Knowledge of PostScript (R) is not needed to use this; but it could help. Franz Glaser has a related RPN page (referring to his calculators) at http://www.geocities.com/SiliconValley/2926/txt/rpn_explanation.html Here, operators and addresses are *all* case-sensitive three-character "words", and strings are the contents of nestable parentheses. Numbers are signed decimal, except for those beginning with 0, which are unsigned and to the current base (for negative ones, put neg after). A semicolon introduces comment to end of current RPN string or line. There are ten writeable registers q0..q9, addresses /q0../q9; and qa qs qm qd qr qp hold results of the latest add sub mul div/mod/srt pwr. Enter #f9 is F9 test #pi is N*Pi by the B B P method ("repeats" added 19990624) #ds is DateTime-to-Seconds #sd is Seconds-to-DateTime #sa is DateTime Seconds-AddTo #dd is DateTime-Difference in seconds #uf is Unix-Fail - 2 N dec pow #uf is N-bit signed time fail date/time. #dt is push present DateTime N.B. the Base Date for Seconds is now Astronomical Proleptic Gregorian 0000-03-01 00:00:00. Other commands are general RPN operators; for examples of their use, see statements of the form "... RPN(..., SP) ..." above. Note that "div" and "mod" are integer division; AND that "mod" no longer stacks both results. The integers can now have opposite signs. They solve X=Q*Y+R, for R in the range from 0 to nearly Y, with same sign. There is no documentation for this program, at present or expected, other than the contents of this file. For Help, use ? ?? ??? ? (not in GUI). KEY inputs a keyboard line; (file.ext) SCR inputs a script . If there is any parameter, the parameter list is executed (not in GUI). So longcalc (dosfile.scr) SCR executes dosfile.scr; I have a few such files : weeknumb.scr pastri.scr. Needs Heap Overflow Tests for Delphi, TMT? For operating hints, look above at the RPN calls in the code, and at array Defs, and at '?' characters. Command 'bas' converts the base of all bar string contents. It is SLOW; clear all possible numbers first, incl. 0 0 add 0 sub 0 mul 0 pow srt . Command 'INS' adds an instruction to the set; first push five strings: the TLA; the RPN code; the param-check; the help words; the I/O pattern. #dt now should not err at date rollover. I usually compile this in BP7 with all runtime checks ON; with all off, it is about pi times quicker. With D3 DCC32 -cc, it is 4 times faster. Note the top lines. This is written for BP7. In Delphi and TMT, command editing & history are not supported. AFAICT, all else works in Delphi, but some crashes in TMT. If PROGRAM is defined, it is a program, else a unit for vastcalc. Timers tix & mls are from midnight in Pascal, from Windows boot in Delphi, as Pascal uses $40:$6c & Delphi uses GetTickCount; conversion factor 55. GetEnv, PutEnv now need Prof. Timo Salmi's TSUntEnv.TPU; no *.TPP?; ? . The effect of logicals - AND OAR XOR NOT IMP - needs thought; operations are digit-by-digit, and if Base<>2^n can give duff digits. Results are however masked down to the number of bits Base implies. END.