Posted 10 October 2012 - 05:19 AM
This a text based calculator (Now has buttons too). It will evaluate mathematical expressions you type into it it and give the result. To evaluate an expression, simply type it in to the input box, and the result will be displayed. The calculator follows order of operations, and ignores spaces, so 2+ 7 is equivalent to 2 + 7 and 2+7. To open using the advanced mode use the argument "advanced" when running it.
The default operators are +, -, *, /, ^, % (modulo). It also has several built-in functions, most of the functions from the math library. Functions take a fixed number of arguments, and return the result. The built-in functions are below. Since most of the functions are from the standard lua math library, I'll only give details for the other ones:
You can set variables for temporary storage of expressions. A variable is a sequence of one or more letters. To set a variable, simply use the = operator to assign it. For example: example = 3+5
This will set the variable 'example' to the result of 3+5, which is 8. To use variables in an expression, just use the name. The expression 'example + 3' will now evaluate to 11. To remove a variable (although I'm not sure why you'd want to do that), just type delete variablename into the input box. It has 3 built-in constants as well, pi, e, and inf. These constants are like variables in that you can use them in expressions, but you cannot set their values.
The commands that you can enter into the input box (besides expressions) are:
You can also use button mode, which is a simple four-function calculator (with order of operations). To enter it, just run the calculator, or use the command "buttons" from the text mode. It doesn't support functions, constants, or variable, and it only has the four basic operators, +, -, *, and /. To use, simply move between buttons with the arrow keys, type in numbers and symbols, or in 1.45 PR1, click the buttons. Pressing enter while a button is selected (with the arrow keys) will press it. The <– button will remove the previous number or symbol, and the adv button will go to the advanced mode. To exit the calculator, just press CTRL.
If you encounter any bugs, report them here, and I'll fix them as soon as I can. Any feedback or suggestions are appreciated.
Link: http://pastebin.com/PJMGB559
Older versions:
Screenshots:
Button mode:
With color:
Changelog:
+ Released
v1.1
* Fixed the calculator identifying expressions as invalid if you use a - after a parentheses.
* Fixed the calculator as incorrectly determining some expressions including nested parentheses as mismatched.
v1.2
+ Added buttons mode.
* Fixed problem with creating custom operators file.
* Fixed error messages about variables displaying for incorrect symbols.
v1.3
+ You can now type in numbers and symbols on buttons mode.
+ In 1.45 PR1, basic colors. Messages are black, errors are red, the background is light gray.
+ In 1.45 PR1, mouse support for buttons mode.
+ Exit buttons mode with CTRL.
v1.3.1
+ Support for mouse in 1.45 PR3+
The default operators are +, -, *, /, ^, % (modulo). It also has several built-in functions, most of the functions from the math library. Functions take a fixed number of arguments, and return the result. The built-in functions are below. Since most of the functions are from the standard lua math library, I'll only give details for the other ones:
Spoiler
- sin(x)
- cos(x)
- tan(x)
- random(): Random number between 0 and 1; math.random()
- randomrange(min, max): Random integer between min and max; math.random(min, max)
- abs(x)
- acos(x)
- asin(x)
- atan(x)
- atan2(x, y)
- ceil(x)
- cosh(x)
- deg(radians)
- exp(x)
- floor(x)
- fmod(x)
- frexp(x)
- ldexp(x, y)
- log(x): Natural logarithm of x; math.log(x)
- logten(x): Base 10 logarithm of x; math.log(x, 10)
- logtwo(x): Base 2 logarithm of x; math.log(x, 2)
- logbase(x, base): Logarithm of x in base base; math.log(x, base)
- min(a, b ): Greater of a and b; math.min(a, b )
- max(a, b ): Greater of a and b; math.max(a, b )
- pow(x, y)
- rad(degrees)
- randomseed(seed)
- sinh(x)
- sqrt(x)
- tanh(x)
You can set variables for temporary storage of expressions. A variable is a sequence of one or more letters. To set a variable, simply use the = operator to assign it. For example: example = 3+5
This will set the variable 'example' to the result of 3+5, which is 8. To use variables in an expression, just use the name. The expression 'example + 3' will now evaluate to 11. To remove a variable (although I'm not sure why you'd want to do that), just type delete variablename into the input box. It has 3 built-in constants as well, pi, e, and inf. These constants are like variables in that you can use them in expressions, but you cannot set their values.
The commands that you can enter into the input box (besides expressions) are:
- delete <variable>: deletes the given variable
- vars: list all current variables
- get <name>: Tells you if name refers to a function, constant, or variable. If it refers to a constant or variable, displays the value.
- exit: exits the program.
- buttons: enters button mode.
You can also use button mode, which is a simple four-function calculator (with order of operations). To enter it, just run the calculator, or use the command "buttons" from the text mode. It doesn't support functions, constants, or variable, and it only has the four basic operators, +, -, *, and /. To use, simply move between buttons with the arrow keys, type in numbers and symbols, or in 1.45 PR1, click the buttons. Pressing enter while a button is selected (with the arrow keys) will press it. The <– button will remove the previous number or symbol, and the adv button will go to the advanced mode. To exit the calculator, just press CTRL.
If you encounter any bugs, report them here, and I'll fix them as soon as I can. Any feedback or suggestions are appreciated.
Link: http://pastebin.com/PJMGB559
Older versions:
Screenshots:
Spoiler
Text mode:Button mode:
With color:
Changelog:
Spoiler
v1.0:+ Released
v1.1
* Fixed the calculator identifying expressions as invalid if you use a - after a parentheses.
* Fixed the calculator as incorrectly determining some expressions including nested parentheses as mismatched.
v1.2
+ Added buttons mode.
* Fixed problem with creating custom operators file.
* Fixed error messages about variables displaying for incorrect symbols.
v1.3
+ You can now type in numbers and symbols on buttons mode.
+ In 1.45 PR1, basic colors. Messages are black, errors are red, the background is light gray.
+ In 1.45 PR1, mouse support for buttons mode.
+ Exit buttons mode with CTRL.
v1.3.1
+ Support for mouse in 1.45 PR3+