Skip to content

Commit

Permalink
add a comment (to explain #52)
Browse files Browse the repository at this point in the history
  • Loading branch information
Patashu committed Nov 21, 2021
1 parent 41e72a3 commit ec07d30
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions dist/break_infinity.cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,7 @@ function () {
// But it's not clear how to specifically write that.
// So I'll just settle with 'exponent >= 0 and difference between rounded
// and not rounded < 1e-9' as a quick fix.
// UN-SAFETY: It still eventually fails. Since there's no way to know for sure we started with an integer, all we can do is decide what tradeoff we want between 'yeah I think this used to be an integer' and 'pfft, who needs THAT many decimal places tracked' by changing ROUND_TOLERANCE. https://github.com/Patashu/break_infinity.js/issues/52 Currently starts failing at 800002. Workaround is to do .Round() AFTER toNumber() if you are confident you started with an integer.
// var result = this.m*Math.pow(10, this.e);
if (!isFinite(this.e)) {
return Number.NaN;
Expand Down
1 change: 1 addition & 0 deletions dist/break_infinity.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,7 @@ function () {
// But it's not clear how to specifically write that.
// So I'll just settle with 'exponent >= 0 and difference between rounded
// and not rounded < 1e-9' as a quick fix.
// UN-SAFETY: It still eventually fails. Since there's no way to know for sure we started with an integer, all we can do is decide what tradeoff we want between 'yeah I think this used to be an integer' and 'pfft, who needs THAT many decimal places tracked' by changing ROUND_TOLERANCE. https://github.com/Patashu/break_infinity.js/issues/52 Currently starts failing at 800002. Workaround is to do .Round() AFTER toNumber() if you are confident you started with an integer.
// var result = this.m*Math.pow(10, this.e);
if (!isFinite(this.e)) {
return Number.NaN;
Expand Down
1 change: 1 addition & 0 deletions dist/break_infinity.js
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,7 @@
// But it's not clear how to specifically write that.
// So I'll just settle with 'exponent >= 0 and difference between rounded
// and not rounded < 1e-9' as a quick fix.
// UN-SAFETY: It still eventually fails. Since there's no way to know for sure we started with an integer, all we can do is decide what tradeoff we want between 'yeah I think this used to be an integer' and 'pfft, who needs THAT many decimal places tracked' by changing ROUND_TOLERANCE. https://github.com/Patashu/break_infinity.js/issues/52 Currently starts failing at 800002. Workaround is to do .Round() AFTER toNumber() if you are confident you started with an integer.
// var result = this.m*Math.pow(10, this.e);
if (!isFinite(this.e)) {
return Number.NaN;
Expand Down
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,8 @@ export default class Decimal {
// But it's not clear how to specifically write that.
// So I'll just settle with 'exponent >= 0 and difference between rounded
// and not rounded < 1e-9' as a quick fix.

// UN-SAFETY: It still eventually fails. Since there's no way to know for sure we started with an integer, all we can do is decide what tradeoff we want between 'yeah I think this used to be an integer' and 'pfft, who needs THAT many decimal places tracked' by changing ROUND_TOLERANCE. https://github.com/Patashu/break_infinity.js/issues/52 Currently starts failing at 800002. Workaround is to do .Round() AFTER toNumber() if you are confident you started with an integer.

// var result = this.m*Math.pow(10, this.e);

Expand Down

0 comments on commit ec07d30

Please sign in to comment.