[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.javascript

Input operands base when used in operation .

JT

4/15/2015 4:24:00 PM

Is there a way to specify that the operands is not base 10? Or do one have to program it? If so which bases are supported.
19 Answers

Scott Sauyet

4/15/2015 8:39:00 PM

0

jonas.thornvall@gmail.com wrote:

> Is there a way to specify that the operands is not base 10? Or do
> one have to program it? If so which bases are supported.

What is this supposed to mean?

Operands don't have bases. If you mean that the collections of characters in source code or some other input format represents a number using one base or another, then there are straightforward rules for most languages. (Javascript is slightly complicated by the changing nature of octal representations in source code in different specification versions.) But the simplest rule I can think of is to assume that your data is base 10 unless you have a reason to suspect otherwise. :-)

-- Scott

JT

4/16/2015 8:28:00 AM

0

Den onsdag 15 april 2015 kl. 22:38:54 UTC+2 skrev Scott Sauyet:
> jonas.thornvall@gmail.com wrote:
>
> > Is there a way to specify that the operands is not base 10? Or do
> > one have to program it? If so which bases are supported.
>
> What is this supposed to mean?
>
> Operands don't have bases. If you mean that the collections of characters in source code or some other input format represents a number using one base or another, then there are straightforward rules for most languages. (Javascript is slightly complicated by the changing nature of octal representations in source code in different specification versions.) But the simplest rule I can think of is to assume that your data is base 10 unless you have a reason to suspect otherwise. :-)
>
> -- Scott

Well in the end a base is the interpretation of digitvalues, now a byte or an integer is only a trivial grouping of binaries. But the digitplace is the interpretation rules of that *grouping*, and that is dependent upon the base.

JT

4/16/2015 10:16:00 AM

0

Den torsdag 16 april 2015 kl. 10:27:50 UTC+2 skrev jonas.t...@gmail.com:
> Den onsdag 15 april 2015 kl. 22:38:54 UTC+2 skrev Scott Sauyet:
> > jonas.thornvall@gmail.com wrote:
> >
> > > Is there a way to specify that the operands is not base 10? Or do
> > > one have to program it? If so which bases are supported.
> >
> > What is this supposed to mean?
> >
> > Operands don't have bases. If you mean that the collections of characters in source code or some other input format represents a number using one base or another, then there are straightforward rules for most languages. (Javascript is slightly complicated by the changing nature of octal representations in source code in different specification versions.) But the simplest rule I can think of is to assume that your data is base 10 unless you have a reason to suspect otherwise. :-)
> >
> > -- Scott
>
> Well in the end a base is the interpretation of digitvalues, now a byte or an integer is only a trivial grouping of binaries. But the digitplace is the interpretation rules of that *grouping*, and that is dependent upon the base.

I understad you are a very good programmer Scott i've tried to outline the changes needed to take my base conversion into bignumbs i already have the necessary functions but i get stuck.


I show you the plain conversion function and then the one to take it to bignumb. I have a compare function that compare two arrays *work*, and i have two arithmetic bignumb functions that takes arrays as arguments. The conversion need bignumb add, mult and subt which i've implemented. I find it easy to implement plain ideas, but very hard to adjust them dealing with arguments and arrays.

Plain Version function.

//CONVERT A DECIMAL NUMBER INTO ANYBASE
function newbaseWORK(decNumber,base){
var out =[];
digits=1;
digmult=1;
while(digmult*base<=decNumber){
digmult=digmult*base
digits++;
}
digsave=digmult;
while(decNumber>0 || digits>=0){
loop=1;
digit=0;
for (digit=0;digit<=base;digit++) {
if((digit+1)*digmult>decNumber)break;
}
out[digits]=digit;
digmult=digmult*digit;
decNumber=decNumber-digmult;
digsave=digsave/base;
digmult=digsave;
digits--;
}
if(out[0]==0) out.splice(0,1);
return out;

}

My attempt making it use the bignumb functions and compare.

// CONVERT A DECIMAL BIGNUMB INTO ANYBASE
function newbase(decNumber, base)
{
var arrArr=[];
var out = [];
digits=1;
digitsold = 1;
var digmult = [];
digmult[0] = 1;
ibase = base.split("").reverse();
loop = true;

//Finding digit value nearest the number where "base^x<number"
while(loop == true)
{ arrArr[digits]=digmult; //Save the instance of multiple
digitsold = digits; //Cashing the old digit
digmultold = digmult; //Cashing the old multiple
digmult = naiveMult(ibase, digmult, base); // multiply multiple * base
loop = arrCompare(digmult, decNumber, loop);//Check if less than number
digits ++ ; //Add up the index for arrArr
if(loop == false){digmult = digmultold;digits=digitsold;} //If digmult >number break (fetch old values)
}

aRemainder = true;
stillDigits = true;
var digsave = [];

while(aRemainder == true || digits >= 0)
{
moredigits = true;
var digit = [];
digit[0] = 0;
var nrOne = [];
nrOne[0] = 1;

//Here i try to find the digits from biggest multiple to smallest using multiples of digmult

while (moredigits == true)
{
//Save the old digmult and digit (if false)
digitold = digit;
digmultold=digsave;
//Add one to digit
digit = naiveAdd(base, digit, nrOne);
//Doing the multiplication with the new digit
digsave = naiveMult(base, digmult, digit);
//Check if multiple bigger than the number
moredigits = arrCompare(digsave, decNumber);
//If bigger than we use the old multiple and digit
if(moredigits == false)
{
digit = digitold;
digsave=digmultold;
}
}
//Saving the digit
out[digits] = digit;
//One less digit
digits -- ;
//Getting the next smaller multiple from array (base^x)
digmult = arrArr[digits];
//Subtract from the number, (digsave)=digit*(digmult)
// digmult=base^x for the digitvalue
decNumber = naiveSub(base, decNumber, digsave);
}
//Removing any leading zero probably not necessary
if(out[0] == 0) out.splice(0, 1);
return out;
}

How could it get so complicated?




JT

4/16/2015 10:23:00 AM

0

Den torsdag 16 april 2015 kl. 12:16:18 UTC+2 skrev jonas.t...@gmail.com:
> Den torsdag 16 april 2015 kl. 10:27:50 UTC+2 skrev jonas.t...@gmail.com:
> > Den onsdag 15 april 2015 kl. 22:38:54 UTC+2 skrev Scott Sauyet:
> > > jonas.thornvall@gmail.com wrote:
> > >
> > > > Is there a way to specify that the operands is not base 10? Or do
> > > > one have to program it? If so which bases are supported.
> > >
> > > What is this supposed to mean?
> > >
> > > Operands don't have bases. If you mean that the collections of characters in source code or some other input format represents a number using one base or another, then there are straightforward rules for most languages.. (Javascript is slightly complicated by the changing nature of octal representations in source code in different specification versions.) But the simplest rule I can think of is to assume that your data is base 10 unless you have a reason to suspect otherwise. :-)
> > >
> > > -- Scott
> >
> > Well in the end a base is the interpretation of digitvalues, now a byte or an integer is only a trivial grouping of binaries. But the digitplace is the interpretation rules of that *grouping*, and that is dependent upon the base.
>
> I understad you are a very good programmer Scott i've tried to outline the changes needed to take my base conversion into bignumbs i already have the necessary functions but i get stuck.
>
>
> I show you the plain conversion function and then the one to take it to bignumb. I have a compare function that compare two arrays *work*, and i have two arithmetic bignumb functions that takes arrays as arguments. The conversion need bignumb add, mult and subt which i've implemented. I find it easy to implement plain ideas, but very hard to adjust them dealing with arguments and arrays.
>
> Plain Version function.
>
> //CONVERT A DECIMAL NUMBER INTO ANYBASE
> function newbaseWORK(decNumber,base){
> var out =[];
> digits=1;
> digmult=1;
> while(digmult*base<=decNumber){
> digmult=digmult*base
> digits++;
> }
> digsave=digmult;
> while(decNumber>0 || digits>=0){
> loop=1;
> digit=0;
> for (digit=0;digit<=base;digit++) {
> if((digit+1)*digmult>decNumber)break;
> }
> out[digits]=digit;
> digmult=digmult*digit;
> decNumber=decNumber-digmult;
> digsave=digsave/base;
> digmult=digsave;
> digits--;
> }
> if(out[0]==0) out.splice(0,1);
> return out;
>
> }
>
> My attempt making it use the bignumb functions and compare.
>
> // CONVERT A DECIMAL BIGNUMB INTO ANYBASE
> function newbase(decNumber, base)
> {
> var arrArr=[];
> var out = [];
> digits=1;
> digitsold = 1;
> var digmult = [];
> digmult[0] = 1;
> ibase = base.split("").reverse();
> loop = true;
>
> //Finding digit value nearest the number where "base^x<number"
> while(loop == true)
> { arrArr[digits]=digmult; //Save the instance of multiple
> digitsold = digits; //Cashing the old digit
> digmultold = digmult; //Cashing the old multiple
> digmult = naiveMult(ibase, digmult, base); // multiply multiple * base
> loop = arrCompare(digmult, decNumber, loop);//Check if less than number
> digits ++ ; //Add up the index for arrArr
> if(loop == false){digmult = digmultold;digits=digitsold;} //If digmult >number break (fetch old values)
> }
>
> aRemainder = true;
> stillDigits = true;
> var digsave = [];
>
> while(aRemainder == true || digits >= 0)
> {
> moredigits = true;
> var digit = [];
> digit[0] = 0;
> var nrOne = [];
> nrOne[0] = 1;
>
> //Here i try to find the digits from biggest multiple to smallest using multiples of digmult
>
> while (moredigits == true)
> {
> //Save the old digmult and digit (if false)
> digitold = digit;
> digmultold=digsave;
> //Add one to digit
> digit = naiveAdd(base, digit, nrOne);
> //Doing the multiplication with the new digit
> digsave = naiveMult(base, digmult, digit);
> //Check if multiple bigger than the number
> moredigits = arrCompare(digsave, decNumber);
> //If bigger than we use the old multiple and digit
> if(moredigits == false)
> {
> digit = digitold;
> digsave=digmultold;
> }
> }
> //Saving the digit
> out[digits] = digit;
> //One less digit
> digits -- ;
> //Getting the next smaller multiple from array (base^x)
> digmult = arrArr[digits];
> //Subtract from the number, (digsave)=digit*(digmult)
> // digmult=base^x for the digitvalue
> decNumber = naiveSub(base, decNumber, digsave);
> }
> //Removing any leading zero probably not necessary
> if(out[0] == 0) out.splice(0, 1);
> return out;
> }
>
> How could it get so complicated?

Here with the functions it use, it is close but it does not work.
I think the layout is correct but something goes wrong.

<SCRIPT LANGUAGE="Javascript">

// CONVERT A DECIMAL BIGNUMB INTO ANYBASE
function newbase(decNumber, base)
{
var arrArr=[];
var out = [];
digits=1;
digitsold = 1;
var digmult = [];
digmult[0] = 1;
ibase = base.split("").reverse();
loop = true;

//Finding digit value nearest the number where "base^x<number"
while(loop == true)
{ arrArr[digits]=digmult; //Save the instance of multiple
digitsold = digits; //Cashing the old digit
digmultold = digmult; //Cashing the old multiple
digmult = naiveMult(ibase, digmult, base); // multiply multiple * base
loop = arrCompare(digmult, decNumber, loop);//Check if less than number
digits ++ ; //Add up the index for arrArr
if(loop == false){digmult = digmultold;digits=digitsold;} //If digmult >number break (fetch old values)
}

aRemainder = true;
stillDigits = true;
var digsave = [];

while(aRemainder == true || digits >= 0)
{
moredigits = true;
var digit = [];
digit[0] = 0;
var nrOne = [];
nrOne[0] = 1;

//Here i try to find the digits from biggest multiple to smallest using multiples of digmult

while (moredigits == true)
{
//Save the old digmult and digit (if false)
digitold = digit;
digmultold=digsave;
//Add one to digit
digit = naiveAdd(base, digit, nrOne);
//Doing the multiplication with the new digit
digsave = naiveMult(base, digmult, digit);
//Check if multiple bigger than the number
moredigits = arrCompare(digsave, decNumber);
//If bigger than we use the old multiple and digit
if(moredigits == false)
{
digit = digitold;
digsave=digmultold;
}
}
//Saving the digit
out[digits] = digit;
//One less digit
digits -- ;
//Getting the next smaller multiple from array (base^x)
digmult = arrArr[digits];
//Subtract from the number, (digsave)=digit*(digmult)
// digmult=base^x for the digitvalue
decNumber = naiveSub(base, decNumber, digsave);
}
//Removing any leading zero probably not necessary
if(out[0] == 0) out.splice(0, 1);
return out;
}


// If A < B returns loop = true otherwise loop = false
function arrCompare(A, B, smaller)
{


if(A.length > B.length)
{
smaller = false;
}
else if(A.length == B.length)
{
for(i = A.length - 1; i >= 0; i -- )
{
if(A[i] <= B[i])
{
smaller = true;
}
else
{
smaller = false;
}
}

}
return smaller;
}

/* MULTIPLY TWO VARIABLES */

function naiveMult(base, multOne, multTwo)
{
var total = [];
var addResult = [];
total[0] = 0;

//Check which array bigger minimize multiplications
if (multOne.length>multTwo.length){ mshort=multOne.length; mlong=multTwo.length;}
else { mshort=multOne.length; mlong=multTwo.length;}

for (var i = 0; i < mshort; i ++ )
{
multresult = [];
remainder = 0;
tempVal = 0;
tempDig = 0;
j = 0;

if(i > 0)
{
for(zero = 0; zero < i; zero ++ ) multresult[zero] = 0;
}

while(j < mlong)
{
intMult++;

tempVal = (multOne[i] * multTwo[j]) + remainder;
remainder = 0;

if (tempVal >= base)
{
tempDig = tempVal % base;
remainder = (tempVal - tempDig) / base;
multresult[j + i] = tempDig;
}
else
{
multresult[j + i] = tempVal;
}
j ++ ;
}

if(remainder != 0)
{
multresult[j + i] = remainder;
}
addResult=naiveAdd(base, total, multresult);
total=addResult;
}
return total;
}

/* SUBTRACT TWO VARIABLES */

function naiveSub(base, subOne, subTwo)
{

subOne.reverse();
subTwo.reverse();
lengthOne=subOne.length;
lengthTwo=subTwo.length;
for (i = 0; i < lengthOne; i ++ )
{
subOne[i] = parseInt(subOne[i]);
subTwo[i] = parseInt(subTwo[i]);
if (isNaN(subOne[i])) subOne[i] = 0;
if (isNaN(subTwo[i])) subTwo[i] = 0;
}


result = [];
for (i = 0; i < lengthOne; i ++ )
{
j = 0;

if (subOne[i] < subTwo[i])
{
subOne[i] += base;
j = i;
while (subOne[j + 1] == 0)
{
subOne[j + 1] += base - 1;
j ++ ;

}
subOne[j + 1] += - 1;
}
j = 0;
result[i] = subOne[i] - subTwo[i];

}

while (result[lengthOne - 1] == 0)
{
result.splice(lengthOne - 1, 1);
lengthOne += - 1;
}
return result;
}

/* ADD TWO VARIABLES */

function naiveAdd(base, arrOne, arrTwo)
{
document.calc.stats.value+="\n *I AM ADDING* "+arrOne[0]+" + "+arrTwo[0];
shortArr=[];
longArr=[];
addResult = [];
remainder = 0;
//Find shortest and longest array
if (arrOne.length >= arrTwo.length) {shortArr = arrTwo; longArr = arrOne;}
else {shortArr = arrOne;longArr = arrTwo;}
for (i = 0; i < shortArr.length; i ++ )
{
intAdd ++ ;
arrOne[i] = parseInt(arrOne[i]);
arrTwo[i] = parseInt(arrTwo[i]);
if (isNaN(arrOne[i])) arrOne[i] = 0;
if (isNaN(arrTwo[i])) arrTwo[i] = 0;
addResult[i] = arrOne[i] + arrTwo[i] + remainder;

if (addResult[i] >= base)
{
addResult[i] = addResult[i] - base;
remainder = 1;
}
else
{
remainder = 0;
}
}
//Copying values from the shorter string
while(i<longArr.length) {longArr[i]=parseInt(longArr[i]);addResult[i]=longArr[i]+remainder; remainder=0; i++;}
//If strings of equal lenght but there is a remainder;
if (remainder == 1) addResult[i++] = 1;
else addResult.splice(i, 1);
document.calc.stats.value+=" = "+ addResult +"\n";
return addResult;
}

/* MAIN */
function fetchValues()
{
intMult=0;
intAdd=0;
x=1;
y=1;
document.calc.result.value="";
document.calc.stats.value="";
document.calc.outbase.value="";
strEval = document.calc.eval.value;
base = document.calc.formbase.value;
genArr = strEval.split("*");
if(base!=10){
arrOne=newbase(genArr[0].split("").reverse(),base);
tempA=arrOne;
arrTwo=newbase(genArr[1],base);
tempB=arrTwo;
} else
{
arrOne=genArr[0].split("").reverse();

tempA=arrOne;
arrTwo=genArr[1].split("").reverse();
tempB=arrTwo;
}
out=naiveMult(base,arrOne,arrTwo);
document.calc.outbase.value +=tempA.reverse()+" * \n";
document.calc.outbase.value +=tempB.reverse()+"\n";
document.calc.stats.value +="Multiplications = "+intMult+"\n";
document.calc.stats.value +="Addition = "+intAdd+"\n";
tempC=out.reverse();
if(base<11){tempC=tempC.toString();
tempC=tempC.replace(/,/g,'')
}

document.calc.result.value +=" Product = " +tempC+"\n";
}
</SCRIPT>
<!DOCTYPE html>
<html lang="en">
<head><meta charset="utf-8"/></head>
<body bgcolor="gold" onload="fetchValues()">
<H1>Big numbers</H1><P>
<FORM name=calc onSubmit="fetchValues(); return false;">
<B>INPUT DEC-><input type=submit name="calc" value="Calc"> <input type="text" name="eval" value="25*24" size="300"><br>
BASE <input type="text" name="formbase" value="9" size="10"><br>
This calculation<input type="text" name="outbase" value="" size="60"><br>
<FONT COLOR="white">
RESULT<br>
<textarea name="result" rows="20" cols="120"></textarea><br>
STATUS</B><br>
<textarea name="stats" cols="120" rows="40" value=""></textarea>
</FORM>
</body>
</html>

JJ

4/18/2015 4:17:00 PM

0

On Wed, 15 Apr 2015 09:23:31 -0700 (PDT), jonas.thornvall@gmail.com wrote:
> Is there a way to specify that the operands is not base 10? Or do one have to program it? If so which bases are supported.

You can specify a number in octal. e.g. 023 is 19 in decimal.
Or in hexadecimal. e.g. 0x23 is 35 in decimal.

But you can't detect whether a number value was specified in which base.

Christoph M. Becker

4/18/2015 4:34:00 PM

0

JJ wrote:

> On Wed, 15 Apr 2015 09:23:31 -0700 (PDT), jonas.thornvall@gmail.com wrote:
>> Is there a way to specify that the operands is not base 10? Or do one have to program it? If so which bases are supported.
>
> You can specify a number in octal. e.g. 023 is 19 in decimal.

Unless in strict mode where octal literals are a syntax error.

--
Christoph M. Becker

Scott Sauyet

4/21/2015 3:39:00 PM

0

jonas.thornvall@gmail.com wrote wrote:

> I show you the plain conversion function and then the one to take it to
> bignumb. I have a compare function that compare two arrays *work*, and i
> have two arithmetic bignumb functions that takes arrays as arguments. The
> conversion need bignumb add, mult and subt which i've implemented. I find
> it easy to implement plain ideas, but very hard to adjust them dealing
> with arguments and arrays.
>
> [ ... much code removed ... ]
>
> How could it get so complicated?

I don't know.

I've not really been following your adventures in bignum very carefully.
They end up with what is to me walls of unreadable code, without any
useful explanation or challenging questions.

Because I have done something similar before in another language, I'm at
least somewhat curious, and would actually *like* to find your work
interesting.

If I understand correctly, you want a function to convert a number
specified in one base into another. That's fine. But these are not
standard Javascript numbers, but your implementations of bignums.
How are these represented? Are they arrays of integers representing
"digits" of your numbers? If so, is the most significant or least significant digit first? Do these represent just integers, fractions,
fixed "decimals", or some other format?

Without understanding this, I'm not likely to dig into code I find
poorly formatted in order to find problems, nor to offer my own
alternatives.

But I am curious, and might if I did understand your requirements
better, be willing to spend some time trying my own hand at the
issue. (The emphasis is on _might_!)

-- Scott

Dr J R Stockton

4/22/2015 3:29:00 PM

0

In comp.lang.javascript message <5aee3d05-e13b-40c1-845b-2db2eb48eb47@go
oglegroups.com>, Tue, 21 Apr 2015 08:39:14, Scott Sauyet
<scott.sauyet@gmail.com> posted:

>If I understand correctly, you want a function to convert a number
>specified in one base into another.
> ...

>But I am curious, and might if I did understand your requirements
>better, be willing to spend some time trying my own hand at the
>issue. (The emphasis is on _might_!)

Doing arithmetic in the new base, multiply each digit of the input by
the appropriate power of the old base, and accumulate the results.

You can currently see this in function ConvBas, starting on line 1557 of
LONGCALC via <http://www.merlyn.demon.co.uk/programs/00inde... the
function is indirectly invoked by function Fbas, starting on line 1603.

You will need to be able to read Borland Pascal or Delphi. The
following minimal demonstrations (in RPN) calculate the date of this
year's Easter Sunday respectively using bases 3 & 13.


C:\HOMEPAGE>longcalc 2015 3 bas #eg wrt wrt --> +11 +12

C:\HOMEPAGE>longcalc 2015 13 bas #eg wrt wrt --> +4 +5


CAUTION - www.merlyn.demon.co.uk is expected to vanish soon, sometime
appearing in a new guise with luck.

--
(c) John Stockton, nr London UK. ?@merlyn.demon.co.uk DOS 3.3, 6.20; WinXP.
Web <http://www.merlyn.demon.... - FAQqish topics, acronyms and links.
PAS EXE TXT ZIP via <http://www.merlyn.demon.co.uk/programs/00ind...
My DOS <http://www.merlyn.demon.co.uk/batfil... - also batprogs.htm.

Scott Sauyet

4/23/2015 11:18:00 AM

0

Dr J R Stockton wrote:
> Scott Sauyet posted:
>
>> If I understand correctly, you want a function to convert a number
>> specified in one base into another.
>> ...
>
>> But I am curious, and might if I did understand your requirements
>> better, be willing to spend some time trying my own hand at the
>> issue. (The emphasis is on _might_!)

> Doing arithmetic in the new base, multiply each digit of the input by
> the appropriate power of the old base, and accumulate the results.

Yes, the parts you removed from my response had to do with the OP's
unreadable code and poorly specified problem. My academic degrees are
in mathematics, and I find no particular difficulties in performing
arithematic in various bases, but there are real questions about number
representations in JS.

It's easy enough to represent numbers in bases up to 36 as strings, and
with a little ingenuity, it's quite possible to go significantly higher.
But if the OP wants to extend to arbitrary bases, then presumably there
is a need for arrays to represent the numbers, with each element standing
for a "digit" in the chosen base. (And even here the limited range of
Javascript integers restricts the bases, although I can't imagine that's
a real-world problem.) But if we know that this is the representation,
we still need to know how these "digits" are ordered. There are two
equally reasonable representations. Putting the least significant digit
first is somewhat easier to use for calculations but is less familiar.

-- Scott

(BTW, good luck with the rebirth of merlyn.demon)

JT

4/24/2015 9:54:00 AM

0

Den tisdag 21 april 2015 kl. 17:39:25 UTC+2 skrev Scott Sauyet:
> jonas.thornvall@gmail.com wrote wrote:
>
> > I show you the plain conversion function and then the one to take it to
> > bignumb. I have a compare function that compare two arrays *work*, and i
> > have two arithmetic bignumb functions that takes arrays as arguments. The
> > conversion need bignumb add, mult and subt which i've implemented. I find
> > it easy to implement plain ideas, but very hard to adjust them dealing
> > with arguments and arrays.
> >
> > [ ... much code removed ... ]
> >
> > How could it get so complicated?
>
> I don't know.
>
> I've not really been following your adventures in bignum very carefully.
> They end up with what is to me walls of unreadable code, without any
> useful explanation or challenging questions.
>
> Because I have done something similar before in another language, I'm at
> least somewhat curious, and would actually *like* to find your work
> interesting.
>
> If I understand correctly, you want a function to convert a number
> specified in one base into another. That's fine. But these are not
> standard Javascript numbers, but your implementations of bignums.
> How are these represented? Are they arrays of integers representing
> "digits" of your numbers? If so, is the most significant or least significant digit first? Do these represent just integers, fractions,
> fixed "decimals", or some other format?
>
> Without understanding this, I'm not likely to dig into code I find
> poorly formatted in order to find problems, nor to offer my own
> alternatives.
>
> But I am curious, and might if I did understand your requirements
> better, be willing to spend some time trying my own hand at the
> issue. (The emphasis is on _might_!)
>
> -- Scott

Well Scott i know it is a bit sloppy written and without the necessary comments for the structure of the bignumbs and the parameters/arguments of the function calls.

Right now i am on vacation, but i will pick it up when i get back. The number pairs sent to subtraction, add and multiply is just as you say stored in an Array where the indexes represent digitplaces (whatever that mean when the base is decimal encoded) at the index. I think add, subbtract and multiply functions expect the lowest digitvalue at index 0.

Regarding the real fractional parts within the base, i was thinking doing two functioncalls and add up the results rather then keeping track on the fractional delimiter at least when doing add and subtract? It seem more straightforward, and maybe even faster. With my approach it may even work for multiplication and division, with a Little customization. It is just multiple adds afterall.

I have also implemented something similar in the late 90-s and 80-s, initially in JavaScript but with a string approach. But later i moved onto Java for implementing other types of numbersystems fashioned of my own.

It seem to get easier as the program languages develops, unfortunately i think my programming skills not quite there, yet.

And as you say there is a limit using bases bigger than Javascript integer, and the arithmetic only will hold up to SQRT of integersize.

But moving base into an Array would help that or?
But it seem very convoluted.

I will Clean it up and comment, when i get back.