CodeWalrus
Development => Calculators => Calc Projects, Programming & Tutorials => Topic started by: c4ooo on March 21, 2017, 08:00:09 pm

I am writing a program that will allow you to do maths on numbers with up to 512 significant figures, 256 before and 256 after the decimal point.
(http://i.imgur.com/1Vo9vkr.jpg)
I have a simple UI working, a rudimentary parser (only right to left order of operations, no PENTAS), and an addition algorithm. Numbers are stored in BCD.
Done:
 Rudimentary parser
 Addition
[Some of] Todo:
 Negation/Subtraction
 Multiplication
 Division
 Trig functions (how?)
 Constants e, pi, and tao
 PENTAS ooo and parentheses
 Logs, exponents (how?)
For the items where i put "(how?)", i do now an algorithm that will calculate with the precision of 258 decimals.

uuh well that's nice.
But I guess it's not possible to implement this in the OS itself so it's always used...? :/
still a really usefull tool! :thumbsup:

Nice! In what language are you writing this? And do you have an indication of the speed?
regarding trig, you can find various articles on the internet, mostly they're an approximation with exponents (If you want to derive them
yourself, you'll need to use taylor polynomals ;)).
For exponents you'll only need to impelemnt ln(x) and e^(x), since you can rewrite any log(x, y) and x^y to a form using ln and e^(x). Good luck ;)

uuh well that's nice.
But I guess it's not possible to implement this in the OS itself so it's always used...? :/
Through the use of hooks, it would definitely be able to always be used.
Is this in Axe?
Looks neat. You should post how you do the math.

uuh well that's nice.
But I guess it's not possible to implement this in the OS itself so it's always used...? :/
I really don't know how the OS does math internally. Modding individual functions (add, sub etc) to use more decimals won't work becouse the OS would still use the 9 byte floats, which have 10(iirc) significant figs.
Is this in Axe?
Looks neat. You should post how you do the math.
Yep, this is in axe. I plan to make this open source once i have more stuff implemented ;)
Nice! In what language are you writing this? And do you have an indication of the speed?
regarding trig, you can find various articles on the internet, mostly they're an approximation with exponents (If you want to derive them
yourself, you'll need to use taylor polynomals ;)).
For exponents you'll only need to impelemnt ln(x) and e^(x), since you can rewrite any log(x, y) and x^y to a form using ln and e^(x). Good luck ;)
I don't have addition/division, but my guess is that it will be fine. Basically, it will always take longer for you to type the number then for the program to compute :3
Also, why would i need ln(x) if its just log(x)/log(e) :P ? As a start, i will only have base 10 log. BTW, how do i rewrite x^y as e^(x) ???
Edit: part of this post was accidentally deleted by a mod in an accident, i tried to restore it as best i could, but it might not be 100% perfect ;)

Awesome job c4ooo. This could be handy. As for TIOS hook implementation the main issue tho would be that real vars would be significantly larger if they were used by this.

uuh well that's nice.
But I guess it's not possible to implement this in the OS itself so it's always used...? :/
I really don't know how the OS does math internally. Modding individual functions (add, sub etc) to use more decimals won't work becouse the OS would still use the 9 byte floats, which have 10(iirc) significant figs.
we have a new project I see :thumbsup:
yeah that's a huge problem there, I understand that. It's pretty sad tho as it's sometimes really usefull to be able to get such exact results ^^
how can we call ur tool and can we simply enter any long calculation and get the exact result? or is it more complicated? :)

Nice! In what language are you writing this? And do you have an indication of the speed?
regarding trig, you can find various articles on the internet, mostly they're an approximation with exponents (If you want to derive them
yourself, you'll need to use taylor polynomals ;)).
For exponents you'll only need to impelemnt ln(x) and e^(x), since you can rewrite any log(x, y) and x^y to a form using ln and e^(x). Good luck ;)
I don't have addition/division, but my guess is that it will be fine. Basically, it will always take longer for you to type the number then for the program to compute :3
Also, why would i need ln(x) if its just log(x)/log(e) :P ? As a start, i will only have base 10 log. BTW, how do i rewrite x^y as e^(x) ???
Because there is more information on how to implement ln(x) ;)
To rewrite x^y as a power of e you would use the fact x = e^ln(x)
x^y = (e^ln(x))^y = e^(y*ln(x)).

I added subtraction/negation. I feel fairly confident that everything should work, but i would like people to try different addition / subtraction equations and see if anything breaks :P
Notes:
To subtract two numbers you can use "AB" or "A+ (small negation sign) B"
Multiple terms don't work yet.
Since output isn't trimmed, you might see something like: "0", "00XX" or "X.XXX000".
Only addition and negation/subtraction implemented!
Also sause is in download.

I'll see later if I can give it a try. I'm pretty busy. Glad to see progress :)

This is AMAZING (adds an 84 to his evergrowing list of wanted calcs)

On a sidenote, there exists an algoritm that can eliminate a lot of work when multiplying two big numbers. It has something to do with divide and conquer.

This is AMAZING (adds an 84 to his evergrowing list of wanted calcs)
I'm shocked it wasn't there before, especially after most of hte greyscale games//tools are for the 83+/84+ family :ninja:

Hmm, i was almost done implementing multiplication when Doors designed to delete the program that had all the arithmetic code x.x . I had axe backup disabled cause it's really glitchy in the new version. Luckily when i transferred the program to my computer i made a backup of the code, so it shouldn't be a big setback.

Ok, i have added multiplication :)
I am not sure how to do Division efficiently though.
Sause in download.

Ooh nice. I kinda lost touch with many projects lately, gonna download this now so I can try it later. Glad to see this coming along nicely without too much hassle. How is the speed?