Skip to content
This repository has been archived by the owner on Apr 18, 2023. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixed #472
This issue was fixed with a PR from @Yaffle
  • Loading branch information
jiggzson committed Aug 9, 2019
1 parent fbccb77 commit 7e273c5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
@@ -1,3 +1,3 @@
language: node_js
node_js:
- "node"
- "10"
15 changes: 11 additions & 4 deletions nerdamer.core.js
Expand Up @@ -242,12 +242,21 @@ var nerdamer = (function (imports) {
sign = e / l,
coeff_array = parts[0].split('.');
if (sign === -1) {
num = zero + '.' + new Array(l).join(zero) + coeff_array.join('');
l = l - coeff_array[0].length;
if (l < 0) {
num = coeff_array[0].slice(0, l) + '.' + coeff_array[0].slice(l) + (coeff_array.length === 2 ? coeff_array[1] : '');
} else {
num = zero + '.' + new Array(l + 1).join(zero) + coeff_array.join('');
}
} else {
var dec = coeff_array[1];
if (dec)
l = l - dec.length;
num = coeff_array.join('') + new Array(l + 1).join(zero);
if (l < 0) {
num = coeff_array[0] + dec.slice(0, l) + '.' + dec.slice(l);
} else {
num = coeff_array.join('') + new Array(l + 1).join(zero);
}
}
}

Expand Down Expand Up @@ -10068,5 +10077,3 @@ var nerdamer = (function (imports) {
if ((typeof module) !== 'undefined') {
module.exports = nerdamer;
}

var x = nerdamer("(-x+1)^(-2)+((-x+1)^(-2)+(-x+1)^(-4)*x)");

0 comments on commit 7e273c5

Please sign in to comment.