This is partially in response to Kerm's BaseConv program he posted a couple months ago and to a project I've been working on. Looking at his program's description on Ticalc, I saw an error in which he stated that the program had arbitrary precision limited by the calculator's memory (although he qualified his statement with "to my knowledge"). Anyways I too had a similar program uploaded, so similar that if you remove his menu, credits, help, dcs icon, error checking, etc., it is quite similar to Kerm's. Mine can be found here
http://www.mediafire.com/?ntjpngfxafh (it's on ticalc too, although I requested mulitple times for them to remove it, but the one in the link above is the latest version).

Anyways it got me thinking of how it would be possible to make an actual precision one. The only way I've thought of so far (haven't thought about it that much) was to just use a string or list to store each individual digit of a number, ex. 365 would be "365" or {3,6,5}, then do the math with individual digits and store numbers to other lists or strings, ex. 365*34 = {1,2,4,1,0}. A routine would have to be made for the four fundamental operations (+-*/). Exponents could be done using the multiplication routine and For( command. So if anyone has any ideas on creating a quick and efficient way for this it'd be nice. I've already made a multiplication one but it's somewhat slow. Also I've worked on a program that will convert non integer numbers, ex. ".25," and it was relatively successful. I even tried to implement support for repeating digits, both converting to and from them. The biggest problem however was the extreme loss of precision on the calculator's part, being only able to store up to 14 digits. This screwed up repeating digit detection and limited the amount of accurate digits that could be outputted, so I gave up on it because I wasn't sure what to do after that. The arbitrary precision stuff could probably solve that, although all in all, if a program that convert numbers like 4/3 (1.3333...) could be made it would be rather large and probably slow. This type of project is for people who like to problem solve and program for fun and challenge with math involved.

I suppose I'll edit this post later to include paragraphs, sorry Sad. This topic will likely go unreplied and the post's length is probably too unappealing to attract attention, but I had put off this project for a while so had a lot of thoughts bundled together. Thanks anyways anyone, hope this wasn't a crappy first post.
Hey, welcome to Cemetech, and you have some excellent points. You are correct that my Base Converter is not in fact arbitrary precision; I wrote it about 2 years before I found it on my hard drive and realized I never submitted it to ticalc.org, so I assumed I had followed through on my plan to eventually make it arbitrary precision, although I was incorrect. I've made an arbitrary precision calculator (add, subtract, multiply, divide) in MIPS assembly, and I can confirm that it wouldn't be terribly challenging to carry this over to an arbitrary-precision TI-BASIC calculator and/or base converter. Would you be interested in pursuing the project on your own, or would you like me to give it a shot? If you don't mind, I think I might like to give it a try.
I've thought about this before, and I have a suggestion. Instead of using base-10 digits, use base-10^7 digits in your multiplication algorithm. This is a huge speedup because you can ask your calculator to do most of the work; the calculator can multiply 7 digit numbers together without any loss of precision.
Ed H wrote:
I've thought about this before, and I have a suggestion. Instead of using base-10 digits, use base-10^7 digits in your multiplication algorithm. This is a huge speedup because you can ask your calculator to do most of the work; the calculator can multiply 7 digit numbers together without any loss of precision.
Aha, well thought-out, Mr. H! You make a superb point here.
Ed H wrote:
I've thought about this before, and I have a suggestion. Instead of using base-10 digits, use base-10^7 digits in your multiplication algorithm. This is a huge speedup because you can ask your calculator to do most of the work; the calculator can multiply 7 digit numbers together without any loss of precision.


I've thought about using more than single digit multiplication, but unfortunately in my way of programming I used lists and so for example when I have a 9*9 it is 81, but I'm trying to get every term of the list to be one digit so that it can be converted to a string much more easily. It is a lot easier to make the 8 in 81 carry over but if one were to do 1234567*9876543=12193254061881 for example every digit would have to carry over to another part of the list. Although I suppose this could be done more easily with the all powerful For( argument and is worth giving a try.

KermMartian wrote:
Would you be interested in pursuing the project on your own, or would you like me to give it a shot? If you don't mind, I think I might like to give it a try.


Pretty much all projects I've worked on have been done alone but I do believe it would be more interesting to have someone experienced to collaborate with although it would likely mostly consist of individual programming then showing each other. It would be a lot more helpful to have help with the more tedious programming, especially the trial and error I usually go through, so to sum it up I'd like to have individual portions of the program. I normally don't like making programs that call on other programs but for the arbitrary precision arithmetic it may be necessary, plus the arithmetic sub programs can be applied to other programs as well.

BTW heres the multiplication routine, just copied and pasted the program uploaded onto the very useful SourceCoder. I know it's pretty messy, I pretty much just wanted to get it to work and it's ;much larger than I want it to be.


Code:
:DelVar L1length(Str1→A
:length(Str2→B
:A+B→dim(L1
:For(X,1,A
:For(Y,1,B
:X+Y-1→D
:.1expr(sub(Str1,X,1))expr(sub(Str2,Y,1→C
:L1(D)+iPart(C→L1(D
:L1(D+1)+10fPart(C→L1(D+1
:End
:End
:For(Z,dim(L1),2,‾1
:L1(Z-1)+iPart(.1L1(Z→L1(Z-1
:10fPart(.1L1(Z→L1(Z
:End
:DelVar A"→Str3
:Repeat A
:L1(Z→A
:Z+1→Z
:End
:For(Z,Z-1,dim(L1)
:sub("0123456789",L1(Z)+1,1
:If length(Str3
:Then
:Str3+Ans→Str3
:Else
:Ans→Str3
:End
:End
:Str3

btw Input: Str1&Str2 Output:Str3
Oh, I absolutely agree working alone, I've had bad experiences trying to work with other programmers. It's probably my personality problems, but it never seems to work out. Very Happy I was asking if you wanted us to both work independently on it, or if you'd prefer to pursue it on your own without me working on my own version.
KermMartian wrote:
Oh, I absolutely agree working alone, I've had bad experiences trying to work with other programmers. It's probably my personality problems, but it never seems to work out. Very Happy I was asking if you wanted us to both work independently on it, or if you'd prefer to pursue it on your own without me working on my own version.

Independently is probably the route to go, but talking about it and sharing ideas and code would be enlightening too. I can imagine how difficult it can be for multiple people to work on one program.
I went on to ticalc and found 3 programs that can multiply large numbers and tested them using TI Flash Debugger. I timed how long it took each to calculate 10^65-1 (64 9's) times itself (^2 basically) and display the result. Results (including my own program, totaling 4 prgms):

My program: 269 bytes 1min 3sec

"Exact Values For Extremely Large Integer Multiplication" http://www.ticalc.org/archives/files/fileinfo/293/29302.html 728 bytes 13 sec

"Big Number Multiplication" http://www.ticalc.org/archives/files/fileinfo/404/40493.html 670 bytes 6 sec

The other wasn't able to calculate the value. It used matrices and I believe it returned a memory error, which wouldn't be acceptable for the base conversion program.

As anyone could see my program got the job done even with a small size but was extremely slow in comparison to the other routines. I am now considering two different ideas I'll try later, one inspired while looking at the tested programs and the other is from Ed H's suggestion.

I prefer file size to remain as small as possible (one way is not including names, ads, home menus, help menus, etc. to programs), but I do prefer efficiency and need to fix this routine to speed it up. I'm willing to have a subprogram for each operation (+-*/) at a maximum of 500 bytes each but preferably under 400. Any help or advice with anything?

EDIT: I've been posting a lot on here but I've just found another thing on Ticalc. I thought I had checked every other basic base converter on the site for ti 83+ but was partially correct. There was one for the 83, only 283 bytes, but less than mine if optimized (mine is 200, coincidentally has the same amount of lines as mine). It seems to have an even greater degree of accuracy than my or Kerm's programs. It inputs and outputs lists though, but that can easily be changed. I haven't thoroughly examined how the code works yet and will get on that soon. It can be found here (Uploaded in 1999!):
http://www.ticalc.org/archives/files/fileinfo/79/7928.html

Remarkably from the same programmer is a suite that can do arbitrary precision calculations (+-*/ and ^). It's rather large and has a few subprograms (all together is about 2900 bytes) and could really be cut short using modern day optimization (was uploaded in 2002) but has a lot of potential for ideas.
http://www.ticalc.org/archives/files/fileinfo/209/20936.html
This has gotten me pretty excited and feedback would be nice. I'm not very good at figuring out what other people's code does (let alone my own if I haven't looked at it for a while) but I'll try to interpret everything. And one more thing, should I continue to post links (which may be annoying) or should I use SourceCoder to display the programs (which may or may not also be annoying)?
  
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.

» Go to Registration page
Page 1 of 1
» 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

 

Advertisement