Cleanup help texts

This commit is contained in:
Carsten Larsen 2017-07-21 01:25:08 +02:00
parent 4aae661801
commit c625ec29f7
5 changed files with 77 additions and 48 deletions

117
amath.1
View File

@ -24,35 +24,23 @@
.SH NAME
amath \- Simple command line calculator
.SH SYNOPSIS
\fC[ --noansi ] [ --shell | expression ]\fP
\fC[ \fB--noansi\fR ] [ \fB--shell\fR |
.IR expression
]
.SH DESCRIPTION
amath(1) features a case sensitive command line interface, internal
IEEE 754 calculations with 15 significant digits, calculations with
real and complex numbers, variables and user defined functions,
logarithmic and exponential functions, trigonometric and hyperbolic
function and selected mathematical constants and rounding functions.
.SH Statements
.nf
clear Clear console window
def Define function
delete Delete variable or function
digits Set number of significant digits
eval Evaluate arithmetic expression
execute Execute statements in a file
functions Show list of user defined functions
input Change numeral input system
help Show basic help text
output Change numeral output system
list Show content of a directory
show Show content of a file
load Load variable and functions from file
save Save variable and functions to file
variables Show list of variables
version Show version string
memory Show internal memory usage
exit Exit program
.fi
.SH Operators
.SH OPTIONS
.TP
.BR \-\-noansi
Disable output of ANSI escape codes. Default is enable.
.TP
.BR \-\-shell
Open an interactive shell.
.SH OPERATORS
.nf
+ Mathematical addition
- Mathematical subtraction
@ -61,14 +49,15 @@ exit Exit program
^ Mathematical exponentiation
= Assignment of variable values
| Absolute value of number
.SH Variables and constant
.fi
.SH VARIABLES AND CONSTANT
.nf
pi Trigonometric constant
e Euler's number
i Imaginary unit
ins Result of last calculation
.fi
.SH Base functions
.SH MISCELLANEOUS FUNCTIONS
.nf
abs Absolute value of number
sgn Mathematical signum function
@ -82,7 +71,7 @@ lb Binary logarithm function (base 2)
ln Natural logarithm function (base e)
lg Common logarithm function (base 10)
.fi
.SH Trigonometric functions
.SH TRIGONOMETRIC FUNCTIONS
.nf
sin Trigonometric sine function
cos Trigonometric cosine function
@ -103,7 +92,7 @@ arccrd Inverse trigonometric chord function
arcexsec Inverse trigonometric exsecant function
arcexcsc Inverse trigonometric excosecant function
.fi
.SH Hyperbolic functions
.SH HYPERBOLIC FUNCTIONS
.nf
sinh Hyperbolic sine function
cosh Hyperbolic cosine function
@ -118,7 +107,7 @@ arccoth Inverse hyperbolic cotangent function
arcsech Inverse hyperbolic secant function
arccsch Inverse hyperbolic cosecant function
.fi
.SH Early trigonometric functions
.SH EARLY TRIGONOMETRIC FUNCTIONS
.nf
ver Versed sine function
vcs Versed cosine function
@ -137,7 +126,52 @@ archvc Inverse haversed cosine function
archcv Inverse hacoversed sine function
archcc Inverse hacoversed cosine function
.fi
.SH Example script
.SH STATEMENTS
.nf
clear Clear console window
def Define function
delete Delete variable or function
digits Set number of significant digits
eval Evaluate arithmetic expression
execute Execute statements in a file
functions Show list of user defined functions
input Change numeral input system
help Show basic help text
output Change numeral output system
list Show content of a directory
show Show content of a file
load Load variable and functions from file
save Save variable and functions to file
variables Show list of variables
version Show version string
memory Show internal memory usage
exit Exit program
.fi
.SH EXIT STATUS
amath(1) exits 0 on success and >0 if an error occurs.
.SH EXAMPLES
Add two numbers:
.RS
$ amath 1.3 + 2.6
.RE
.PP
Find cosine of pi/2:
.RS
$ amath "cos(pi/2)"
.RE
.PP
Find square root of minus 25:
.RS
$ amath "sqrt(-25)"
.RE
.PP
Show only 5 digits of a division:
.RS
$ amath "digits 5;34/11"
.RE
.PP
Script block with functions:
.RS
.nf
round(1.5461);round(-1.5461);
ceil(43.5461);ceil(-43.5461);
@ -145,23 +179,17 @@ floor(39.9531);floor(-39.9531);
trunc(23.827);trunc(-23.827);
sqrt(100);sqrt(52.23);
.fi
.SH Example script with functions
.RE
.PP
Script block with user defined functions:
.RS
.nf
f(x)=x*2+1;
g(y)=y^2+y*1.5+2;
a=2;b=3;c=a+b;
vars;funcs;
f(2.2);c+1.1;
.fi
.SH Example script with complex numbers
.nf
cos(1+2i);
sin(1+2i);
tan(1+2i);
coth(1+2i);
sech(1+2i);
csch(1+2i);
.fi
.RE
.SH KNOWN BUGS
.IP \[bu] 2
If amath(1) is linked with system libraries (-lm) sometimes the real part
@ -172,10 +200,11 @@ coth() with complex numbers is inaccurate on the 14th digit.
https://amath.innolan.net/
.SH AUTHORS
.PP
Written by Carsten Sonne Larsen <cs@innolan.net>. The code in MemSet and
MemCopy is derived from software contributed to Berkeley by Mike Hibler and
Chris Torek. The code in complex calculations is derived from software
written by Stephen L. Moshier.
Written by Carsten Sonne Larsen <cs@innolan.net>. Floating point to string
conversion is based on software written by Ryan Juckett. The code in complex
calculations is derived from software written by Stephen L. Moshier. The code
in MemSet and MemCopy is derived from software contributed to Berkeley by
Mike Hibler and Chris Torek.
.SH COPYRIGHT
Copyright (c) 2014-2017 Carsten Sonne Larsen <cs@innolan.net>
.br

