Skip to content

Commit

Permalink
Merge pull request #28 from JPZEBRA/revision
Browse files Browse the repository at this point in the history
Revise Speed
  • Loading branch information
JPZEBRA authored May 21, 2021
2 parents 03b9893 + 10ac836 commit b20c90e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
2 changes: 1 addition & 1 deletion calc2_js.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

<div width="100%" class="mid">

<p>Huge Number Calculator Ver.2 @ BASIC on JavaScript ( Version 0.8.4 )</p>
<p>Huge Number Calculator Ver.2 @ BASIC on JavaScript ( Version 0.8.5 )</p>

<canvas id="canvas01" width = "640" height = "480">HTML5 : canvas</canvas>

Expand Down
30 changes: 21 additions & 9 deletions lib/FloatedBigDigit.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* FLOATED BIG DIGIT CLASS */
/* CREATE 2021.02.06 */
/* REVISED 2021.05.21 */
/* Ver 0.8.4 */
/* Ver 0.8.5 */
/* Original by K-ARAI */


Expand All @@ -27,6 +27,10 @@ var floatedBigDigitCashedPI = false;
var floatedBigDigitCashPI;
var floatedBigDigitCashedPI_R;

var floatedBigDigitCashedLB = false;
var floatedBigDigitCashLB;
var floatedBigDigitCashedLB_L = 0;


/****************************************************************************/
/****************************************************************************/
Expand Down Expand Up @@ -59,6 +63,10 @@ function FreeFloatedBigDigit() {

floatedBigDigitCashedPI = false;

if(floatedBigDigitCashedLB) floatedBigDigitCashLB = NaN;

floatedBigDigitCashedLB = false;

}

/****************************************************************************/
Expand Down Expand Up @@ -245,13 +253,20 @@ function FloatedBigDigit() {
var rf = this.minus;
this.minus = false;

var C = new FloatedBigDigit();

C.set(1);
if( floatedBigDigitCashedLB && floatedBigDigitCashedLB_L != last_bit_boost) {
floatedBigDigitCashLB = NaN;
floatedBigDigitCashedLB = false;
}

C.shiftPoint = - ( C.N + floatedBigDigit_F*last_bit_boost );
if(!floatedBigDigitCashedLB) {
floatedBigDigitCashLB = new FloatedBigDigit();
floatedBigDigitCashedLB = true;
floatedBigDigitCashedLB_L = last_bit_boost;
floatedBigDigitCashLB.set(1);
floatedBigDigitCashLB.shiftPoint = - ( floatedBigDigitCashLB.N + floatedBigDigit_F*last_bit_boost );
}

var ret = !(this.Compare(C)>=0);
var ret = !(this.Compare(floatedBigDigitCashLB)>=0);

this.minus = rf;

Expand Down Expand Up @@ -3465,8 +3480,6 @@ function FloatedBigDigit() {

if(this.checkOver()) return floatedBigDigitERR;

if(stop) return floatedBigDigitERR;

return floatedBigDigitOK;

}
Expand All @@ -3493,7 +3506,6 @@ function FloatedBigDigit() {
var A = new FloatedBigDigit();
var B = new FloatedBigDigit();


A.Copy(V);
A.Mul(V);
A.sub(1);
Expand Down

0 comments on commit b20c90e

Please sign in to comment.