AminetAminet
Search:
84736 packages online
About
Recent
Browse
Search
Upload
Setup
Services

util/cli/yaeval.i386-aros.zip

Mirror:Random
Showing: m68k-amigaos iconppc-amigaos iconppc-morphos iconi386-aros iconi386-amithlon iconppc-warpup iconppc-powerup icongeneric icon
No screenshot available
Short:Yet Another Eval Replacement
Author:Peter Gordon
Type:util/cli
Version:1.0
Architecture:i386-aros
Date:2008-12-30
Download:util/cli/yaeval.i386-aros.zip - View contents
Readme:util/cli/yaeval.i386-aros.readme
Downloads:325

Original Readme
~~~~~~~~~~~~~~~

Yet Another Eval v1.0
=====================

By Peter Gordon (pete at petergordon.org.uk)


1. What is it?
--------------

YAE is another replacement for the standard AmigaOS eval command, although
it is not a direct replacement since it doesn't currently use the same
argument format.

It has the following advantages over Eval:

 · Operator precedence
 · Boolean operators
 · Floating point mode with various trigonometry and logarithmic functions
 · Integers can be expressed in decimal, hexadecimal or binary
 · The source is freely available
 · 64bit integer math, double precision floating point math


2. Usage
--------

  YAE takes the following arguments:

    EXPRESSION/A,FLOAT/S,HEX/S

  The first is the expression to evaluate. If the "FLOAT" switch is specified,
  the expression will be evaluated as double-precision floating point instead
  of integer. If the "HEX" switch is specified, the output will be in hex
  instead of decimal.

  If the expression contains spaces, or an equals sign, you should enclose it
  in quotes (").


3. Specifying values
--------------------

  In integer mode, numbers are specified in decimal, binary, or hex:

  Decimal = 100
  Hex     = $64 or 0x64
  Binary  = %1100100

  Values can also be retrieved from environment variables. Simple put the
  variable name, enclosed in apostrophes, into the expression. For example:

  1+'myvar'

  adds one to the value in the environment variable named myvar.


4. Operators
------------

  YAE supports two types of operators; unary and binary.

  Unary operators precede a value and affect only the value immediately after
  them, such as the unary minus (swap sign):

  -1 means minus one.

  Brackets can be used after a unary operator, in which case it will affect
  the result of the expression in the brackets:

  -(2+1) means minus three.
  -(-1) means 1 :)

  YAE knows the following unary operators:

  Operator   Description         Integer mode?     Float mode?
  ------------------------------------------------------------
     -       Unary minus             Yes              Yes
    ABS      Absolute value          Yes              Yes
    NOT      Binary invert           Yes              No
     ~       Binary invert           Yes              No
    SIN      Sine                    No               Yes
    COS      Cosine                  No               Yes
    TAN      Tangent                 No               Yes
    SINH     Hyperbolic Sine         No               Yes
    COSH     Hyperbolic Cosine       No               Yes
    TANH     Hyperbolic Tangent      No               Yes
    ASIN     Arcsine                 No               Yes
    ACOS     Arccosine               No               Yes
    ATAN     Arctangent              No               Yes
    SQRT     Square root             Yes              Yes
    LOG      Logarithm               Yes              Yes
    LOG10    Logarithm               Yes              Yes
    EXP      Exponential func        No               Yes
    ROUND    Round to nearest        No               Yes
    CEIL     Round up                No               Yes
    FLOOR    Round down              No               Yes
    TRUNC    Truncate                No               Yes


  Binary operators operate on two values to provide a result (not to be
  confused with bit-wise operations).

  YAE knows the following binary operators:

  Operator  Description     Precedence        Integer mode?     Float mode?
  -------------------------------------------------------------------------
     *      Multiply             3               Yes             Yes
     ×      Multiply             3               Yes             Yes
     /      Divide               3               Yes             Yes
     ÷      Divide               3               Yes             Yes
     +      Add                  4               Yes             Yes
     -      Subtract             4               Yes             Yes
     ^      Power                3               Yes             Yes
    MOD     Modulo               3               Yes             No
    XOR     Exclusive or         6               Yes             No
    SHR     Shift right          3               Yes             No
    >>      Shift right          3               Yes             No
    SHL     Shift left           3               Yes             No
    <<      Shift left           3               Yes             No
    AND     And                  5               Yes             No
     &      And                  5               Yes             No
    OR      Or                   5               Yes             No
     |      Or                   5               Yes             No
     =      Equal to             7               Yes             No
     >      Greater than         7               Yes             No
     <      Less than            7               Yes             No
    !=      Not equal to         7               Yes             Yes
    >=      Greater or equal     7               Yes             Yes
    <=      Less than or equal   7               Yes             Yes

  (note: the precedence column is a bit counter-intuitive; the lower number
  operators will be evaluated before the higher number ones)

  examples:

    1.Workbench:> yae "1=2"
    0
    1.Workbench:> yae sin(1.25) float
    0.948985
    1.Workbench:> yae $64
    100
    1.Workbench:> yae 2+3*4+5*6
    44

  and so on...


5. To Do
--------

Please feel free to tackle these yourself and pass the source changes back :)

  · Better documentation
  · AmigaGuide or HTML documentation
  · Better output format control
  · Suggestions?



Uploaded using: archives.aros-exec.org


Contents of util/cli/yaeval.i386-aros.zip
Archive:  /home/aminet/aminet_root/doc//util/cli/yaeval.i386-aros.zip
 Length   Method    Size  Ratio   Date   Time   CRC-32    Name
--------  ------  ------- -----   ----   ----   ------    ----
       0  Stored        0   0%  12-27-08 05:13  00000000  yae/
    5665  Defl:N     1824  68%  04-02-08 03:36  bd564193  yae/yae.txt
   50948  Defl:N    19793  61%  12-27-08 05:13  3b54fbeb  yae/yae
       0  Stored        0   0%  12-28-08 11:20  00000000  yae/src/
     248  Defl:N      159  36%  04-02-08 02:37  1fd2c198  yae/src/makefile
   26053  Defl:N     4850  81%  12-24-08 03:30  934cca1d  yae/src/yae.c
     226  Defl:N      149  34%  12-24-08 03:33  8ccb8b7d  yae/src/makefile.aros
--------          -------  ---                            -------
   83140            26775  68%                            7 files
Page generated in 0.03 seconds
Aminet © 1992-2024 Urban Müller and the Aminet team. Aminet contact address: <aminetaminet net>