NAME
Math::Logic::Ternary::Calculator::Manual - user manual for tcalc
VERSION
This documentation refers to version 0.004 of tcalc.
SYNOPSIS
tcalc
tcalc 81
tcalc 27 1
perl -MMath::Logic::Ternary::Calculator -e 'tcalc(27, 1)'
tcalc [word_size [arith_mode]]
DESCRIPTION
The ternary calculator tcalc is an interactive demonstration application for the perl library Math::Logic::Ternary.
It reads input line by line and tries to parse each line as either a command, an operator with operands, or operands alone.
Results are stored in a dynamically growing list of numbered values that can be used in subsequent operations.
Commands
?-
Help. A question mark alone displays a list of available commands. A question mark followed by a command name or an operator name displays help about that particular command or operator.
?#-
List numbered values of the current session.
?=-
List named values of the current session.
/ops-
/opslists all operators./ops nlists all operators of kind n, where n is a small integer ranging from 0 to 3. /license-
/licensedisplays a license and copyright notice. /version-
/versiondisplays version information. /size-
/sizedisplays the word size of this session. /mode-
/modedisplays the current arithmetic mode./mode nchanges the arithmetic mode to n, where valid modes are 0 = balanced, 1 = unbalanced, 2 = base(-3).Note that while in the library arithmetic operators have suffixes denoting their type of arithmetic, operator names in the calculator have no suffix. The calculator will use the variant matching the current arithmetic mode.
Stored operands keep their trits, but generally not their numeric value when the arithmetic mode is changed, as the mode also determines the numeral system in use.
/def-
/def name valuestores a value under a name. This makes=namea valid operand. /reset-
/resetdiscards all stored values./reset 1discards all numbered values./reset 2discards all named values. /range-
/rangereturns two words: the smallest and largest possible integer (dependent on word size and arithmetic mode). /rand-
/randreturns a random word. /abc-
/abc nreturns n words covering all trit combinations when used as operands of tritwise operators. The word size has to be at least 3 ** n. The trit order is affected by the arithmetic mode.Example:
/abc 2returns@fffnnntttand@fntfntfntwhen in balanced mode. /quit-
/quitcloses the session.
SEE ALSO
Math::Logic::Ternary - the library.
Math::Logic::Ternary::Calculator - implementation details.
AUTHOR
Martin Becker <becker-cpan-mp@cozap.com>
COPYRIGHT AND LICENSE
Copyright (c) 2012-2017 by Martin Becker, Blaubeuren. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.0 or, at your option, any later version of Perl 5 you may have available.