Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- The Library for Clipper - <b>l_calc()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
                                 L_CALC()


Syntax:        L_CALC(<expN1>,<expN2>,<expC1>,<expC2>)


Purpose:       Displays a multi-function calculator on the screen,
               allows the user to operate the calculator and returns
               to the calling application the final result from the
               calculator.


Arguments:     <expN1> is the row for the top line of the calculator
               box.
               Minimum value 0, maximum value 2.

               <expN2> is the column for the left hand side of the
               calculator box
               Minimum value 0, maximum value 50.

               <expC1> is a string containing the required colour
               combination for the box edges, display area  and keys.

               <expC2> is a string containing the required colour
               combination for the remainder of the box.


Returns:       The result of the final calculation. This will be
               numeric unless the mode was hex in which case the
               result will be a string.


Usage:         Numeric Modes: Binary, Octal, Decimal and Hex.
               These are accessed by entering <CTRL>+B, <CTRL>+O etc.

               In modes other than decimal, the only operations
               allowed are the entry of numbers in that mode and their
               display in another mode.
               The current mode is displayed on the status line at the
               top of the display box.

               Example:

               mode = Binary
               111010 <CTRL>+H       && Result: 3AH

               Example:
               mode = Hex
               3A  <CTRL>+D          && Result: 58

               The remainder of these instructions apply only if the
               mode showing on the status line is Dec ( for
               Decimal ).

               Arithmetic Operators: +, -, *, /, %, =.
               These are accessed by pressing the appropriate key on
               the keyboard.  With the exception of % they can be
               entered in any order with any combination of digits and
               decimals. % must be entered as the second operator.

               Examples
               27 * 3 / 9 + 2 = -6 **=  && Result: 625
               54 + 5 %  && Result: 56.7

               Editing / Exit Operators: Q, Esc, BS.
               Entering Q at any point will terminate the calculator
               and return control to the calling application.  The
               return value from the calculator will be the result of
               the last calculation.
               Pressing the ESC key will clear the calculator of any
               results or part completed calculations.  The memory
               will remain unaffected.
               Pressing the <Del> key will delete the last digit
               entered after the last operator.  Previously entered
               operators are unaffected by this.

               Other Operators: +/-, log, 1/x, Sqrt, Pi.
               Each of these operators (excluding Pi) must be entered
               as the first operator.

               +/- is accessed by pressing T ( for Toggle ). It will
               alter the sign of the result of the last calculation,
               or entry.

               Examples:
               217 T                 && Result: -217
               217 + 45 T            && Result: -45
               217 + 45 = T          && Result: -262

               Log is accessed by pressing L.  The natural logarithm
               of the result of the last operation or entry will be
               returned.

               Examples:
               217 L                 && Result: 5.38
               217 / 3 L             && Result: 1.099
               217 / 3 = L           && Result: 4.28

               1/x is accessed by pressing X.  The reciprocal of the
               result of the last operation or entry will be returned.

               Examples:
               7 X  && Result: 0.143
               7 - 1 X               && Result: 1
               7 - 1 = X             && Result: 0.166

               Square Root is accessed by pressing R. The square
               root of the result of the last operation or entry is
               returned.

               Examples:
               81 R && Result: 9
               81 - 54 R             && Result: 7.348

               81 - 54 = R           && Result: 5.196

               Pi is accessed by pressing P. The value of Pi correct
               to 10 decimal places will be returned.

               Examples:
               P                     && Result: 3.1415926535
               P / 4=                && Result: 0.785
               0.25 * P =            && Result: 0.785

               Memory Functions: M+, MR, ME.
               M+ is accessed by pressing <ALT>+M +.  The result of
               the last operation will be added to memory and the
               letter M will appear at the left-hand edge of the
               status line.  The letter M showing signifies that there
               is a non-zero value in memory.  If at any time the
               result of adding a figure into memory is zero, then the
               memory sign will disappear.

               Examples:
               123 <ALT>+M +         && Result: Memory  = 123
                    && M. Stat = M
               123 T <ALT>+M +       && Result: Memory  = 0
                    && M. Stat =

               MR is accessed by pressing <ALT>+M R. The contents of
               the memory are recalled and displayed. The contents of
               the memory remain unaffected.

               Examples:
               123 <ALT>+M +         && Result: Memory = 123
               15 * <ALT>+M R =      && Result: 1845

               ME is accessed by pressing <ALT>+M E. The contents of
               the memory will be erased and the memory sign on the
               status bar will be set to blank.

               Examples:
               123 <ALT>+M +         && Result: Memory  = 123
                    &&   M. Stat = M
               <ALT>+M E             && Result: Memory  = 0
                    &&   M. Stat =

               Trigonometrical Functions.
               Rad is accessed by pressing <CTRL>+R. This toggles the
               trig mode between degrees and radians. Nothing else is
               directly affected. When the mode is degrees, input to
               the sin, cos and tan functions is assumed to be in
               degrees. Likewise output from the arcsin, arcos and
               arctan functions will be generated in degrees. When the
               mode is radians then radians are assumed for input and
               generated as output.

               Sin is accessed by pressing <ALT>+S. In this it is the
               only trig. function to use the <ALT> key for access,
               all others use <CTRL>.
               The sin of the result of the last operation or entry
               will be returned.

               Examples:
               Trig. mode = Deg.
               45 <ALT>+S            && Result: 0.707
               Trig. mode = Rad.
               0.785 <ALT>+S         && Result: 0.707

               Cos is accessed by pressing <CTRL>+C. The cosine of the
               result of the last operation or entry will be returned.

               Examples:
               Trig. mode = Deg.

               45 <CTRL>+C           && Result: 0.707
               Trig. mode = Rad.
               0.785 <CTRL>+C        && Result: 0.707

               Tan is accessed by pressing <CTRL>+T. The tangent of
               the result of the last operation or entry will be
               returned.

               Examples:
               Trig. mode = Deg.
               60 <CTRL>+T           && Result: 1.732
               Trig. mode = Rad.
               1.047 <CTRL>+T        && Result: 1.732

               Asin is accessed by pressing <CTRL>+A S. The arcsin of
               the result of the last operation or entry will be
               returned.

               Examples:
               Trig. mode = Deg.
               0.707 <CTRL>+A S      && Result: 45
               Trig. mode = Rad.
               0.707 <CTRL>+A S      && Result: 0.785

               Acos is accessed by pressing <CTRL>+A C. The arcosine
               of the result of the last operation or entry will be
               returned.

               Examples:
               Trig. mode = Deg.
               0.707 <CTRL>+A C      && Result: 45
               Trig. mode = Rad.
               0.707 <CTRL>+A C      && Result: 0.785

               Atan is accessed by pressing <CTRL>+A T. The arctangent
               of the result of the last operation or entry will be
               returned.

               Examples:
               Trig. mode = Deg.
               1.732 <CTRL>+A T      && Result: 60
               Trig. mode = Rad.
               1.732 <CTRL>+A T      && Result: 1.047


Examples:      ans = L_CALC(1,10,"+w/b","r/w")
               ? ans                 && Result: 256


Language:      Clipper

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson