A command-line calculator written in Fortran that handles arbitrary precision arithmetic, complex numbers, and matrices.
make./build/bin/fortbitefortbite> 2 + 3
5.0000000000000000
fortbite> 10 - 4 * 2
2.0000000000000000
fortbite> (10 - 4) * 2
12.000000000000000
fortbite> 2^8
256.00000000000000
fortbite> 27^(1/3)
3.0000000000000000
Specify output precision with ::digits
fortbite> pi
3.1415926535897931
fortbite> pi::10
3.1415926536
fortbite> pi::30
3.141592653589793115997963468544
fortbite> e::15
2.718281828459045
fortbite> x := 42
42.000000000000000
fortbite> y := x * 2
84.000000000000000
fortbite> x + y
126.00000000000000
fortbite> sin(pi/2)
1.0000000000000000
fortbite> cos(0)
1.0000000000000000
fortbite> atan(1) * 4
3.1415926535897931
fortbite> log(e)
1.0000000000000000
fortbite> log10(1000)
3.0000000000000000
fortbite> exp(1)
2.7182818284590451
fortbite> 2^10
1024.0000000000000
fortbite> sqrt(2)
1.4142135623730951
fortbite> factorial(5)
120.00000000000000
fortbite> floor(3.7)
3.0000000000000000
fortbite> ceil(3.2)
4.0000000000000000
fortbite> (3 + 4i) * 2
6.0000000000000000+8.0000000000000000i
fortbite> abs(3 + 4i)
5.0000000000000000
fortbite> conj(3 + 4i)
3.0000000000000000-4.0000000000000000i
fortbite> [1,2;3,4]
[2x2 matrix]
1.0000000000000000 2.0000000000000000
3.0000000000000000 4.0000000000000000
fortbite> A := [1,2;3,4]
[2x2 matrix]
1.0000000000000000 2.0000000000000000
3.0000000000000000 4.0000000000000000
fortbite> det(A)
-2.0000000000000000
fortbite> inv(A)
[2x2 matrix]
-2.0000000000000000 1.0000000000000000
1.5000000000000000 -0.50000000000000000
fortbite> eye(3)
[3x3 matrix]
1.0000000000000000 0.0000000000000000 0.0000000000000000
0.0000000000000000 1.0000000000000000 0.0000000000000000
0.0000000000000000 0.0000000000000000 1.0000000000000000
- Trigonometric:
sin,cos,tan,asin,acos,atan - Hyperbolic:
sinh,cosh,tanh - Logarithmic:
log,ln,log10,log2 - Exponential:
exp,exp2,exp10 - Rounding:
floor,ceil,round - Other:
sqrt,abs,factorial
realorre- real partimagorim- imaginary partconj- complex conjugatearg- phase anglecabs- complex absolute value
zeros(m,n)- zero matrixones(m,n)- matrix of oneseye(n)- identity matrixdet- determinantinv- inversetranspose- matrix transpose
pi- 3.14159...e- 2.71828...i- imaginary unit
- Basic:
+,-,*,/ - Power:
^or** - Assignment:
:= - Precision:
::
help- show command listexitorquit- exit the calculatorclear- clear screenvars- list defined variables
Run the test suite:
make testRun specific test categories:
make test-unit # Unit tests only
make test-integration # Integration tests only- Calculations use double precision by default
- The
::precision operator only affects output formatting, not internal precision - Variable names are case-sensitive
- Matrix operations require compatible dimensions