What is this?
This calculator has been my summer project. Please do play around with it and let me know if there's anything that's
broken. I set myself the challenge of doing it in C without any dependencies (including the standard library!). I
have succeeded in having all the math and display code within this constraint, while the buttons and window
management
is handled by raylib.
How do I use it?
Most of the buttons behave exactly as they would on a standard scientific calculator. There are a couple that do not
however, these will be laid out below:
- Up and down buttons: These will navigate you to the next start or end parenthesis
- Log and Root: These work as you would expect, but the syntax is a bit weird. For roots, it's index, then symbol,
then radicand. For log, it's base, then symbol, then the argument.
- 2nd: This brings up the second functionality of buttons, which at the moment, are only letters replacing the
numbers.
- SBSC: This is the 'subscript' button. It will allow you to type a number or letter as a subscript. These attach
to variables and allow you to more conveniently input expressions.
- RST: 'Reset' button, does nothing in this demo. It is a placeholder button for the physical version I'm going to
make.
-
EXPD: 'Expand' button. This will expand out then collect the expression entered. Can be used to evaluate
expressions without variables.
-
RAR: 'Rearrange' button. Input an equation, specify which variable is being rearranged for, then click any
button
other than letters/numbers/movement to run.
- GTRT: 'Get Roots' button. Will find and display all roots of the current univariate polynomial expression.
- SLV: 'Solve' button. This will prompt for values for any variables present in the current expression, then
solves. Use 'EXPD' rather than this if there are no variables in the expression.
-
DEG: This calculator uses radians for trigonometric functions by default, so putting this symbol after a number
will convert that number to radians before doing anything.
What is an error?
This is still buggy at the moment, so I'd greatly appreciate becoming aware of bugs that are found and the inputs
that caused them. The following behaviors
should be considered bugs:
-
If the screen goes blank for a long time or the page freezes, this is likely either a segfault or an infinite
loop. Neither are wanted behavior.
-
There is code in this calculator to catch invalid expressions (e.g. '3+*7) before they are run. An error is then
shown to the user. If any of the solving buttons works on an invalid expression, that should be considered a
bug.
-
If the solution that anything spits out is incorrect, that is obviously a bug.
Return to calculator