3790 posts
Location
Lincoln, Nebraska
Posted 21 December 2012 - 09:02 AM
After much trial and error, and some useful help from the Ask A Pro section, I have finally finished my Advanced Calculator.
It utilizes almost every function within the Lua math library, and can calculate quite accurately.
Features:- Easy to use GUI, with mouse support and number pad support.
- Large print display.
- Error handling - Almost completely idiot proof. You won't be able to break the program that easily.
Screenshots:Download:http://pastebin.com/nAinUn1hBugs:Cannot calculate infinity. Doing so causes an attempt to get length of nil error. YOu can't get the length of an infinite number. I have fixed this error. You can now calculate infinite numbers, as well as divide by 0.- Error is generated in calculating large numbers. When multiplying huge numbers, I cannot get the length of a non-terminating decimal number.
Let me know of any bugs you find, as I want this to become the number one calculator through ComputerCraft.
Edited on 28 December 2012 - 04:23 AM
212 posts
Location
Leeds, England
Posted 21 December 2012 - 09:06 AM
Not going to lie, that is pretty damn sexy! but it cant divide by zero… :P/>
3790 posts
Location
Lincoln, Nebraska
Posted 21 December 2012 - 09:18 AM
Not going to lie, that is pretty damn sexy! but it cant divide by zero… :P/>
Wow…. You instantly tried to divide by zero, and broke my calculator… You have mastered the art of destruction.
212 posts
Location
Leeds, England
Posted 21 December 2012 - 09:25 AM
Not going to lie, that is pretty damn sexy! but it cant divide by zero… :P/>
Wow…. You instantly tried to divide by zero, and broke my calculator… You have mastered the art of destruction.
what can I say, I'm on a mission to destroy the world as we know it through the course of division by zero :P/> that and pi ^_^/>
3790 posts
Location
Lincoln, Nebraska
Posted 21 December 2012 - 09:31 AM
what can I say, I'm on a mission to destroy the world as we know it through the course of division by zero :P/> that and pi ^_^/>
Well, I can confidently say that Pi does calculate on this program.
249 posts
Location
In the universe
Posted 21 December 2012 - 09:33 AM
Multiply 9999999999 by 9999999, broke it
Press random buttons, broke it (Well, every thing turned red)
Make a really long operation, it gets of screen
212 posts
Location
Leeds, England
Posted 21 December 2012 - 09:34 AM
yes it does ^_^/> even if by is an infinite variable :P/>
1054 posts
Posted 21 December 2012 - 09:37 AM
I love it. :)/>
3790 posts
Location
Lincoln, Nebraska
Posted 21 December 2012 - 09:37 AM
-_-/>
You guys are just finding ways to calculate infinity……
Lua hates infinity.
212 posts
Location
Leeds, England
Posted 21 December 2012 - 09:40 AM
Lua shouldnt be so finite then :P/>
3790 posts
Location
Lincoln, Nebraska
Posted 21 December 2012 - 10:38 AM
I have fixed the divide by zero error.
2217 posts
Location
3232235883
Posted 21 December 2012 - 10:44 AM
needs
tan
atan
atan2
acos
asin
an ON button
easter eggs
:3
249 posts
Location
In the universe
Posted 21 December 2012 - 10:44 AM
I have fixed the divide by zero error.
Still, error with LARGE numbers
3790 posts
Location
Lincoln, Nebraska
Posted 21 December 2012 - 10:56 AM
needs
tan
atan
atan2
acos
asin
an ON button
easter eggs
:3
It does have tan, atan, acos, and asin. I could not figure a way to add atan2 though. It would return the same thing, so I did not need to add it.
Still, error with LARGE numbers
I did note that huge numbers cannot be calculated. It is an error trying to get the length of a non-terminating decimal.
290 posts
Location
St.Louis, MO
Posted 21 December 2012 - 11:02 AM
Very cool! I have made something somewhat like this. Was planning to release it, but you are too much competition :(/>
21 posts
Posted 21 December 2012 - 03:07 PM
Shouldn't the non-zero numbers be reversed vertically? That's what I'd expect a calculator to be like normally…
222 posts
Location
Canada
Posted 21 December 2012 - 09:27 PM
I use this in science class now.
222 posts
Location
Canada
Posted 21 December 2012 - 09:32 PM
also, change your pi to :
http://pastebin.com/nax2n6sZput into pastebin cause its 100,000 digits kindly generated by my computer. (took a long time. I realized i could just google it…)
222 posts
Location
Canada
Posted 21 December 2012 - 09:34 PM
Also, dividing by zero dosen't give you 0. It gives you 0 repeating because you cannot divide something by nothing. (indefinite is what you gets)
1054 posts
Posted 21 December 2012 - 09:42 PM
Also, dividing by zero dosen't give you 0. It gives you 0 repeating because you cannot divide something by nothing. (indefinite is what you gets)
Who said it did give zero? Also, indefinite (or nan - not a number - in Lua) is what you should get, but inf is what you get in Lua [Limit(1/0)].
799 posts
Location
Land of Meh
Posted 22 December 2012 - 05:12 AM
Love it so much!
3790 posts
Location
Lincoln, Nebraska
Posted 22 December 2012 - 05:20 AM
also, change your pi to :
http://pastebin.com/nax2n6sZput into pastebin cause its 100,000 digits kindly generated by my computer. (took a long time. I realized i could just google it…)
My calculator is not as robust. It cannot calculate non-repeating decimal numbers, or huge numbers. I intentionally left Pi to just a few digits so as not to break the calculator.
818 posts
Posted 22 December 2012 - 06:06 AM
doesn't math.pi work?
2217 posts
Location
3232235883
Posted 22 December 2012 - 06:09 AM
you sould try using the bignum api
infinite integers
for the trigometric functions you could just modulo the input with 2*pi and use the normal function
and for tangent you can do just pi
unless you can make your own function, wich is pretty hard .-.
3790 posts
Location
Lincoln, Nebraska
Posted 22 December 2012 - 06:14 AM
doesn't math.pi work?
That's what I used. It does not calculate as far as you did. math.pi is rounding up to 3.1415927 when calculated alone. It does that in the lua prompt as well as the calculator, so it is consistent.
3790 posts
Location
Lincoln, Nebraska
Posted 22 December 2012 - 06:15 AM
you sould try using the bignum api
infinite integers
for the trigometric functions you could just modulo the input with 2*pi and use the normal function
unless you can make your own function, wich is pretty hard .-.
I didn't feel like changing the entire way it calculates just to get accurate numbers. I just wanted something that works, and looks good doing it.
2217 posts
Location
3232235883
Posted 22 December 2012 - 06:17 AM
meh, it would be easy to integrate
818 posts
Posted 22 December 2012 - 07:37 AM
ah OK, got a bad experience with big numbers in lua before(1/998001)
1619 posts
Posted 22 December 2012 - 01:42 PM
also, change your pi to :
http://pastebin.com/nax2n6sZput into pastebin cause its 100,000 digits kindly generated by my computer. (took a long time. I realized i could just google it…)
I counted, that's only 99,999 digits. Liar. :P/>
2217 posts
Location
3232235883
Posted 22 December 2012 - 02:18 PM
what i know:
3.14159265358979323846264338
i dont get why you would want anything more acurate then that .-.
290 posts
Location
St.Louis, MO
Posted 25 December 2012 - 07:58 PM
also, change your pi to :
http://pastebin.com/nax2n6sZput into pastebin cause its 100,000 digits kindly generated by my computer. (took a long time. I realized i could just google it…)
Yo do know that you only have to do know that you only have to do pi to the first 0
to be accurate, right? pi to the first 0 is3.14159265358979323846264338327950
1619 posts
Posted 26 December 2012 - 05:15 AM
also, change your pi to :
http://pastebin.com/nax2n6sZput into pastebin cause its 100,000 digits kindly generated by my computer. (took a long time. I realized i could just google it…)
Yo do know that you only have to do know that you only have to do pi to the first 0
to be accurate, right? pi to the first 0 is3.14159265358979323846264338327950
Well, it wouldn't be exactly accurate, but it would be pretty close and easy.
2088 posts
Location
South Africa
Posted 26 December 2012 - 05:19 AM
Or just use 22/7 for pi :(/>
Very nice calculater btw :o/>
1054 posts
Posted 26 December 2012 - 05:38 AM
A double-precision floating point value can hold maximum 16 decimals. So anything beyond that is pure waste in calculations.
2088 posts
Location
South Africa
Posted 19 January 2013 - 07:21 AM
How does it divide by zero… or does it just print "Undefined"? Haven't checked latest version and I'm too lazy to.
3790 posts
Location
Lincoln, Nebraska
Posted 19 January 2013 - 07:52 AM
How does it divide by zero… or does it just print "Undefined"? Haven't checked latest version and I'm too lazy to.
When you divide by zero in Lua, you receive Infinity. So that's what it will return.
131 posts
Location
I am omnipresent... DUH
Posted 25 February 2013 - 07:46 AM
Division by 0 isn't infinity, if so, 4/0 = INFINITY = 3/0, there forth 3=4 and in the calculator it doesn't say 3=4
497 posts
Location
The Big Apple, NY
Posted 25 February 2013 - 07:55 AM
Division by 0 isn't infinity, if so, 4/0 = INFINITY = 3/0, there forth 3=4 and in the calculator it doesn't say 3=4
In lua when u divide a number by 0 it returns inf which means infinity…while undefined is more accurate lua returns inf, so that's what u get
131 posts
Location
I am omnipresent... DUH
Posted 25 February 2013 - 01:07 PM
Division by 0 isn't infinity, if so, 4/0 = INFINITY = 3/0, there forth 3=4 and in the calculator it doesn't say 3=4
In lua when u divide a number by 0 it returns inf which means infinity…while undefined is more accurate lua returns inf, so that's what u get
You could make it change infinity to undefined
if num == 1/0 then
num = "UNDEFINED"
end
2217 posts
Location
3232235883
Posted 25 February 2013 - 02:52 PM
i get nan when dividing by zero…
1619 posts
Posted 25 February 2013 - 07:31 PM
When you think about it, dividing by zero should equal infinity. When you say 4/2, you ask, "how many two's go into the number 4?" The answer is of course 2. When you say 4/0, you ask, "how many zeros go into 4?" As 0*0*0*0… will always equal zero, the answer is Infinity.
3790 posts
Location
Lincoln, Nebraska
Posted 26 February 2013 - 02:00 AM
When you think about it, dividing by zero should equal infinity. When you say 4/2, you ask, "how many two's go into the number 4?" The answer is of course 2. When you say 4/0, you ask, "how many zeros go into 4?" As 0*0*0*0… will always equal zero, the answer is Infinity.
That's actually a good way of illustrating it. I'm still not changing from divide by zero being infinity, as that's how many languages handle it. That, or NaN errors.
1522 posts
Location
The Netherlands
Posted 26 February 2013 - 03:47 AM
I have one suggestion:
Please use normal numbers for the outcome, because I can hardly read them. You should do a poll if you are going to do this
2217 posts
Location
3232235883
Posted 26 February 2013 - 04:10 AM
When you think about it, dividing by zero should equal infinity. When you say 4/2, you ask, "how many two's go into the number 4?" The answer is of course 2. When you say 4/0, you ask, "how many zeros go into 4?" As 0*0*0*0… will always equal zero, the answer is Infinity.
no,
you cant devide by zeroits undefined
3790 posts
Location
Lincoln, Nebraska
Posted 26 February 2013 - 04:29 AM
no,
you cant devide by zeroits undefined
YOU CAN IN PROGRAMMING! DEAL WITH IT!
2217 posts
Location
3232235883
Posted 26 February 2013 - 04:38 AM
no you cant, you just simply check for it
if you REALLY devided by zero it would just loop forever
5 posts
Posted 26 February 2013 - 06:01 AM
How about the M+ key you get on a lot of calculators?
Or a square root function using math.sqrt?
3790 posts
Location
Lincoln, Nebraska
Posted 26 February 2013 - 08:39 AM
no you cant, you just simply check for it
if you REALLY devided by zero it would just loop forever
Still not gonna change it. Learn to love it.
How about the M+ key you get on a lot of calculators?
Or a square root function using math.sqrt?
The memory key was a pain to try to add, but there is a square root function already implemented. And it does use math.sqrt.
14 posts
Posted 20 March 2013 - 11:55 AM
Can I use this in my OS? Also If I did how would I change it, because I can't find the "OFF" button code.
259 posts
Posted 20 March 2013 - 12:01 PM
I will find a way to error it it shouldnt be to hard :P/> im the master at spamming numbers.
2217 posts
Location
3232235883
Posted 20 March 2013 - 03:10 PM
I will find a way to error it it shouldnt be to hard :P/> im the master at spamming numbers.
you sure?
because everything is error checked
7508 posts
Location
Australia
Posted 20 March 2013 - 03:13 PM
Also If I did how would I change it, because I can't find the "OFF" button code.
The code to exit the program is on lines 273 — 278 … but I don't understand why you would want to change it …
169 posts
Posted 20 March 2013 - 03:36 PM
When you think about it, dividing by zero should equal infinity. When you say 4/2, you ask, "how many two's go into the number 4?" The answer is of course 2. When you say 4/0, you ask, "how many zeros go into 4?" As 0*0*0*0… will always equal zero, the answer is Infinity.
How many 2's in -4? It's -2. How many 0's go into -4? It will be negative infinity.
So, using your logic, dividing with zero will not always give you positive infinity.
And what about this:
4/2 = 2
8/2 = 4
4 > 2
Therefore 4 and 8 are not equal.
Using your logic:
4/0 = INF
8/0 = INF
INF == INF
Therefore 4 == 8???
Also, consider this. Since division is the reverse of multiplication, take this for an example:
8/2 = 4
8x4 = 2
8/0 = INF
8 x INF = 0??
Any number divided by 0 is undefined.
But since it returns infinity in Lua, I think this calculator should keep it for consistency.
128 posts
Location
South Africa
Posted 05 December 2014 - 06:33 PM
Does it have scientific notation?
Like when you do 9999999 x 99999999 would answer 999999890000001,
then in scientific notation it would be
9.99999890000001 x 10(14)
The (14) is what the 10 is powered to.
Edited on 05 December 2014 - 05:37 PM
3790 posts
Location
Lincoln, Nebraska
Posted 05 December 2014 - 10:00 PM
Does it have scientific notation?
Like when you do 9999999 x 99999999 would answer 999999890000001,
then in scientific notation it would be
9.99999890000001 x 10(14)
The (14) is what the 10 is powered to.
You quite expertly rose this topic from the dead. I don't really support this calculator anymore, but if you'd like to fiddle around with it, you're more than welcome.