Command line calculator for Very Lazy Bastards
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
COPYING
INSTALL
Makefile.in
README
Test
arg1.c
arg1.h
configure
grammar.y
num.c
num.h
num_test.c
output.c
output.h
patterns.l
szg.1
szg.c
szg.h
szg.pakk
usage.txt
vars.c
vars.h
vars_test.c
version.txt

README

szg is a command line calculator with an extremely fast and intuitive workflow.

Features
--------
32-bit integer or floating-point arithmetic
Missing operands or _ anywhere are replaced with the last result:
Input:
  szg           - expressions, variable assignments and commands on stdin
  szg <FILE>    - from file specified on command line
  szg -e <expr> - expression directly from the command line
Comma-grouping of input allowed
Unlimited undo
Operators ()~ ^ */% +- &| =   ATTENTION: unary minus is ~ (tilde)
Math functions @s @c @a @l @e @r = sin cos atan log exp sqrt
User defined variables like $foo
Decimal, binary, octal or hexadecimal format (commands D, B, O, X)
Unsigned integer, signed integer and float modes (commands N, S, F)
Prompt shows unsigned/integer/float mode and bin/oct/dec/hex format (DdBbOoXxf)
Floating-point mode never upon division, only upon F or float literal
Combination of expressions/commands on same line
Comments starting with #

Examples
--------
d XffffD  # Prompt d: signed int mode, decimal format. Convert hex to decimal
65535
d 4+3     # Addition
7
d *       # Both operands missing, means 7*7
49
d /2      # integer division, result remains integer
24
d /5.0    # floating point division upon request, shown by prompt f
4.8
f @r      # square root, missing operand, means @r(4.8)
2.19089
f B       # look at the bitwise storage of the float number in memory
0,10000000,00011000011011110001100
2.19089
f $foo=   # store in variable $foo
2.19089
f 1/      # reciprocal is easy even without a special function
0.456435
f