Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #27772 > unrolled thread
| Started by | jonas.thornvall@gmail.com |
|---|---|
| First post | 2015-05-20 06:11 -0700 |
| Last post | 2015-06-29 04:25 -0700 |
| Articles | 20 on this page of 83 — 11 participants |
Back to article view | Back to comp.lang.javascript
Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-05-20 06:11 -0700
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-05-20 06:37 -0700
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-05-20 17:58 +0200
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-21 09:12 -0700
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-21 09:33 -0700
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-21 10:13 -0700
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-21 11:08 -0700
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-21 11:10 -0700
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-06-21 21:45 +0100
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-21 13:49 -0700
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-06-22 01:19 +0100
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-21 20:24 -0700
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-06-22 20:52 +0100
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-23 05:31 -0700
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-23 23:37 +0200
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-06-24 00:13 +0200
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-22 06:51 +0200
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-22 09:15 -0700
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. Dr J R Stockton <reply1500@merlyn.demon.co.uk.invalid> - 2015-06-23 23:43 +0100
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-24 01:03 +0200
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-06-24 09:45 +0200
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-24 03:42 -0700
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-25 01:13 -0700
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-24 19:31 +0200
OT: English dictionaries (was: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase.) "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-06-24 19:54 +0200
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-25 01:57 -0700
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-06-25 12:44 +0200
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-25 04:09 -0700
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. John Harris <niam@jghnorth.org.uk.invalid> - 2015-06-25 15:08 +0100
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-25 09:30 -0700
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. Scott Sauyet <scott.sauyet@gmail.com> - 2015-06-25 13:12 -0700
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-06-25 22:21 +0200
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. Scott Sauyet <scott.sauyet@gmail.com> - 2015-06-25 13:28 -0700
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-25 15:56 -0700
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-27 19:33 -0700
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-27 19:45 -0700
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-06-28 09:17 +0200
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-28 02:10 -0700
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-28 02:21 -0700
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-28 02:24 -0700
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-06-28 17:04 +0200
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-28 08:23 -0700
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-06-28 17:47 +0200
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-29 04:12 -0700
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. Silvio <silvio@internet.com> - 2015-06-29 13:16 +0200
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-29 04:30 -0700
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-29 04:45 -0700
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. Silvio <silvio@internet.com> - 2015-06-29 13:51 +0200
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-29 05:08 -0700
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-29 05:13 -0700
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-29 05:19 -0700
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-29 05:27 -0700
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-29 05:38 -0700
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-06-29 14:26 +0100
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-29 06:44 -0700
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. Norman Peelman <npeelman@cfl.rr.com> - 2015-06-29 10:28 -0400
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-29 07:53 -0700
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-06-29 16:32 +0200
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-06-29 16:49 +0200
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-06-29 17:06 +0200
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-29 09:31 -0700
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-06-29 19:21 +0200
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. Tim Streater <timstreater@greenbee.net> - 2015-06-29 18:26 +0100
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-29 10:34 -0700
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-06-29 19:52 +0200
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-29 11:08 -0700
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-06-29 20:14 +0200
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. Tim Streater <timstreater@greenbee.net> - 2015-06-29 20:45 +0100
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-06-30 01:00 +0100
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-29 23:35 -0700
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-29 23:37 -0700
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-30 01:50 -0700
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-06-30 11:11 +0100
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-07-01 03:12 -0700
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-07-01 05:06 -0700
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-07-01 15:24 +0100
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-07-01 09:12 -0700
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-29 08:28 -0700
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-29 05:04 -0700
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. Silvio <silvio@internet.com> - 2015-06-29 14:37 +0200
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-29 04:19 -0700
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-06-29 13:22 +0200
Re: Bignumber conversion and arithmetic on unsigned operand pairs using +,-,* now work in anybase. jonas.thornvall@gmail.com - 2015-06-29 04:25 -0700
Page 4 of 5 — ← Prev page 1 2 3 [4] 5 Next page →
| From | jonas.thornvall@gmail.com |
|---|---|
| Date | 2015-06-29 09:31 -0700 |
| Message-ID | <0c96b541-acbe-4378-99bf-c3f2ac31ac15@googlegroups.com> |
| In reply to | #28223 |
Den måndag 29 juni 2015 kl. 17:06:21 UTC+2 skrev Evertjan.:
> "Christoph M. Becker" <cmbecker69@arcor.de> wrote on 29 Jun 2015 in
> comp.lang.javascript:
>
> > Evertjan. wrote:
> >
> >> jonas.thornvall@gmail.com wrote on 29 Jun 2015 in comp.lang.javascript:
> >>
> >>> for(y = 0; y < tOne.length; y ++ )
> >>> {
> >>> }
> >>
> >> This loop does not do a thing!!!!!!!!!
> >
> > Well, it does change the value of y, what might be an important
> > side-effect for Jonas' code.
>
> "y"? you mean "why"?
>
> Indeed this is the perfect way to say:
>
> y = tOne.length;
>
> --
> Evertjan.
> The Netherlands.
> (Please change the x'es to dots in my emailaddress)
Yes maybe for (tOne.length) do
Why isn't that a valid loop.
[toc] | [prev] | [next] | [standalone]
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
|---|---|
| Date | 2015-06-29 19:21 +0200 |
| Message-ID | <XnsA4C8C4E4D6273eejj99@194.109.6.166> |
| In reply to | #28225 |
jonas.thornvall@gmail.com wrote on 29 Jun 2015 in comp.lang.javascript:
> Den måndag 29 juni 2015 kl. 17:06:21 UTC+2 skrev Evertjan.:
>> "Christoph M. Becker" <cmbecker69@arcor.de> wrote on 29 Jun 2015 in
>> comp.lang.javascript:
>>
>> > Evertjan. wrote:
>> >
>> >> jonas.thornvall@gmail.com wrote on 29 Jun 2015 in comp.lang.javascript
>:
>> >>
>> >>> for(y = 0; y < tOne.length; y ++ )
>> >>> {
>> >>> }
>> >>
>> >> This loop does not do a thing!!!!!!!!!
>> >
>> > Well, it does change the value of y, what might be an important
>> > side-effect for Jonas' code.
>>
>> "y"? you mean "why"?
>>
>> Indeed this is the perfect way to say:
>>
>> y = tOne.length;
>
> Yes maybe for (tOne.length) do
No, that is just as stupid.
> Why isn't that a valid loop.
You are not listening, I never talked about "valid".
It just was stupid programming.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
[toc] | [prev] | [next] | [standalone]
| From | Tim Streater <timstreater@greenbee.net> |
|---|---|
| Date | 2015-06-29 18:26 +0100 |
| Message-ID | <290620151826022749%timstreater@greenbee.net> |
| In reply to | #28226 |
In article <XnsA4C8C4E4D6273eejj99@194.109.6.166>, Evertjan.
<exxjxw.hannivoort@inter.nl.net> wrote:
>jonas.thornvall@gmail.com wrote on 29 Jun 2015 in comp.lang.javascript:
>
>> Den måndag 29 juni 2015 kl. 17:06:21 UTC+2 skrev Evertjan.:
>>> "Christoph M. Becker" <cmbecker69@arcor.de> wrote on 29 Jun 2015 in
>>> comp.lang.javascript:
>>>
>>> > Evertjan. wrote:
>>> >
>>> >> jonas.thornvall@gmail.com wrote on 29 Jun 2015 in comp.lang.javascript
>>:
>>> >>
>>> >>> for(y = 0; y < tOne.length; y ++ )
>>> >>> {
>>> >>> }
>>> >>
>>> >> This loop does not do a thing!!!!!!!!!
>>> >
>>> > Well, it does change the value of y, what might be an important
>>> > side-effect for Jonas' code.
>>>
>>> "y"? you mean "why"?
>>>
>>> Indeed this is the perfect way to say:
>>>
>>> y = tOne.length;
>>
>> Yes maybe for (tOne.length) do
>
>No, that is just as stupid.
>
>> Why isn't that a valid loop.
>
>You are not listening, I never talked about "valid".
>
>It just was stupid programming.
Perhaps Jonas can explain why he wants to do:
for (y=0; y<tOne.length; y++)
{
}
rather than:
y = tOne.length;
What problem is the loop intended to solve?
--
"I love the way that Microsoft follows standards.
In much the same manner as fish follow migrating caribou."
- Paul Tomblin, ASR
[toc] | [prev] | [next] | [standalone]
| From | jonas.thornvall@gmail.com |
|---|---|
| Date | 2015-06-29 10:34 -0700 |
| Message-ID | <747f111f-43b3-4c72-ab1a-496c6428b88b@googlegroups.com> |
| In reply to | #28227 |
Den måndag 29 juni 2015 kl. 19:26:11 UTC+2 skrev Tim Streater:
> In article <XnsA4C8C4E4D6273eejj99@194.109.6.166>, Evertjan.
> <exxjxw.hannivoort@inter.nl.net> wrote:
>
> >jonas.thornvall@gmail.com wrote on 29 Jun 2015 in comp.lang.javascript:
> >
> >> Den måndag 29 juni 2015 kl. 17:06:21 UTC+2 skrev Evertjan.:
> >>> "Christoph M. Becker" <cmbecker69@arcor.de> wrote on 29 Jun 2015 in
> >>> comp.lang.javascript:
> >>>
> >>> > Evertjan. wrote:
> >>> >
> >>> >> jonas.thornvall@gmail.com wrote on 29 Jun 2015 in comp.lang.javascript
> >>:
> >>> >>
> >>> >>> for(y = 0; y < tOne.length; y ++ )
> >>> >>> {
> >>> >>> }
> >>> >>
> >>> >> This loop does not do a thing!!!!!!!!!
> >>> >
> >>> > Well, it does change the value of y, what might be an important
> >>> > side-effect for Jonas' code.
> >>>
> >>> "y"? you mean "why"?
> >>>
> >>> Indeed this is the perfect way to say:
> >>>
> >>> y = tOne.length;
> >>
> >> Yes maybe for (tOne.length) do
> >
> >No, that is just as stupid.
> >
> >> Why isn't that a valid loop.
> >
> >You are not listening, I never talked about "valid".
> >
> >It just was stupid programming.
>
> Perhaps Jonas can explain why he wants to do:
>
> for (y=0; y<tOne.length; y++)
> {
> }
>
> rather than:
>
> y = tOne.length;
>
> What problem is the loop intended to solve?
>
> --
> "I love the way that Microsoft follows standards.
> In much the same manner as fish follow migrating caribou."
> - Paul Tomblin, ASR
There never as a problem with that, they are just playing silly. The real problem is solved. Ugly solved but solved.
http://jt.node365.se/baseconversion8.html
Here is the code.
<html lang="en"><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"><script language="Javascript">
/* CONVERT A DECIMAL NUMBER INTO ANYBASE */
function newbase(decArr, base)
{
tempBase = base.toString();
baseArr = tempBase.split("").reverse();
digRes = [];
resultmult = [];
digit = 0;
oldigmult = [];
resultmult[0] = 1;
convArr = []
digits = 0;
for(i = 0; i < baseArr.length; i ++ )
{
baseArr[i] = parseInt(baseArr[i]);
}
for(i = 0; i < decArr.length; i ++ )
{
decArr[i] = parseInt(decArr[i]);
}
loop = true;
// document.calc.trash.value += "\n*LOOP USE BASE FIND CLOSEST EXPONENT THAT IS LESS THAN NUMBER* \n";
while(loop == true)
{
oldigmult[digits] = resultmult;
olddigits = digits;
orderArrayMult(10, baseArr, resultmult);
loop = arrCompareTwo(resultmult, decArr);
// document.calc.trash.value += "RETURNED VALUE ->" + loop + "\n";
digits ++ ;
}
while(olddigits >= 0)
{
resultmult = [];
counterArr = [];
looptwo = true;
mymin = 0;
mymax = base;
myval = parseInt(base / 2);
while (looptwo == true)
{
// document.calc.trash.value += "\nTry digit ->" + myval + "\n";
tOne = myval.toString();
myDig = [];
for(y = 0; y < tOne.length; y ++ )
{
tTwo = tOne.charAt(y);
myDig[y] = parseInt(tTwo);
}
myDig.reverse();
orderArrayMult(10, myDig, oldigmult[olddigits]);
multarr = resultmult.slice();
looptwo = arrCompareTwo(resultmult, decArr);
if (looptwo==true && olddigits>0){
mycomp=false;
unecessary=decArr.slice();
myremainder = naiveSub(10, unecessary, multarr);
//document.write(decArr);p.stop();
mycomp = arrCompareThree(myremainder,oldigmult[olddigits]);
if(mycomp==true){ break; }
}
if(found == true)
{
convArr[olddigits] = myDig;
break;
}
else
{
// document.calc.trash.value += "RETURNED VALUE ->" + looptwo + "\n";
// document.calc.trash.value += "MyVal=" + myDig + " ->MIN=" + mymin + " ->MAX=" + mymax + "\n";
if(looptwo == true && mymax != mymin + 1)
{
mymin = myval;
myval = mymin + ((mymax - mymin) / 2);
myval = parseInt(myval);
}
else
{
if (mymin + 1 == mymax)
{
looptwo = false;
}
else
{
looptwo = true;
mymax = myval;
myval = mymax - ((mymax - mymin) / 2);
myval = parseInt(myval);
}
}
}
}
myVar = myDig.join("");
document.calc.trash.value += "***FOUND NEWDIGIT*** ->" + myVar + "\n";
convArr[olddigits] = myVar;
olddigits -- ;
// document.calc.trash.value += "decArr- multarr ->" + decArr + " - " + multarr;
decArr = naiveSub(10, decArr, multarr);
// document.calc.trash.value += " = " + decArr + "\n";
checkifzero = decArr.join("");
testValZero = parseInt(checkifzero);
if(testValZero <= 0) { break; }
}
for(j = olddigits; j >= 0; j -- )
{
convArr[j] = 0;
}
return convArr;
}
function arrCompareThree(A, B)
{
found = false;
// document.calc.trash.value += "COMPARE resultmult < decarr TRUE, IF resultmult >= decarr FALSE \n" + A + " VS " + B + "\n";
var AA = A.length;
var BB = B.length;
if(AA > BB) return false;
if(AA < BB) return true;
// AA = BB, compare indexes from biggest to smallest.
for(i = AA - 1; i >= 0; i -- )
{
if(A[i] < B[i]) return true;
if(A[i] > B[i]) return false;
}
found = true;
return false;
}
/* COMPARE SIZE OF TWO ARRAYS, IF A < B RETURN TRUE, IF B >= A RETURN FALSE */
function arrCompareTwo(A, B)
{
found = false;
// document.calc.trash.value += "COMPARE resultmult < decarr TRUE, IF resultmult >= decarr FALSE \n" + A + " VS " + B + "\n";
var AA = A.length;
var BB = B.length;
if(AA > BB) return false;
if(AA < BB) return true;
// AA = BB, compare indexes from biggest to smallest.
for(i = AA - 1; i >= 0; i -- )
{
if(A[i] < B[i]) return true;
if(A[i] > B[i]) return false;
}
found = true;
return true;
}
/* COMPARE SIZE OF TWO ARRAYS, IF A < B RETURN TRUE, IF B >= A RETURN FALSE */
function lessThan(A, B)
{
var AA = A.length;
var BB = B.length;
if(AA > BB) return false;
if(AA < BB) return true;
// AA = BB, compare indexes from biggest to smallest.
for(i = AA - 1; i >= 0; i -- )
{
if(A[i] < B[i]) return true;
if(A[i] > B[i]) return false;
}
return false;
}
function orderArrayMult(Abase, A, B)
{
return lessThan(A, B) ? resultmult = naiveMult(Abase, B, A) : resultmult = naiveMult(Abase, A, B);
}
function prepMult(multOne, multTwo)
{
if(multOne.length > multTwo.length)
{
mbigArr = multOne.length;
msmallArr = multTwo.length
}
else
{
mbigArr = multTwo.length;
msmallArr = multOne.length;
}
}
/* MULTIPLY THE TWO VARIABLES STORED IN MULTONE AND MULTTWO USING THE CHOSEN BASE */
function naiveMult(base, multOne, multTwo)
{
prepMult(multOne, multTwo);
var total = [];
var addResult = [];
total[0] = 0;
for (var i = 0; i < msmallArr; i ++ )
{
multresult = [];
remainder = 0;
tempVal = 0;
tempDig = 0;
j = 0;
if(i > 0)
{
for(zero = 0; zero < i; zero ++ ) multresult[zero] = 0;
}
while(j < mbigArr)
{
intMult ++ ;
tempVal = (multOne[j] * multTwo[i]) + 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)
{
// Remainder after last digit multiplication
multresult[j + i] = remainder;
}
smallAddArr = multresult.length;
bigAddArr = total.length;
addResult = naiveAdd(base, multresult, total, smallAddArr, bigAddArr);
total = addResult;
}
while (total[total.length - 1] == 0 && total.length - 1 > 0)
{
total.splice(total.length - 1, 1)
}
// document.calc.trash.value += total + " = " + multOne + " * " + multTwo + "\n";
return total;
}
/* ADD TWO THE TWO VARIABLES STORED IN ADDONE AND ADDTWO USING CHOSEN BASE */
function naiveAdd(base, addOne, addTwo)
{
prepAdd(addOne, addTwo);
addResult = [];
remainder = 0;
for (i = 0; i < asmallArr; i ++ )
{
intAdd ++ ;
addOne[i] = parseInt(addOne[i]);
addTwo[i] = parseInt(addTwo[i]);
if (isNaN(addOne[i])) addOne[i] = 0;
if (isNaN(addTwo[i])) addTwo[i] = 0;
addResult[i] = addOne[i] + addTwo[i] + remainder;
if (addResult[i] >= base)
{
addResult[i] = addResult[i] - base;
remainder = 1;
intCarry ++ ;
}
else
{
remainder = 0;
}
}
// Copying values from the shorter string
while(i < abigArr)
{
addOne[i] = parseInt(addOne[i]);
addResult[i] = addOne[i] + remainder;
remainder = 0;
i ++ ;
}
// If strings of equal length but there is a remainder;
if (remainder == 1) addResult[i ++ ] = 1;
else addResult.splice(i, 1);
return addResult;
}
function prepAdd(addOne, addTwo)
{
if(addOne.length > addTwo.length)
{
abigArr = addOne.length;
asmallArr = addTwo.length
}
else
{
abigArr = addTwo.length;
asmallArr = addOne.length;
}
// Parse with zeros to get same length, and make sure they are integers.
// for (i = 0; i < bigArr; i ++ )
// {
// multOne[i] = parseInt(multOne[i]);
// multTwo[i] = parseInt(multTwo[i]);
// if (isNaN(multOne[i])) multOne[i] = 0;
// if (isNaN(multTwo[i])) multTwo[i] = 0;
// }
}
/* FIX THIS LATER */
function prepSubt(subOne, subTwo)
{
if(subOne.length > subTwo.length)
{
bigArr = subOne.length;
smallArr = subTwo.length
}
else
{
bigArr = subTwo.length;
smallArr = subOne.length;
}
// Parse with zeros to get same length, and make sure they are integers.
for (i = 0; i < bigArr; 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;
}
}
/* SUBTRACT THE TWO VARIABLES STORED IN SUBONE AND SUBTWO USING THE CHOSEN BASE */
function naiveSub(base, subOne, subTwo)
{
prepSubt(subOne, subTwo);
result = [];
for (i = 0; i < smallArr; i ++ )
{
j = 0;
if (subOne[i] < subTwo[i])
{
intBorrow ++ ;
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];
intSub ++ ;
}
while(i < bigArr)
{
result[i] = subOne[i];
i ++ ;
}
while (result[result.length - 1] == 0 && result.length - 1 > 0)
{
result.splice(result.length - 1, 1)
}
return result;
}
/* RESET FORM FIELDS, FETCH BASE AND STRING TO EVALUATE */
function fetchVal()
{
document.calc.stats.value = "";
strEval = document.calc.eval.value;
genArr[0] = strEval;
base = document.calc.formbase.value;
base = parseInt(base);
}
/* DO CONVERSION OF OPERANDS TO BASE OF CHOICE */
function baseConversion()
{
arrOne = genArr[0].split("").reverse();
arrOne = newbase(arrOne, base);
arrOne.reverse();
if (base < 11)
{
bout = arrOne.join("");
}
else
{
bout = arrOne
}
for(j = 0; j < arrOne.length; j ++ )
{
intRev = arrOne[j].toString();
arrOne[j] = intRev.split("").reverse().join("");
}
document.calc.stats.value += "Converted base digits = " + bout.length + "\n";
document.calc.stats.value += "Converted arrOne " + bout + "\n";
}
function orderArraySubt(Abase, A, B)
{
return lessThan(A, B) ? resultmult = naiveSub(Abase, B, A) : resultmult = naiveSub(Abase, A, B);
}
/* GLOBAL VARIABLES AND ARRAY FORMAT */
/* THE NOTATION OF NUMERALS USE BASE TEN, SO FOR INDEX VALUES IN ARRAY IF BASE 2000, DIGITVALUE IN INDEX RANGE = (0 - 1999) */
/* VARIABLES ARE STORED REVERSED IN ARRAY */
/* WITH A SINGLE "DIGITPLACE/VALUE" OF THE CHOSEN BASE, HOLD AT EACH INDEX */
function MAIN()
{
/* INIT GLOBAL VARIABLES START */
genArr = [];
baseArr = [];
resultmult = [];
plusOne = [];
plusOne[0] = 1;
arrOne = [];
arrTwo = [];
tempA = [];
tempB = [];
// Counters, adds, subtraction, multiplications
intMult = 0;
intAdd = 0;
intSub = 0;
intBorrow = 0;
intCarry = 0;
// Length of the operands
bigArr = 0;
smallArr = 0;
addBigLength = 0;
addSmallLength = 0;
baseStr = "";
// Reset variables from form
found = false;
base = 0;
strEval = "";
document.calc.stats.value = "";
document.calc.trash.value = "";
document.calc.trash.value += "Array VALUES printed out are reversed\n";
fetchVal();
// Get stringsvalues from form
/* INIT END */
/* MAIN FUNCTION */
document.calc.stats.value += "Operand A decimal digits = " + strEval.length + "\n";
// Do base conversion into the base fetched from form
baseConversion();
}
</script>
<meta charset="utf-8"></head>
<body onload="MAIN()" bgcolor="gold">
<h3>BIG NUMBERS BASE CONVERTER (anybase) version 0.0001 ;)</h3><p>
</p><form name="calc" onsubmit="MAIN(); return false;"><b>
<input name="calc" value="Calc" type="submit"> *use radiX* <input name="formbase" value="12665465" size="10" type="text"><br><br>
Trash print<br>
<textarea name="trash" rows="20" cols="120"></textarea><br>
Base 10 value to convert<br>
<textarea name="eval" rows="2" cols="120">568033323600758879410809882596518844427765050357579567802377727242529017498263537150538587023238433026677804323428505832968299373805879351860735336158759220288565102059486427874208964673321825501246550113428500464560132230624660243323716513335481349273825909086029515025224797847031305108944583217651567620935100716470501376</textarea><br>
New base out<br>
<textarea name="stats" rows="40" cols="120"></textarea>
</form>
</body>
</html>
[toc] | [prev] | [next] | [standalone]
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
|---|---|
| Date | 2015-06-29 19:52 +0200 |
| Message-ID | <XnsA4C8CA2F28E2Deejj99@194.109.6.166> |
| In reply to | #28228 |
jonas.thornvall@gmail.com wrote on 29 Jun 2015 in comp.lang.javascript:
> Den m†ndag 29 juni 2015 kl. 19:26:11 UTC+2 skrev Tim Streater:
>> In article <XnsA4C8C4E4D6273eejj99@194.109.6.166>, Evertjan.
>> <exxjxw.hannivoort@inter.nl.net> wrote:
>>
>> >jonas.thornvall@gmail.com wrote on 29 Jun 2015 in
>> >comp.lang.javascript:
>> >>> Indeed this is the perfect way to say:
>> >>>
>> >>> y = tOne.length;
>> >>
>> >> Yes maybe for (tOne.length) do
>> >
>> >No, that is just as stupid.
>> >
>> >> Why isn't that a valid loop.
>> >
>> >You are not listening, I never talked about "valid".
>> >
>> >It just was stupid programming.
>>
>> Perhaps Jonas can explain why he wants to do:
>>
>> for (y=0; y<tOne.length; y++)
>> {
>> }
>>
>> rather than:
>>
>> y = tOne.length;
>>
>> What problem is the loop intended to solve?
>
> There never as a problem with that, they are just playing silly. The
> real problem is solved. Ugly solved but solved.
Again you are not answering the Q posed.
It seems you are just having one long monologue on this NG,
and anyone replying to your mumbling,
perhaps in an effort to help you see your errors,
is simply ignored by you.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
[toc] | [prev] | [next] | [standalone]
| From | jonas.thornvall@gmail.com |
|---|---|
| Date | 2015-06-29 11:08 -0700 |
| Message-ID | <e28a46ad-df0c-4fa9-8aa7-5bdeee9562a4@googlegroups.com> |
| In reply to | #28229 |
Den måndag 29 juni 2015 kl. 19:52:35 UTC+2 skrev Evertjan.:
> jonas.thornvall@gmail.com wrote on 29 Jun 2015 in comp.lang.javascript:
>
> > Den m†ndag 29 juni 2015 kl. 19:26:11 UTC+2 skrev Tim Streater:
> >> In article <XnsA4C8C4E4D6273eejj99@194.109.6.166>, Evertjan.
> >> <exxjxw.hannivoort@inter.nl.net> wrote:
> >>
> >> >jonas.thornvall@gmail.com wrote on 29 Jun 2015 in
> >> >comp.lang.javascript:
> >> >>> Indeed this is the perfect way to say:
> >> >>>
> >> >>> y = tOne.length;
> >> >>
> >> >> Yes maybe for (tOne.length) do
> >> >
> >> >No, that is just as stupid.
> >> >
> >> >> Why isn't that a valid loop.
> >> >
> >> >You are not listening, I never talked about "valid".
> >> >
> >> >It just was stupid programming.
> >>
> >> Perhaps Jonas can explain why he wants to do:
> >>
> >> for (y=0; y<tOne.length; y++)
> >> {
> >> }
> >>
> >> rather than:
> >>
> >> y = tOne.length;
> >>
> >> What problem is the loop intended to solve?
> >
> > There never as a problem with that, they are just playing silly. The
> > real problem is solved. Ugly solved but solved.
>
> Again you are not answering the Q posed.
>
> It seems you are just having one long monologue on this NG,
> and anyone replying to your mumbling,
> perhaps in an effort to help you see your errors,
> is simply ignored by you.
>
> --
> Evertjan.
> The Netherlands.
> (Please change the x'es to dots in my emailaddress)
This answer will have to do for you!
http://jt.node365.se/baseconversion8.html
[toc] | [prev] | [next] | [standalone]
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
|---|---|
| Date | 2015-06-29 20:14 +0200 |
| Message-ID | <XnsA4C8CDFC0CACFeejj99@194.109.6.166> |
| In reply to | #28230 |
jonas.thornvall@gmail.com wrote on 29 Jun 2015 in comp.lang.javascript:
> Den måndag 29 juni 2015 kl. 19:52:35 UTC+2 skrev Evertjan.:
>> jonas.thornvall@gmail.com wrote on 29 Jun 2015 in comp.lang.javascript:
>>
>> > Den m†ndag 29 juni 2015 kl. 19:26:11 UTC+2 skrev Tim Streater:
>> >> In article <XnsA4C8C4E4D6273eejj99@194.109.6.166>, Evertjan.
>> >> <exxjxw.hannivoort@inter.nl.net> wrote:
>> >>
>> >> >jonas.thornvall@gmail.com wrote on 29 Jun 2015 in
>> >> >comp.lang.javascript:
>> >> >>> Indeed this is the perfect way to say:
>> >> >>>
>> >> >>> y = tOne.length;
>> >> >>
>> >> >> Yes maybe for (tOne.length) do
>> >> >
>> >> >No, that is just as stupid.
>> >> >
>> >> >> Why isn't that a valid loop.
>> >> >
>> >> >You are not listening, I never talked about "valid".
>> >> >
>> >> >It just was stupid programming.
>> >>
>> >> Perhaps Jonas can explain why he wants to do:
>> >>
>> >> for (y=0; y<tOne.length; y++)
>> >> {
>> >> }
>> >>
>> >> rather than:
>> >>
>> >> y = tOne.length;
>> >>
>> >> What problem is the loop intended to solve?
>> >
>> > There never as a problem with that, they are just playing silly. The
>> > real problem is solved. Ugly solved but solved.
>>
>> Again you are not answering the Q posed.
>>
>> It seems you are just having one long monologue on this NG,
>> and anyone replying to your mumbling,
>> perhaps in an effort to help you see your errors,
>> is simply ignored by you.
>
> This answer will have to do for you!
> http://jt.node365.se/baseconversion8.html
"will have to do for you"???
It was Tim, not me, that asked:
>> >> What problem is the loop intended to solve?
It seems you cannot put up the politeness of answering him.
Shame on you!
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
[toc] | [prev] | [next] | [standalone]
| From | Tim Streater <timstreater@greenbee.net> |
|---|---|
| Date | 2015-06-29 20:45 +0100 |
| Message-ID | <290620152045093638%timstreater@greenbee.net> |
| In reply to | #28231 |
In article <XnsA4C8CDFC0CACFeejj99@194.109.6.166>, Evertjan. <exxjxw.hannivoort@inter.nl.net> wrote: >It was Tim, not me, that asked: > >>> >> What problem is the loop intended to solve? > >It seems you cannot put up the politeness of answering him. Well, TBH, I don't care really. I already see that Jonas just talks to himself, mostly. I might even have entered this thread by mistake. -- "A committee is a cul-de-sac down which ideas are lured and then quietly strangled." - Sir Barnett Cocks (1907-1989)
[toc] | [prev] | [next] | [standalone]
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Date | 2015-06-30 01:00 +0100 |
| Message-ID | <871tgucbfb.fsf@bsb.me.uk> |
| In reply to | #28230 |
jonas.thornvall@gmail.com writes: <snip> > This answer will have to do for you! > http://jt.node365.se/baseconversion8.html Input 10000000 using base 100 gives Operand A decimal digits = 8 Converted base digits = 4 Converted arrOne 9,99,99,99 -- Ben.
[toc] | [prev] | [next] | [standalone]
| From | jonas.thornvall@gmail.com |
|---|---|
| Date | 2015-06-29 23:35 -0700 |
| Message-ID | <35879dd5-7311-41b8-8259-505ea5482934@googlegroups.com> |
| In reply to | #28235 |
Den tisdag 30 juni 2015 kl. 02:00:50 UTC+2 skrev Ben Bacarisse: > jonas.thornvall@gmail.com writes: > <snip> > > This answer will have to do for you! > > http://jt.node365.se/baseconversion8.html > > Input 10000000 using base 100 gives > > Operand A decimal digits = 8 > Converted base digits = 4 > Converted arrOne 9,99,99,99 > > -- > Ben. +1 ;)
[toc] | [prev] | [next] | [standalone]
| From | jonas.thornvall@gmail.com |
|---|---|
| Date | 2015-06-29 23:37 -0700 |
| Message-ID | <9e99d386-c7d1-4eb8-b56e-66147fcc0f72@googlegroups.com> |
| In reply to | #28235 |
Den tisdag 30 juni 2015 kl. 02:00:50 UTC+2 skrev Ben Bacarisse: > jonas.thornvall@gmail.com writes: > <snip> > > This answer will have to do for you! > > http://jt.node365.se/baseconversion8.html > > Input 10000000 using base 100 gives > > Operand A decimal digits = 8 > Converted base digits = 4 > Converted arrOne 9,99,99,99 > > -- > Ben. http://jt.node365.se/baseconversion5.html Well this version work but is slower, i will remove comments and put timer on all versions. And see if the changes really gave a positive effect, "beside the bug".
[toc] | [prev] | [next] | [standalone]
| From | jonas.thornvall@gmail.com |
|---|---|
| Date | 2015-06-30 01:50 -0700 |
| Message-ID | <be4b46ed-4628-4228-b936-31565dfac3c5@googlegroups.com> |
| In reply to | #28235 |
Den tisdag 30 juni 2015 kl. 02:00:50 UTC+2 skrev Ben Bacarisse: > jonas.thornvall@gmail.com writes: > <snip> > > This answer will have to do for you! > > http://jt.node365.se/baseconversion8.html > > Input 10000000 using base 100 gives > > Operand A decimal digits = 8 > Converted base digits = 4 > Converted arrOne 9,99,99,99 > > -- > Ben. Thank you, for finding the bug Ben, it turned out i did basicly same thing two times. One of the times was the more general case and that turned out to do the correct thing. jt.node365.se/baseconversion9.html It still bug out on very big numbers if base outside integer scope. I am very keen on suggestions regarding the logic to make it faster. I will read in base into an array holding bignumb, and then it should work for anybase and any number as far i can understand.
[toc] | [prev] | [next] | [standalone]
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Date | 2015-06-30 11:11 +0100 |
| Message-ID | <87k2ulbj4t.fsf@bsb.me.uk> |
| In reply to | #28240 |
jonas.thornvall@gmail.com writes: <snip> > Thank you, for finding the bug Ben, it turned out i did basicly same > thing two times. One of the times was the more general case and that > turned out to do the correct thing. > > jt.node365.se/baseconversion9.html Still looks buggy. Try Ian's example of duplicating the digits in your test number (that's the Ian who posted in reply to your off-topic comp.lang.python post). Python, by the way, is a very good way to test your code. (I used Haskell but that's just because I know Haskell better.) <snip> -- Ben.
[toc] | [prev] | [next] | [standalone]
| From | jonas.thornvall@gmail.com |
|---|---|
| Date | 2015-07-01 03:12 -0700 |
| Message-ID | <2e7a2de5-c9e2-417e-b450-d09814f3a760@googlegroups.com> |
| In reply to | #28241 |
Den tisdag 30 juni 2015 kl. 12:11:53 UTC+2 skrev Ben Bacarisse: > jonas.thornvall@gmail.com writes: > <snip> > > Thank you, for finding the bug Ben, it turned out i did basicly same > > thing two times. One of the times was the more general case and that > > turned out to do the correct thing. > > > > jt.node365.se/baseconversion9.html > > Still looks buggy. Try Ian's example of duplicating the digits in your > test number (that's the Ian who posted in reply to your off-topic > comp.lang.python post). Python, by the way, is a very good way to test > your code. (I used Haskell but that's just because I know Haskell > better.) > > <snip> > -- > Ben. If i could find the first number and base bug occure maybe i could resolve it. I am pondering to make a counter working up base and numbers in each base upto 10000 for bigger bases than 5 digits and up i generate a random number until the sanity check returns false. Here is the new version that detect if the number correct converted. http://jt.node365.se/baseconversion10.html
[toc] | [prev] | [next] | [standalone]
| From | jonas.thornvall@gmail.com |
|---|---|
| Date | 2015-07-01 05:06 -0700 |
| Message-ID | <543f955c-05d3-474e-a507-a764197c916f@googlegroups.com> |
| In reply to | #28241 |
Den tisdag 30 juni 2015 kl. 12:11:53 UTC+2 skrev Ben Bacarisse: > jonas.thornvall@gmail.com writes: > <snip> > > Thank you, for finding the bug Ben, it turned out i did basicly same > > thing two times. One of the times was the more general case and that > > turned out to do the correct thing. > > > > jt.node365.se/baseconversion9.html > > Still looks buggy. Try Ian's example of duplicating the digits in your > test number (that's the Ian who posted in reply to your off-topic > comp.lang.python post). Python, by the way, is a very good way to test > your code. (I used Haskell but that's just because I know Haskell > better.) > > <snip> > -- > Ben. I have an idea that there somehow come a leading zero in the buffert. And then the counter goes to base-1? And it breaks only because no more digits, the number still not broken down. So it is probably a reset of an array somewhere that has to happen.
[toc] | [prev] | [next] | [standalone]
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Date | 2015-07-01 15:24 +0100 |
| Message-ID | <87h9po9cqw.fsf@bsb.me.uk> |
| In reply to | #28248 |
jonas.thornvall@gmail.com writes: > Den tisdag 30 juni 2015 kl. 12:11:53 UTC+2 skrev Ben Bacarisse: >> jonas.thornvall@gmail.com writes: <snip> >> > jt.node365.se/baseconversion9.html >> >> Still looks buggy. <snip> > I have an idea that there somehow come a leading zero in the > buffert. And then the counter goes to base-1? And it breaks only > because no more digits, the number still not broken down. > > So it is probably a reset of an array somewhere that has to happen. At some point, the trouble you are ahving should suggest that the code is not easy to test verify or debug. You've already added in what is probably an unnecessary array copy to side step one bug, and this remark sounds like you are all set up to hack the code in some other way. How will you know there is not another bug and another and another just waiting to be tripped over? You need to restructure the code so that it is easy to reason about, test and debug. -- Ben.
[toc] | [prev] | [next] | [standalone]
| From | jonas.thornvall@gmail.com |
|---|---|
| Date | 2015-07-01 09:12 -0700 |
| Message-ID | <55fe300e-5452-4586-9094-208f1d80389c@googlegroups.com> |
| In reply to | #28249 |
Den onsdag 1 juli 2015 kl. 16:25:05 UTC+2 skrev Ben Bacarisse: > jonas.thornvall@gmail.com writes: > > > Den tisdag 30 juni 2015 kl. 12:11:53 UTC+2 skrev Ben Bacarisse: > >> jonas.thornvall@gmail.com writes: > <snip> > >> > jt.node365.se/baseconversion9.html > >> > >> Still looks buggy. > <snip> > > I have an idea that there somehow come a leading zero in the > > buffert. And then the counter goes to base-1? And it breaks only > > because no more digits, the number still not broken down. > > > > So it is probably a reset of an array somewhere that has to happen. > > At some point, the trouble you are ahving should suggest that the code > is not easy to test verify or debug. You've already added in what is > probably an unnecessary array copy to side step one bug, and this remark > sounds like you are all set up to hack the code in some other way. How > will you know there is not another bug and another and another just > waiting to be tripped over? > > You need to restructure the code so that it is easy to reason about, > test and debug. > > -- > Ben. This is a try of debug. http://jt.node365.se/baseconversion10.html
[toc] | [prev] | [next] | [standalone]
| From | jonas.thornvall@gmail.com |
|---|---|
| Date | 2015-06-29 08:28 -0700 |
| Message-ID | <5fecfd01-1131-450e-a23c-7bab6ea7f672@googlegroups.com> |
| In reply to | #28221 |
Den måndag 29 juni 2015 kl. 16:49:57 UTC+2 skrev Christoph M. Becker:
> Evertjan. wrote:
>
> > jonas.thornvall@gmail.com wrote on 29 Jun 2015 in comp.lang.javascript:
> >
> >> for(y = 0; y < tOne.length; y ++ )
> >> {
> >> }
> >
> > This loop does not do a thing!!!!!!!!!
>
> Well, it does change the value of y, what might be an important
> side-effect for Jonas' code.
>
> --
> Christoph M. Becker
I the error might be the branch tree, that was not the case it was Javascript instantiation of variables very unintuitive. But i bypassed the problem.
[toc] | [prev] | [next] | [standalone]
| From | jonas.thornvall@gmail.com |
|---|---|
| Date | 2015-06-29 05:04 -0700 |
| Message-ID | <4efc1509-a081-479f-a538-388b4eab08c7@googlegroups.com> |
| In reply to | #28202 |
Den måndag 29 juni 2015 kl. 13:16:53 UTC+2 skrev Silvio:
> On 06/29/2015 01:12 PM, jonas.thornvall@gmail.com wrote:
> > Den söndag 28 juni 2015 kl. 17:23:06 UTC+2 skrev jonas.t...@gmail.com:
> >> Den söndag 28 juni 2015 kl. 17:04:46 UTC+2 skrev Evertjan.:
> >>> jonas.thornvall@gmail.com wrote on 28 Jun 2015 in comp.lang.javascript:
> >>>
> >>>> Well it isn't broken anymore maybe you should flush the cache of your
> >>>> browser.
> >>>
> >>> I don't use a browser for usenet.
> >>>
> >>> --
> >>> Evertjan.
> >>> The Netherlands.
> >>> (Please change the x'es to dots in my emailaddress)
> >>
> >> Well i thought you did run the script, i was wrong.
> >>
> >> I made one further "?improvement" to increase speed, but somethings goes wrong in the GCD. It do quit faster for values in power range but the GCD do suddenly set wrong value, and i can't quite figure out why.
> >>
> >> Well there is no impromvent until this change also work, but it is a sketch, of an improvement.
> >> http://jt.node365.se/baseconversion6.html
> >
> > if (looptwo==true){
> > mycomp=false;
> > myremainder = naiveSub(10, decArr, multarr);
> > mycomp = arrCompareThree(myremainder,oldigmult[olddigits]);
> > if(mycomp==true){break;}
> > }
> > This code somehow manage to change the value of looptwo, but i do not see how.
> >
>
> Since you persist the stupid habit of using global variables everywhere
> (although being advised not to about a hundred times) my guess would be
> that looptwo is global and either naiveSub or arrCompareThree (or both)
> modify the variable.
I was wrong you are correct, the IF clause is called before, but i can't see how the call of arrCompare could possibly change the looptwo value. It uses it's own boolean.
mycomp = arrCompareThree(myremainder,oldigmult[olddigits]);
[toc] | [prev] | [next] | [standalone]
| From | Silvio <silvio@internet.com> |
|---|---|
| Date | 2015-06-29 14:37 +0200 |
| Message-ID | <55913c0f$0$2882$e4fe514c@news.xs4all.nl> |
| In reply to | #28209 |
On 06/29/2015 02:04 PM, jonas.thornvall@gmail.com wrote: > Den måndag 29 juni 2015 kl. 13:16:53 UTC+2 skrev Silvio: > > I was wrong you are correct, the IF clause is called before, but i can't see how the call of arrCompare could possibly change the looptwo value. It uses it's own boolean. > > mycomp = arrCompareThree(myremainder,oldigmult[olddigits]); > I would not know but unless you use the "var" keyword when initializing variables inside a function the variable will be global and thus introduce a dependency between the function and all code outside it (or even inside a recursive call of the same function).
[toc] | [prev] | [next] | [standalone]
Page 4 of 5 — ← Prev page 1 2 3 [4] 5 Next page →
Back to top | Article view | comp.lang.javascript
csiph-web