This is basically a calculator program that allows you to do math calculations with the precision of up to 256 digits before and after the decimal place. All numbers are stored in BCD.

Implemented:
Rudimentary right-to-left parser
Negation (and this subtraction)
Multiplication

Todo:
Division
Trig functions
Constants e, pi, and tao
PENTAS ooo and parentheses
Logs, exponents If you want to scout for bugs, you can download it here.
While at present (with only add with negation) it seems like a curiosity (from what I can tell) adding * and / would make it quite useful.
Is this ASM or Basic?
This is great! have you ever heard of CABAMAP? it's essentially a stack based arbitrary precision calculator. Anyways, cool stuff, the only issue I have is that you said "Tao". This looks really great! I still have some questions though And are you going to implement some sort of sqrt( function, also taking the square root of negative numbers?
Anyway, keep up the great work! mr womp womp wrote:
This is great! have you ever heard of CABAMAP? it's essentially a stack based arbitrary precision calculator. Anyways, cool stuff, the only issue I have is that you said "Tao". Nope :/ I think i will make my calculator infinite (memory based) too I have a question regarding precision though; see below.

CodertheBarbarian wrote:
While at present (with only add with negation) it seems like a curiosity (from what I can tell) adding * and / would make it quite useful.
Is this ASM or Basic?

This is is made in Axe actually, with more intensive algorithms in ASM. It can actually do multiplication, but i haven't added devision yet. Actually i have a question regarding precision; see below. x2

PT_ wrote:
This looks really great! I still have some questions though And are you going to implement some sort of sqrt( function, also taking the square root of negative numbers?
Anyway, keep up the great work! I hope to implement exponentials and logarithms, so yes, however, i don't think complex numbers are necessary. I don't want to make a full out CAS engine just yet Anyways, my question regarding precision is this: so numbers are stored 256 BCD digits with values of 10^n, and 256 BCD digits with values of 10^-n. The way multiplication works, the decimal places are ignored in the two numbers being multiplied, and they are just multiplied like normal. Then, the decimal place is added back at the correct location. For example 0.0A * 0.000B would be C*10^-6, becouse 0.0A has 2 decimal place digits and 0.000B 4, and 2+4=6. The problem is, if the product has more than 512 total digits, before or after the decimal place, it will overflow, even if the actual product has say 5 digits before decimal place, which is lower then the 256 digit limit.
I don't see how that will be a problem, you only need to be sure to have an extra 256 next to the result, as the product of 2 256-byte numbers can be a 512-byte number. Then just shift this 512-byte number to the right, until it fits perfectly in the 256 bytes.

Let's take an example, but now we will work with 10-byte numbers, 5 for the values of 10^n, and 5 for the values of 10^-n.
We want to multiply the numbers 463.5649764349 and 0.0059764646. If you omit the decimal point, you gonna multiply 4635649764349 by 59764646 which is 277047967146301405454. However, since we multiplied 2 decimal parts with 5 bytes each, we have to shift this number 10 bytes to the right, to fit in our 10 bytes. Thus, it becomes 2.77047967146301405454, and because the number takes 5 bytes for the values of 10^-n, it becomes 2.7704796714. So what is the problem now? Also, overflow only happens when the result is MORE than 2*256 bytes, so 513 bytes.

Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

»
» All times are UTC - 5 Hours

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum