Calculator
[START]
A few people requested I do more "life-useful" screens, in particular a Calculator.
I regret doing this, as the amount of work that went in to this screen was enough to be a program on it's own.
As such, there will be no more "life-useful" screens, just cell phone and tablet relevant functionality.
I could not just make a simple calculator, no. That would be too easy. There's no point to doing something if I'm not doing it better than (most of) what you can get on the app store as it is. As such, I made a full equation evaluator.
I could have just used Google Calculator or Wolfram Alpha, but that would have required an internet connection. I also could have used the one in the webview, but that would limit me to javascript and it's horribleness.
However, due to the sheer amount of user input this screen can take, it may crash. If it does, please send me the full equation you used.
This screen has the following sub-screens:
NUM - A virtual keyboard for entering numbers and operands
The = sign does not solve the equation, as some equations can use = in it. You must click the OK button to solve.
<ı ı> DEL and BKSP act the same way as on the regular keyboard. CLR erases all text
TXT - Brings up the regular keyboard for more complex text entry
If you're trying to enter a string into your equation, it must be encapsulated within a single (') or double quote (") otherwise it will be treated as a variable name
The OK button solves the equation, just as it does in the NUM screen. The CNCL button goes back to the NUM screen, as does clicking the left sidebar (which usually acts as the back button)
VAR - This will allow you to insert variables (such as PI) or functions (such as SIN) into your equation quicker than typing them
Angle Mode: This will let you choose if you're working in radians, degrees or gradients
Variable Type: Choose which variable type (Constants, Numbers, Booleans, Strings, Custom, Internal and external functions/subroutines) you want to work with
Variable Name: Choose which variable/sub from a list to insert it into the equation
Insert Variable: If you're working with INT. or EXT. SUBS, it will go to the Functions sub-screen. Otherwise it inserts the variable into the equation.
Edit Variable: This will go to the variable editing sub-screen
Return to Sub: If you were working on a function(parameters), this will let you go back to the Functions sub-screen.
ANS - This will show you a history of equations you've entered. Pressing CLEAR will erase it.
GRF - This will allow you to graph an equation using the following parameters
Equation: Using the X coordinate as a parameter, the result will be the Y coordinate. Do not include "Y=" in the equation.
Increment: Normally 1. But you can skip numbers by using a higher increment
Start X: Normally 0. But you can start the graph with a higher number
Finish X: Normally any number above Start X. This will determine how many points to plot on the graph.
View: View the resulting graph
Functions - This will allow you to edit the parameters of a function/sub before inserting it into the equation
Insert Sub: Inserts the function(parameters) into the equation
Remove Sub: Removes the function you were working on, and returns to the equation
Parameter list: Clicking a parameter will let you edit it's value. If the value starts with a ' or ", it will have the same character automatically appended to the end for quicker text entry
Variable editing - This will allow you to make or edit variables
Mode - This chooses between making a new variable or editing an existing one
Variable Type - This chooses which variable type you will be working with
(Changing Mode or Type will erase any of the below options and start over)
Variable Name - If you're making a new variable, it will let you type the name, please don't use symbols in the name. Otherwise it will show a list of all the variables of the type you've selected that you can edit
Save Variable - Save the changes you've made
Delete Variable - Deletes the variable you are working with
Is a Constant - If you are not making a sub, you can choose if you want to lock the variable's value or not
Equation - If you are making a sub, you can edit it's equation
Add Value - Adds a value or parameter to the variable.
You must have a minimum of 1. If you are not making a sub, and have more than one value the variable will be treated as an array
Clicking a value will allow you to edit or delete it
Parameter editing - This will let you edit parameters for a custom sub
Name - This lets you edit the name of the parameter, use this name in the equation, please don't use symbols in the name
Parameter Type - This lets you select the variable type of the parameter
Default Value - This lets you select the parameter's default value, to make it optional. All parameters after an optional one must also be optional
Save Parameter - Save the parameter and return to the variable editing screen
Delete Parameter - Delete the parameter (if it's not the last one) and return to the variable editing screen
You cannot have 2 parameters for the same sub sharing the same name
The equation evaluator follows the rules of BEDMAS. With Boolean math being calculated before exponents
The standard operands +,-,*,/ work, as well as ^ (exponents) comparators such as =,<,> and boolean operations such as & (AND) | (OR) and % (MODULUS)
C++ operands such as == (set) -= (minus inc) and += (plus inc) also work, but only once per equation to set the first variable given
+ and & will concatenate two strings together, and ~ will compare two strings ignoring case
If two values or variables are next to each other (separated by a space) without an operand in between, it will be treated as a multiplication
It can now use percents.
ie: 100 - 50% (it's equivalent to 100 * 0.5), 100 + 50% (100 * 1.5), 100 / 50% (100 * 1/0.5), 100 * 50% (100 * 0.5)
The calculator is not case sensitive
It also accepts a few text commands
Accepted [VAR]iable types are NUM, TXT, BOOL, but you can make your own with:
TYPE [VAR TYPE NAME] (LIST OF MEMBERS)
Members must be in the form of [NAME] as [VAR TYPE], separated by a comma. Only the built in (NUM,TXT,BOOL) types can be used for members
Example:
TYPE POINT(X as NUM, Y as NUM)
DIM TEMP as point
TEMP.X = 34
CONST [VAR NAME] as [VAR TYPE] = [VALUE]
This allows you to make a constant like Pi, and the system won't allow the value to be changed afterwards
DIM [VAR NAME] as [VAR TYPE] = [VALUE]
This allows you to make a variable that can be changed later
To enter an array as a [VALUE], it must be in brackets and each value separated by a comma
Example: DIM TEST AS NUM = (2, 4, 654, 45)
To enter text as a value, it must be encapsulated in a single or a double quote.
Example: DIM TEST AS TXT = ("test", "ing", "the", "strings")
To access a specific cell of an array in a formula, you'd use: TEST(3) for example
FUNCT [VAR NAME] = Equation (Parameters)
This allows you to make a function
Parameters must be entered in the same format as a member list, with one exception.
You can make optional parameters by adding a default value
Example: FUNCT TPoint = x*y (X as num, Y as NUM = 5)
Then to use it in the equation, either use the VAR sub screen or type something like: TPoint(3, 4)
It also supports some specific voice commands, which cannot be typed in:
[VAR NAME] equals [VALUE]
This makes/sets a variable to value
Remember when saying large numbers not to say "and", as that is an operand
Exponents are done by saying "power" (small words like "to", "the", and "of" are simply filtered out)
You can say "squared" or "cubed" to do ^2 or ^3 quickly
Decimals are done by saying "point"
Most things I've tried to make obvious/natural, like square root is just "square root", it accepts multiple words like "times", "multiplied by", "minus", "subtract", "add", "plus"
This screen supports voice recognition at all times within the program
Any phrase starting with the words "what's/what is" will be treated as a math question
There will however by some confusion, as Android's voice recognition system won't always change words (two or to) into numbers
Help on using the onscreen keyboard
Help on using Voice Recognition
This screen supports April Fools mode
[END]