Here's a large number multiplication test I did to compare the speed of CasioBasic vs C.Basic.
A little theory:
When you multiply two integers if the result is larger than 10 digits the calculator will convert it to floating point and display it in scientific notation. As a result you lose the least significant digits. This algorithm uses the method we learn in elementary school (called "long" multiplication) to get the result. This algorithm has a running time of O(n2) where n is the number of digits.
If you want more info on how the algorithm is implemented in computers read this: https://en.wikipedia...ation_algorithm
To enter the 2 numbers you want multiplied change the first two lines where they are assigned to matrices A and B. Start entering from the least to the most significant digit.
Say you want to multiply 23456 by 45678. You should enter this:
[[6,5,4,3,2]] -> Mat A
[[8,7,6,5,4]] -> Mat B
If one number has fewer digits than the other pad it with 0's until they have the same length. Example:
1234567 x 456
should be entered as
[[7,6,5,4,3,2,1]] -> Mat A
[[6,5,4,0,0,0,0]] -> Mat B
Then run the algorithm and the result will be displayed. I didn't bother with a fancier data entry since this is just a test.
MEMORY LIMITS ON A CASIO fx-9860 GII
In Casio Basic it seems the max numbers that can be multiplied is around 47 digits each. In C.Basic the limits are much higher. Your limits might vary depending on your calculator.
I'm testing the algorithm with two 47-digit numbers.
Huge difference. Such differences can be observed between interpreted and compiled languages for example between Python vs C++.
So here's the program to try for yourselves.
'ProgramMode:RUN '=== Large number '=== multiplication '=== least_->_most sgnf [[4,5,6,7,8,9,3,3,3,7,8,9,6,6,6,4,4,4,4,2,2,1,1,0,0,6,6,6,0,0,1,6,7,8,9,4,3,1,2,8,8,8,8,2,4,6,8]]->Mat A [[3,2,1,2,2,8,8,8,8,1,6,6,6,1,0,4,4,4,4,0,0,0,3,3,3,6,6,6,0,0,0,1,7,8,9,2,7,8,9,4,3,2,1,2,4,6,8]]->Mat B Trn Mat A*Mat B->Mat C Mat C ClrList 1 Dim Mat C List Ans->D 1->L 0->C For 1->I To D C->S:0->C For 1->J To I S+Mat C[J,I-J+1]->S '"J,I-J+1" 'J_Disps_ 'I-J+1_Disps_ Next S Rmdr 10->List 1[L] S Int/ 10->C 1+L->L Next For 2->I To D C->S:0->C For D->J To I Step -1 S+Mat C[I+D-J,J]->S '"I+D-J" 'I+D-J_Disps_ '"J" 'J_Disps_ Next S Rmdr 10->List 1[L] S Int/ 10->C 1+L->L Next '"C=" 'C_Disps_ '===ADD LAST CARRIER C>0=>C->List 1[L] '=== List 1 to str ""->Str 1 "0123456789"->Str 2 For 1->I To Dim List 1 StrMid(Str 2,List 1[I]+1,1)+Str 1->Str 1 Next Locate 1,2,StrMid(Str 1,1,20) Locate 1,3,StrMid(Str 1,21,20) Locate 1,4,StrMid(Str 1,41,20) Locate 1,5,StrMid(Str 1,61,20) Locate 1,6,StrMid(Str 1,81,20) Locate 1,7,StrMid(Str 1,101,20)
In case you're bored to copy/paste download the .g1m file from here:
Congrats to sentario21 for the amazing C.Basic language.