Skip to content

A tiny calculator for the terminal. Featuring binary ops and branches. Tested on OSX x64 and Linux 32bit. 8k on osx x64, linked statical with minilib. Only whole numbers(!), no fractions.

License

Notifications You must be signed in to change notification settings

michael105/calcit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#calcit (calc)



Part of an expression parser and calculator.

This is a standalone version.

Currently I'm about to rewrite some things,
the ongoing work is in calc2.c

Originally I did want to implement the option of having
arithmetic expressions in config files, and to parse and compile them.
(For things like: if the mouse movement is faster than x/second, 
speed up with 2*x..)

Didn't write the config parser yet.

The recursive calculation has been a special pain in the ass.

It's tiny - 8k at OSX, compiled statically with minilib (optional)


6.3k linked statically with minilib, linux x64.


Working: (calc)
+ - * / 
% ^ $  	  ( Modulo, Power,  unsigned power-  ipowerui)
& | ! ~ X (Binary ops: ~ is bitwise not,  X is XOR)
L R 		  Shift left / right
< >       evals left side / right side, gives smaller / bigger value
=				  1, if equal


All operations are in integer mode, so no floating point yet.
Originally I did want to have some sort of scripting available for config files.



------


So, now there's also 'hal300'...
Not finished yet. 
But at least able to spit out the results in decimal, hex, oct and binary.

There might be the possibility to store functions.
I forgot the syntax.

calc.c, and calc2.c/libcalc.c do have different approaches.

Both are recursive, but while calc.c uses a case statement,
the latter ones do have jumptables.

The current version of linenoise didn't work, some trouble
with the columns.

Here's a fixed one.

BSD License.


misc 2013-2023
misc23 at posteo dot net
subtract 16 from 23

About

A tiny calculator for the terminal. Featuring binary ops and branches. Tested on OSX x64 and Linux 32bit. 8k on osx x64, linked statical with minilib. Only whole numbers(!), no fractions.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published