BigInteger Calculator Commands

For more details see the calculator source code and the Java BigInteger API documentation.

In the following descriptions a1,a2,a3 represent arguments on the stack, s represents an arbitrary sequence of non-whitespace characters, and num represents an integer number.

Special Commands		Description
----------------		-----------
history				display command history
!!				recall previous command
!num				recall command number num
a1 = s				assign a name to top of stack
#				comment to end-of-line
++				add one to top of stack
--				subtract one from top of stack
;				display stack
clear				clear stack
Clear				clear stack and output TextArea
clean				clear stack and symbol table
Clean				clear stack, symbol table, command history, and output TextArea

a1 a2 IDEAadd			International Data Encryption Algorithm addition
a1 IDEAaddInverse		IDEA additive inverse
a1 a2 IDEAmul			IDEA multiplication
a1 IDEAmulInverse		IDEA multiplicative inverse

x y p a ECmul2			Elliptic Curve multiply by 2. Curve is: y2 = x3+ax+b (mod p)
x y d p a ECmul			EC scalar multiply: d*(x,y)
x1 y1 x2 y2 p a ECadd		EC point addition: (x1,y1)+(x2,y2)

a1 a2 Euclid			Euclid's algorithm for gcd and modInverse
a1 cubeRoot			cube root, if one exists, otherwise 0
a1 sqrt				square root, if one exists, otherwise 0

dup				duplicate top of stack
end				end if or while statement
exit				exit the calculator
a1 factorial			factorial
a1 font				set font size
if				if ... [else] ... end|end-of-line
a1 milk				order kegs of milk
pop				remove top of stack
quit				exit the calculator
repeat				repeat ... until
run s				execute commands from file
echo [on|off] 			control whether commands are displayed
save				write output window to file ~/Calc.out
size				push stack size onto stack
swap				swap top two elements of stack
tic				start millisecond stopwatch timer
toc				read the millisecond stopwatch timer
until				repeat ... until
while				while ... end|end-of-line
who				display the symbol table

Calculator			Java Equivalent
----------			---------------
a1 a2 prime			new BigInteger(a1,a2,random)
a1 rand				new BigInteger(a1,random)
a1 BigInteger s			new BigInteger(s,a1)
a1 abs				a1.abs()
a1 a2 add			a1.add(a2)
a1 a2 +				a1.add(a2)
a1 a2 and			a1.and(a2)
a1 a2 &				a1.and(a2)
a1 a2 andNot			a1.andNot(a2)
a1 bitCount			a1.bitCount()
a1 byteValue			a1.byteValue()
a1 byteValueExact		a1.byteValueExact()
a1 bitLength			a1.bitLength()
a1 a2 clearBit			a1.clearBit(a2)
a1 a2 compareTo			a1.compareTo(a2)
a1 a2 <				a1.compareTo(a2) < 0
a1 a2 <=			a1.compareTo(a2) <= 0
a1 a2 >				a1.compareTo(a2) > 0
a1 a2 >=			a1.compareTo(a2) >= 0
a1 a2 divide			a1.divide(a2)
a1 a2 /				a1.divide(a2)
a1 a2 divideAndRemainder	a1.divideAndRemainder(a2)
a1 doubleValue			a1.doubleValue()
a1 a2 equals			a1.equals(a2)
a1 a2 ==			a1.equals(a2)
a1 a2 !=			!a1.equals(a2)
a1 a2 flipBit			a1.flipBit(a2)
a1 floatValue			a1.floatValue()
a1 a2 gcd			a1.gcd(a2)
a1 getLowestSetBit		a1.getLowestSetBit()
a1 hashCode			a1.hashCode()
a1 intValue			a1.intValue()
a1 intValueExact		a1.intValueExact()
a1 a2 isProbablePrime		a1.isProbablePrime(a2)
a1 longValue			a1.longValue()
a1 longValueExact		a1.longValueExact()
a1 a2 max			a1.max(a2)
a1 a2 min			a1.min(a2)
a1 a2 mod			a1.mod(a2)
a1 a2 %				a1.mod(a2)
a1 a2 modInverse		a1.modInverse(a2)
a1 a2 a3 modPow			a1.modPow(a2,a3)
a1 a2 multiply			a1.multiply(a2)
a1 a2 *				a1.multiply(a2)
a1 negate			a1.negate()
a1 nextProbablePrime		a1.nextProbablePrime()
a1 not				a1.not()
a1 ~				a1.not()
a1 a2 or			a1.or(a2)
a1 a2 |				a1.or(a2)
a1 a2 pow			a1.pow(a2)
a1 a2 **			a1.pow(a2)
a1 probablePrime		BigInteger.probablePrime(a1,random)
a1 a2 remainder			a1.remainder(a2)
a1 a2 setBit			a1.setBit(a2)
a1 a2 shiftLeft			a1.shiftLeft(a2)
a1 a2 <<			a1.shiftLeft(a2)
a1 a2 shiftRight		a1.shiftRight(a2)
a1 a2 >>			a1.shiftRight(a2)
a1 shortValue			a1.shortValue()
a1 shortValueExact		a1.shortValueExact()
a1 signum			a1.signum()
a1 a2 subtract			a1.subtract(a2)
a1 a2 -				a1.subtract(a2)
a1 a2 testBit			a1.testBit(a2)
a1 toByteArray			a1.toByteArray()
a1 a2 toString			a1.toString(a2)
a1 valueOf			BigInteger.valueOf(a1)
a1 a2 xor			a1.xor(a2)
a1 a2 ^				a1.xor(a2)