View File

@ -53,7 +53,7 @@ struct helptextdef
};
static const helptextdef helptexts[] = {
{ 0, symzero, "Enter command or expression to evaluate.#NEWLINE##SYNTAXHIGHLIGHT#Example: 2+3-cos(3)#NORMALTEXT##NEWLINE# #NEWLINE#More help is available for designated topics.#NEWLINE#----------------------------------------------------#NEWLINE#functions Base functions#NEWLINE#trigon Trigonometric functions#NEWLINE#hyper Hyperbolic functions#NEWLINE#early Early trigonometric functions#NEWLINE#complex Syntax for complex numbers#NEWLINE#statements Available statements#NEWLINE#operators Supported operators#NEWLINE#----------------------------------------------------#NEWLINE##SYNTAXHIGHLIGHT#Example: help trigon#NEWLINE#" },
{ 0, symzero, "Enter command or expression to evaluate.#NEWLINE##SYNTAXHIGHLIGHT#Example: 2+3-cos(3)#NORMALTEXT##NEWLINE# #NEWLINE#More help is available for designated topics.#NEWLINE#----------------------------------------------------#NEWLINE#functions Miscellaneous functions#NEWLINE#trigon Trigonometric functions#NEWLINE#hyper Hyperbolic functions#NEWLINE#early Early trigonometric functions#NEWLINE#complex Syntax for complex numbers#NEWLINE#statements Available statements#NEWLINE#operators Supported operators#NEWLINE#----------------------------------------------------#NEWLINE##SYNTAXHIGHLIGHT#Example: help trigon#NEWLINE#" },
{ 1, symoperator, "----------------------------------------------------#NEWLINE# + Mathematical addition#NEWLINE# - Mathematical subtraction#NEWLINE# * Mathematical multiplication#NEWLINE# / Mathematical division#NEWLINE# ^ Mathematical exponentiation#NEWLINE# = Assignment of variable values#NEWLINE# | Absolute value of number#NEWLINE#----------------------------------------------------#NEWLINE#" },
{ 2, symfunction, "----------------------------------------------------#NEWLINE#abs Absolute value of number#NEWLINE#sgn Mathematical signum function#NEWLINE#round Round to nearest integer number#NEWLINE#trunc Discard fraction part of number#NEWLINE#floor Mathematical floor function#NEWLINE#ceil Mathematical ceiling function#NEWLINE#sqrt Square root function (exp 1/2)#NEWLINE#cbrt Cube root function (exp 1/3)#NEWLINE#lb Binary logarithm function (base 2)#NEWLINE#ln Natural logarithm function (base e)#NEWLINE#lg Common logarithm function (base 10)#NEWLINE#----------------------------------------------------#NEWLINE##SYNTAXHIGHLIGHT#Example: round(1.55)#NORMALTEXT##NEWLINE#" },
{ 3, symtrigon, "----------------------------------------------------#NEWLINE#sin Trigonometric sine function#NEWLINE#cos Trigonometric cosine function#NEWLINE#tan Trigonometric tangent function#NEWLINE#cot Trigonometric cotangent function#NEWLINE#sec Trigonometric secant function#NEWLINE#csc Trigonometric cosecant function#NEWLINE#crd Trigonometric chord function#NEWLINE#exsec Trigonometric exsecant function#NEWLINE#excsc Trigonometric excosecant function#NEWLINE#asin Inverse trigonometric sine function#NEWLINE#acos Inverse trigonometric cosine function#NEWLINE#atan Inverse trigonometric tangent function#NEWLINE#acot Inverse trigonometric cotangent function#NEWLINE#asec Inverse trigonometric secant function#NEWLINE#acsc Inverse trigonometric cosecant function#NEWLINE#acrd Inverse trigonometric chord function#NEWLINE#aexsec Inverse trigonometric exsecant function#NEWLINE#aexcsc Inverse trigonometric excosecant function#NEWLINE#----------------------------------------------------#NEWLINE#Inverse functions can be prefixed with ar or arc#NEWLINE#instead of a.#NEWLINE#" },

View File

@ -117,7 +117,7 @@
memory Show internal memory usage
exit Exit program
\endverbatim
\subsection command_func Base functions
\subsection command_func Miscellaneous functions
\verbatim
abs Absolute value of number
sgn Mathematical signum function

View File

@ -42,7 +42,7 @@ static const char *about = NEWLINE NEWLINE
"functions, trigonometric and hyperbolic function and selected mathematical" NEWLINE
"constants and rounding functions." NEWLINE;
static const char *help =
"usage: amath [noansi] [shell|expression]" NEWLINE;
"usage: amath [ --noansi ] [ --shell | expression ]" NEWLINE;
static const char *copyright =
"Copyright (c) 2014-2017 Carsten Sonne Larsen <cs@innolan.net>";
static const char *license =

View File

@ -37,7 +37,7 @@
; ###################################################################################
; Introduction table - Symbol(0)
symzero (/500/)
Enter command or expression to evaluate.#NEWLINE##SYNTAXHIGHLIGHT#Example: 2+3-cos(3)#NORMALTEXT##NEWLINE# #NEWLINE#More help is available for designated topics.#NEWLINE#----------------------------------------------------#NEWLINE#functions Base functions#NEWLINE#trigon Trigonometric functions#NEWLINE#hyper Hyperbolic functions#NEWLINE#early Early trigonometric functions#NEWLINE#complex Syntax for complex numbers#NEWLINE#statements Available statements#NEWLINE#operators Supported operators#NEWLINE#----------------------------------------------------#NEWLINE##SYNTAXHIGHLIGHT#Example: help trigon#NEWLINE#
Enter command or expression to evaluate.#NEWLINE##SYNTAXHIGHLIGHT#Example: 2+3-cos(3)#NORMALTEXT##NEWLINE# #NEWLINE#More help is available for designated topics.#NEWLINE#----------------------------------------------------#NEWLINE#functions Miscellaneous functions#NEWLINE#trigon Trigonometric functions#NEWLINE#hyper Hyperbolic functions#NEWLINE#early Early trigonometric functions#NEWLINE#complex Syntax for complex numbers#NEWLINE#statements Available statements#NEWLINE#operators Supported operators#NEWLINE#----------------------------------------------------#NEWLINE##SYNTAXHIGHLIGHT#Example: help trigon#NEWLINE#
; Table of operators
symoperator (/400/)
----------------------------------------------------#NEWLINE# + Mathematical addition#NEWLINE# - Mathematical subtraction#NEWLINE# * Mathematical multiplication#NEWLINE# / Mathematical division#NEWLINE# ^ Mathematical exponentiation#NEWLINE# = Assignment of variable values#NEWLINE# | Absolute value of number#NEWLINE#----------------------------------------------------#NEWLINE#