1
0
mirror of https://github.com/MikeMcl/decimal.js.git synced 2024-10-27 20:34:12 +00:00

Internal round function bugfix

This commit is contained in:
Michael Mclaughlin 2015-10-02 12:56:34 +01:00
parent bd6e6381b3
commit 277e8a8ad3
3 changed files with 11 additions and 6 deletions

View File

@ -2085,9 +2085,9 @@
r = r || xc[pr + 1] != null; r = r || xc[pr + 1] != null;
if ( rm < 4 if ( rm < 4
? ( i != null || r ) && ( rm == 0 || rm == ( x['s'] < 0 ? 3 : 2 ) ) ? ( i != null || r ) && ( rm == 0 || rm == ( sign < 0 ? 3 : 2 ) )
: i > j || i == j && ( rm == 4 || r || rm == 6 && xc[pr - 1] & 1 || : i > j || i == j && ( rm == 4 || r || rm == 6 && xc[pr - 1] & 1 ||
rm == ( x['s'] < 0 ? 8 : 7 ) ) ) { rm == ( sign < 0 ? 8 : 7 ) ) ) {
xc.length = pr; xc.length = pr;
@ -2138,6 +2138,7 @@
})(); })();
/* /*
* Perform division in the specified base. Called by div and convertBase. * Perform division in the specified base. Called by div and convertBase.
*/ */
@ -2695,6 +2696,8 @@
} }
/* /*
* Use 'exponentiation by squaring' for small integers. Called by convertBase and pow. * Use 'exponentiation by squaring' for small integers. Called by convertBase and pow.
*/ */
@ -2988,7 +2991,7 @@
sd -= x['e'] + 1; sd -= x['e'] + 1;
// 1, 0.1, 0.01, 0.001, 0.0001 etc. // 1, 0.1, 0.01, 0.001, 0.0001 etc.
xc[0] = mathpow( 10, sd % LOGBASE ); xc[0] = mathpow( 10, ( LOGBASE - sd % LOGBASE ) % LOGBASE );
x['e'] = -sd || 0; x['e'] = -sd || 0;
} else { } else {
@ -3360,6 +3363,8 @@
*/ */
/* /*
* Return a new Decimal whose value is the natural logarithm of n. * Return a new Decimal whose value is the natural logarithm of n.
* *

2
decimal.min.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long