Skip to content

Commit

Permalink
fix a bug in toString (oops)
Browse files Browse the repository at this point in the history
  • Loading branch information
Patashu committed Nov 22, 2021
1 parent ba0457a commit bfb3349
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions break_eternity.cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -747,11 +747,11 @@ var Decimal = /*#__PURE__*/function () {
}, {
key: "toString",
value: function toString() {
if (isNaN(this.layer) || isNaN(this.m) || isNaN(this.e)) {
if (isNaN(this.layer) || isNaN(this.sign) || isNaN(this.mag)) {
return "NaN";
}

if (this.e === Number.POSITIVE_INFINITY || this.layer === Number.POSITIVE_INFINITY) {
if (this.mag === Number.POSITIVE_INFINITY || this.layer === Number.POSITIVE_INFINITY) {
return this.sign === 1 ? "Infinity" : "-Infinity";
}

Expand Down
4 changes: 2 additions & 2 deletions break_eternity.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -745,11 +745,11 @@ var Decimal = /*#__PURE__*/function () {
}, {
key: "toString",
value: function toString() {
if (isNaN(this.layer) || isNaN(this.m) || isNaN(this.e)) {
if (isNaN(this.layer) || isNaN(this.sign) || isNaN(this.mag)) {
return "NaN";
}

if (this.e === Number.POSITIVE_INFINITY || this.layer === Number.POSITIVE_INFINITY) {
if (this.mag === Number.POSITIVE_INFINITY || this.layer === Number.POSITIVE_INFINITY) {
return this.sign === 1 ? "Infinity" : "-Infinity";
}

Expand Down
4 changes: 2 additions & 2 deletions break_eternity.js
Original file line number Diff line number Diff line change
Expand Up @@ -751,11 +751,11 @@
}, {
key: "toString",
value: function toString() {
if (isNaN(this.layer) || isNaN(this.m) || isNaN(this.e)) {
if (isNaN(this.layer) || isNaN(this.sign) || isNaN(this.mag)) {
return "NaN";
}

if (this.e === Number.POSITIVE_INFINITY || this.layer === Number.POSITIVE_INFINITY) {
if (this.mag === Number.POSITIVE_INFINITY || this.layer === Number.POSITIVE_INFINITY) {
return this.sign === 1 ? "Infinity" : "-Infinity";
}

Expand Down
2 changes: 1 addition & 1 deletion break_eternity.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "break_eternity.js",
"version": "1.1.0",
"version": "1.1.1",
"description": "A Javascript numerical library to represent numbers as large as 10^^1e308 and as small as 10^-10^^1e308. Sequel to break_infinity.js, designed for incremental games.",
"main": "dist/break_infinity.js",
"module": "dist/break_infinity.esm.js",
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1265,10 +1265,10 @@ export default class Decimal {
}

public toString(): string {
if (isNaN(this.layer) || isNaN(this.m) || isNaN(this.e)) {
if (isNaN(this.layer) || isNaN(this.sign) || isNaN(this.mag)) {
return "NaN";
}
if (this.e === Number.POSITIVE_INFINITY || this.layer === Number.POSITIVE_INFINITY) {
if (this.mag === Number.POSITIVE_INFINITY || this.layer === Number.POSITIVE_INFINITY) {
return this.sign === 1 ? "Infinity" : "-Infinity";
}

Expand Down

0 comments on commit bfb3349

Please sign in to comment.