calc - Integer calculator
n calc "string"
calc can perform simple integer based calculations given by "string", where the "string" takes the following form:-
"[b]<s>"
Where 'b' is an optional letter setting the required output base which can be one of the following:
b - Binary
o - Octal
d - Decimal
x - Hexadecimal
Default when omitted is 'd' (decimal). "s" is the sum to be calculated, which should be bodmas in form. Following is a list of valid symbols.
(..) - Parentheses (contents calculated first)
! - Logical not
&& - Logical and
|| - Logical or
== - Logical equals
!= - Logical not equals
~ - Bitwise not
& - Bitwise and
| - Bitwise or
^ - Bitwise xor
/ - Divide
* - Multiply
% - Modulus
+ - Addition
- - Subtraction
0xNN - Hexadecimal number
0NN - Octal number
LR - Last calculation recall
Any MicroEmacs variables can be used in the calculation. The result of the calculation is stored in .calc.result(5). The argument n is a bitwise flag where:
0x01
0x02
When omitted the default argument is 1.
To calculate the number of hours in a year:
calc "365*24"
To then calculate the number of seconds in the year:
calc "LR*60*60"
calc is a macro defined in calc.emf.
(c) Copyright JASSPA 1999
Last Modified: 1999/02/28
Generated On: 1999/12/01