True Programmers Calculator (TPC)


About
Small Calculator
Graph Calculator
Big Calculator
Help
Examples
Download TPC

About

   True Programmers Calculator (TPC) is a project that I have been working on. it is just a simple calculator that lets you type a string and then it calculates it for you as you type. This new web version uses javascript, but the most powerful feature is the ability to write you own javascript function in the calculator windows.

 Enjoy.   Jeff Peters  jeffpeters (at) byu.edu
 Calculator ? X 
?
=

 Graph Calc ? X 
Function Source: Small Calc  Big Calc
x-Min:  x-Max:  x-Scale:
y-Min:  y-Max:  y-Scale:
Width:  Height:  Dot Size:
Connect Dots:


 True Programmers Calculator ? X 
?
=
;
Calculate:While editing   Operator Mode:Math JavaScript  

X Help

Examples
Operators
Functions
Numbers
Methods of Math
Properties of Number

Help Comming Soon

Operators^
OperatorDescriptionMode
^Exponential PowerOnly works while in
Operator Mode: Math*
!Factorial
@converts base10 to base2-36, (5@2=101)
#converts base2-36 to base10 (AB#16=171)
°converts degree to radian (180°=pi)
°°converts radian to degree (2*pi°°=360)
^^Bitwise XOR
!!Logical NOT
^Bitwise XOROnly works while in
Operator Mode: JavaScript*
!Logical NOT
+, -, *, /Add, Subtract, Multiply, DivedWorks in both modes
%Modulus, returns integer remainder from division
~, &, |Bitwise NOT, AND, OR
<<, >>, >>>Bitwise left shift, right shift, zero-fill right shift
&&, ||Logical AND, OR
++, --Incremnet, Decrement
?:if-else (boolean?true:false)
*if in JavaScript mode, you must call the functions to use Math Only Mode Operators
 JavaScript works in Math mode, but XOR, and NOT Operators are different

Functions^
NameDescription
calc(string)runs TPC on the string
quad(a,b,c)factors of quadric equation.
quad1(a,b,c)(-b+sqrt(b^2-4*a*c))/(2a)
quad2(a,b,c)(-b-sqrt(b^2-4*a*c))/(2a)
factors(n)factors of integer n
sumOfFactors(n)some of unique factors
fib(n)fibonacci number n
isPrime(i)true if n is prime
factorial(n)factorial of n
fromBase10(value,base)converts to base(2-36)
toBase10(string,base)convert from base(2-36)
log(base,value)log of value in the base
gcd(a,b)Greatest common divisor
lcm(a,b)Least common multiple
roundOffError(value,SignifanctDigits)roundOffError(_n,_p)
frac(value[,accuracy])convert number to a fraction, if it's a rational number
 (Also user defined functions)

Numbers^
OperatorDescription
pi3.141592653589793
e2.718281828459045
Phi(sqrt(5)+1)/2 (Golden Ratio)
phi1/Phi = (sqrt(5)-1)/2
_DIGITS"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"

Methods of Math^
MethodDescription
abs(n)Absolute value
sin(n), cos(n), tan(n)Standard trigonometric functions; argument in radians
acos(n), asin(n), atan(n)Inverse trigonometric functions; return values in radians
exp(n), log(n)Exponential and natural logarithm, base e
ceil(n)Returns least integer greater than or equal to argumen
floor(n)Returns greatest integer less than or equal to argument
min(n,...), max(n,...)Returns greater or lesser (respectively) of two arguments
pow(base,n)Exponential; first argument is base, second is exponent
round(n)Rounds argument to nearest integer
sqrt(n)Square root
random()a random number between 0 <= n < 1

Properties of Number^
MethodDescription
MAX_VALUEThe largest representable number
MIN_VALUEThe smallest representable number
NaNSpecial "not a number" value
NEGATIVE_INFINITYSpecial infinite value; returned on overflow
POSITIVE_INFINITYSpecial negative infinite value; returned on overflow

X Examples^

?454324.125@16
=6EEB4.2
^
?ABF3D.2A#16
=704317.1640625
^
?factors(32)
=32,16,2,8,4,1
^
?cos(pi/4)
=0.7071067811865476
^
?function myMethod(a,b)
{
return a*b;
}
myMethod(3,4);
=12
^
?function myMethod(a,b)
{
for (i=0;i<b;i++)
{
 a+=b;
}
return a;
}
myMethod(6,7);
=55
^
?function listprimes(start,end)
{
t="";
for (i=start; i<=end; i++)
 if (isPrime(i))
  t=t+""+i+",";
return t;
}
listprimes(1,25);
=1,3,5,7,11,13,17,19,23,
^
?2^4
=16 *in Math Mode
=6 *in JavaScript Mode
^

Jeff Peters 2003