SS(1) SS(1) NAME SS - batch spreadsheet calculator SYNOPSIS SS [-h|--help] SS --version SS [-H|--HTML|--html] [-T|--Table|--table] [-t|--title title] [-Dmacro[=defn]...] [-p|-p2|--plot|--plot2d|-p3|--plot3D] [-x|--xlabel xlabel] [-y|--ylabel ylabel] [-z|--zlabel zlabel] [ss options...] [file...] ss [-d|--debug] [-v|--verbose] [-r|--rows #rows] [-c|--cols #cols] DESCRIPTION SS is a batch spreadsheet processor for C programmers. It produces a spreadsheet display from plain text input files, similar to the way documents are created using LaTeX. The resulting display is not inter‐ active. A shell script front-end is also provided for preprocessing (using the C preprocessor) and post-processing to generate HTML or graphics output. SS includes all of the numeric operators from the C programming lan‐ guage, with the same syntax, precedence, and associativity as C. It also includes all of the functions from the C90 (ANSI/ISO 9899:1990) standard library math.h, all of the non-complex functions from the C99 standard library tgmath.h, as well as other numeric and range func‐ tions. It allows cycles and non-convergent iterative formulas. OPTIONS -h or --help Displays usage summary to standard error and then exits. --version Displays version to standard output and then exits. -H or --HTML or --html Produces HTML output. When producing HTML output, -DHTML=1 is passed to the C preprocessor, so the HTML macro can be used for conditional compilation in your spreadsheet code. -T or --Table or --table Produces HTML table output without any , , or tags, suitable for embedding in an HTML document. -t title or --title title Sets the title for HTML or plot output. -Dmacro[=defn]... Specifies user-defined macros. -p or -p2 or --plot or --plot2d Produces 2D plot GIF output. -p3 or --plot3d Produces 3D plot GIF output. -x xlabel or --xlabel xlabel Sets the x axis label for plot output. -y ylabel or --ylabel ylabel Sets the y axis label for plot output. -z zlabel or --zlabel zlabel Sets the z axis label for plot output. -d or --debug Turns on debugging of the flex scanner and bison parser. -v or --verbose Displays the row and column index ranges. -r #rows or --rows #rows Sets the number of rows (default 1000). -c #cols or --cols #cols Sets the number of columns (default 702). file... Reads input from files, or from standard input if no file names are specified. The pseudo input file name "-" can also be used to explicitly specify reading standard input. All of the input is filtered through the C preprocessor. Operators, Functions, Commands, and Constants Operators: () parentheses, (expr) ++ postfix increment, x++ -- postfix decrement, x-- ++ prefix increment, ++x -- prefix decrement, --x - unary minus + unary plus ~ bitwise NOT ! logical NOT NOT logical NOT (int) cast (long) cast (double) cast ** exponentiation, x**y == pow(x,y) * multiplication / division % mod, x%y == fmod(x,y) + addition - subtraction << shift left, x<> shift right, x>>y == x/2**y < less than <= less than or equal > greater than >= greater than or equal == equal != not equal & bitwise AND ^ bitwise XOR | bitwise OR && logical AND AND logical AND ^^ logical XOR XOR logical XOR || logical OR OR logical OR => logical implication IMP logical implication <=> logical equivalence EQU logical equivalence ?: conditional operator, e1 ? e2 : e3 = assignment *= multiplication assignment /= division assignment %= mod assignment += addition assignment -= subtraction assignment <<= shift left assignment >>= shift right assignment &= bitwise AND assignment ^= bitwise XOR assignment |= bitwise OR assignment &&= logical AND assignment ^^= logical XOR assignment ||= logical OR assignment , comma operator Numeric functions: acos arc cosine acosh inverse hyperbolic cosine asin arc sine asinh inverse hyperbolic sine atan two-quadrant arctangent atan2 four-quadrant arctangent, atan2(y,x) ~= atan(y/x) atanh inverse hyperbolic tangent cbrt cube root ceil ceiling cell cell(c,r) == value of cell from column c row r col cell column number copysign copy sign of a number cos cosine cosh hyperbolic cosine drand pseudo-random double, 0.0 <= drand() < 1.0 erf error function erfc complementary error function exp exponential exp2 base-2 exponential expm1 exponential minus 1, expm1(x) == exp(x) - 1 fabs absolute value fdim positive difference floor floor fma floating-point multiply and add fmax maximum of two values fmin minimum of two values fmod mod, x%y == fmod(x,y) frexp extract fraction and exponent, {f,e} = frexp(x) hypot Euclidean distance ilogb extract exponent irand pseudo-random integer, 0 <= irand(i) <= i-1 ldexp ldexp(x,e) produces x * (2**e) lgamma log gamma function llrint round to nearest integer llround round to nearest integer log natural logarithm log10 base 10 logarithm log1p logarithm of 1 plus argument, log1p(x) == log(1+x) log2 base 2 logarithm logb extract exponent lrint round to nearest integer lround round to nearest integer modf extract fraction and integral parts, {f,i} = modf(x) nearbyint round to nearest integer nextafter nextafter(x,y) == next value following x in the direction of y nexttoward nexttoward(x,y) == next value following x in the direction of y nrand pseudo-random normal (Gaussian) -6.0 <= nrand() < 6.0 pow exponentiation, x**y == pow(x,y) rand pseudo-random integer, 0 <= rand() <= RAND_MAX remainder remainder(x,y) == remainder of dividing x by y remquo remainder and part of quotient, {r,q} = remquo(x,y) rint round to nearest integer round round to nearest integer row cell row number scalbln scalbln(x,e) produces x * (FLT_RADIX**e) scalbn scalbn(x,e) produces x * (FLT_RADIX**e) sin sine sinh hyperbolic sine sqrt square root tan tangent tanh hyperbolic tangent tgamma gamma function time time in seconds since 00:00:00 UTC, January 1, 1970 trunc round to integer, towards zero Range functions: avg average of the defined cells count number of cells defined dot dot product (inner product) of two ranges feval val=feval("type",cr,x), evaluate parameterized function find {n,cr}=find(xr,value), find value in range llsq {rank,cr}=llsq("type",xr,yr), linear least squares majority non-zero if majority of defined cells are non-zero max maximum of the defined cells min minimum of the defined cells prod product of the defined cells search {xr}=search(f,x0[,dx[,x1...xN]]), search for minimum of f(xr) stats {a,s,l,h}=stats(...), avg, stdev, min, and max of the defined cells stdev standard deviation of the defined cells sum sum of the defined cells var variance of the defined cells Commands: byrows|bycols - set default direction copy [byrows|bycols] dest_range src_range Copy [byrows|bycols] dest_range Cell(c,r) debug [on|off|level] eval [byrows|bycols] [range|symbols] [number_of_iterations] exit fill [byrows|bycols] range - truth-table fill [byrows|bycols] range start_expr [,increment_expr] - linear scale Fill [byrows|bycols] range start_expr [,ratio_expr] - geometric scale fill [byrows|bycols] range { expr_list } fill [byrows|bycols] range "fmt", "start", increments... - date/time format A0|RC|CR - formula printing format format [col|row|colspan|rowspan|cell|range]... "fmt_string" format symbols [sym]... "fmt_string" headers on|off help - print list of operators, functions, commands and constants help ["what"] - print help matching string hide all|col|row|colspan|rowspan|cell|range... - hide cols or rows hide symbols all|sym... - hide symbols output "fname" - redirect output to a file plot|plot2d|plot3d ["fname"] [byrows|bycols] [range] print ["fname"] [byrows|bycols] [range] [all|constants|... quit reset [range|symbols] - set formulas to unevaluated state show all|col|row|colspan|rowspan|cell|range... - unhide cols or rows show symbols all|sym... - unhide symbols sort [byrows|bycols] range [uniq [count]] - sort values srand expr - initialize the pseudo-random number generator while(expr) { commands... } - repeat commands Constants: HUGE_VAL = inf DBL_EPSILON = 2.22045e-16 RAND_MAX = 2147483647 AUTHOR Rick Perry, perry@misty.com ss version 1.07 2014-06-26 SS(1)