24 posts
Location
England, Europe, Earth, Solar System, Milky Way, Local Cluster, Local Supercluster, Observable Universe, Universe, Local Multiverse... this could go on forever
Posted 26 June 2015 - 07:46 PM
This is just a simple calculator I wrote. Tell me if it works ok for you, and if you find anything wrong with it please tell me!
This just includes addition, subtraction, multiplication and division.
pastebin code: pastebin get 3xb5hiGh calculator
This is my first code, and works on anything, pocket computer, computer or monitor
Updated Maths, with in built monitor functionality: pastebin get Qd5Ex2hE calculator.
Edited on 28 June 2015 - 06:13 PM
2679 posts
Location
You will never find me, muhahahahahaha
Posted 26 June 2015 - 09:57 PM
Well, I noticed several thing:
Edited on 26 June 2015 - 07:58 PM
24 posts
Location
England, Europe, Earth, Solar System, Milky Way, Local Cluster, Local Supercluster, Observable Universe, Universe, Local Multiverse... this could go on forever
Posted 26 June 2015 - 10:59 PM
Well, I noticed several thing:
I did test it, it worked fine for me. As for the complex equation, it is a simple calculator. It only works with simple equations. And before you go are you sure that it works with only simple equations, yes I am. I tried brackets with it and it came up with an arthmic error.
And for the pastebin code, you can put any name in for it. I called mine maths.
EDIT: By simple equation I mean x +,-,/,* y. In the code you see print( x func y ). I will try to expand it when I can, but keep in mind this is my first piece of fully functional code.
Edited on 26 June 2015 - 09:03 PM
7083 posts
Location
Tasmania (AU)
Posted 27 June 2015 - 01:38 AM
(Did you even test the calculator, should have errored right away!)
Did
you?;)/>
656 posts
Posted 28 June 2015 - 11:49 AM
(Did you even test the calculator, should have errored right away!)
Did
you?;)/>/>
From the
lua manual about arithmetic operators:
If the operands are numbers, or strings that can be converted to numbers (see §2.2.1), then all operations have the usual meaning.
Basically,
"10"/"2" == 5
Quite a unique but confusing feature, as comparing numbers and strings doesn't work.
24 posts
Location
England, Europe, Earth, Solar System, Milky Way, Local Cluster, Local Supercluster, Observable Universe, Universe, Local Multiverse... this could go on forever
Posted 28 June 2015 - 08:34 PM
New calculator program:
pastebin get HgDJ5zJY calculator
673 posts
Posted 07 July 2015 - 03:57 PM
Edit your main post instead of putting updates in replies
2427 posts
Location
UK
Posted 07 July 2015 - 10:35 PM
Edit your main post instead of putting updates in replies
Updates don't bump the thread, and by posting a reply you can track changes. Updates are also one of the only types bump that is allowed on the forums.
Personally I do both, update the OP and add a reply with only the change (usually doing a part quote of my self)
Edited on 07 July 2015 - 08:37 PM
8543 posts
Posted 08 July 2015 - 12:45 AM
Adding a reply is fine as long as it's substantive. If you just post "bump", or similar things, the post is likely to be deleted just like other entirely useless posts.
673 posts
Posted 09 July 2015 - 01:50 PM
Putting a reply is fine, but it's probably smart to update the original post with any information or new pastes aswell.
24 posts
Location
England, Europe, Earth, Solar System, Milky Way, Local Cluster, Local Supercluster, Observable Universe, Universe, Local Multiverse... this could go on forever
Posted 10 July 2015 - 11:12 PM
^ To all the above: First off, I had no intention of bumping the thread. This is not the best piece of code, and besides, bumping it doesnt get me any brownie points.
Second: I will update the main post now along with reply posts. Thank you for reminding me
818 posts
Location
Wherever you want me to be
Posted 19 July 2015 - 12:34 PM
pastebin code: pastebin get 3xb5hiGh calculator
yeah, i love pastebin codes.