4.4BSD/usr/src/contrib/calc-1.26.4/help/config

Configuration parameters

	Configuration parameters affect how the calculator performs certain
	operations, and affects all future calculations.  These parameters
	affect the accuracy of calculations, the displayed format of results,
	and which algorithms are used for calculations.  The parameters are
	read or set using the "config" built-in function.  The following
	parameters can be specified:

		"trace"		turns tracing on or off (for debugging).
		"display"	sets number of digits in prints.
		"epsilon"	sets error value for transcendentals.
		"maxprint"	sets maximum number of elements printed.
		"mode"		sets printout mode.
		"mul2"		sets size for alternative multiply.
		"sq2"		sets size for alternative squaring.
		"pow2"		sets size for alternate powering.
		"redc2"		sets size for alternate REDC.

	The use of the trace flag is for debugging, and its meaning may
	change in the future.  A value of 1 causes the calculator to print
	its internal opcodes as it executes functions.  A value of zero
	disables tracing again.

	Display specifies how many digits after the decimal point should
	be printed when printing real or exponential numbers.  The initial
	display value is 20.  This parameter does not affect the accuracy
	of a calculation, since it only has meaning when printing results.

	Epsilon specifies the required precision of calculations by
	setting the maximum allowed error for transcendental functions.
	The error is an absolute error value for many functions, but
	for some functions it is a relative error.  The initial value
	is 1e-20.  Functions which require an epsilon value accept an
	optional argument which overrides this default epsilon value for
	that single call.  The built-in function "epsilon" also can be
	used to read or set this value, and is provided for ease of use.

	Mode specifies how numbers should be printed.  Mode is a string
	value indicating the printout method.  The initial mode is "real".
	Possible modes are:

		"frac"		decimal fractions
		"int"		decimal integer
		"real"		decimal floating point
		"exp"		decimal exponential
		"hex"		hex fractions
		"oct"		octal fractions
		"bin"		binary fractions

	Maxprint specifies the maximum number of elements to be displayed
	when a matrix or list is printed.  The initial value is 16 elements.

	Mul2 and sq2 specify the sizes of numbers at which calc switches
	from its first to its second algorithm for multiplying and squaring.
	The first algorithm is the usual method of cross multiplying, which
	runs in a time of O(N^2).  The second method is a recursive and
	complicated method which runs in a time of O(N^1.585).  The argument
	for these parameters is the number of binary words at which the
	second algorithm begins to be used.  The minimum value is 2, and
	the maximum value is very large.  If 2 is used, then the recursive
	algorithm is used all the way down to single digits, which becomes
	slow since the recursion overhead is high.  If a number such as
	1000000 is used, then the recursive algorithm is never used, causing
	calculations for large numbers to slow down.  For a typical example
	on a 386, the two algorithms are about equal in speed for a value
	of 20, which is about 100 decimal digits.  A value of zero resets
	the parameter back to its default value.  Usually there is no need
	to change these parameters.

	Pow2 specifies the sizes of numbers at which calc switches from
	its first to its second algorithm for calculating powers modulo
	another number.  The first algorithm for calculating modular powers
	is by repeated squaring and multiplying and dividing by the modulus.
	The second method uses the REDC algorithm given by Peter Montgomery
	which avoids divisions.  The argument for pow2 is the size of the
	modulus at which the second algorithm begins to be used.

	Redc2 specifies the sizes of numbers at which calc switches from
	its first to its second algorithm when using the REDC algorithm.
	The first algorithm performs a multiply and a modular reduction
	together in one loop which runs in O(N^2).  The second algorithm
	does the REDC calculation using three multiplies, and runs in
	O(N^1.585).  The argument for redc2 is the size of the modulus at
	which the second algorithm begins to be used.

	Examples of setting some parameters are:

		config("mode", "exp");		exponential output
		config("display", 50);		50 digits of output
		epsilon(epsilon() / 8);		3 bits more accuracy