/third_party/decimal.js/test/modules/ |
H A D | config.js | 27 t(Decimal.config({}) === Decimal); 29 tx(function () {Decimal.config()}, "config()"); 30 tx(function () {Decimal.config(null)}, "config(null)"); 31 tx(function () {Decimal.config(undefined)}, "config(undefined)"); 32 tx(function () {Decimal.config(0)}, "config(0)"); 33 tx(function () {Decimal.config('')}, "config('')"); 34 tx(function () {Decimal.config('hi')}, "config('hi')"); 35 tx(function () {Decimal.config('123')}, "config('123')"); 37 Decimal [all...] |
H A D | Decimal.js | 3 T('Decimal', function () { 5 Decimal.config({ 17 T.assertEqualProps(coefficient, exponent, sign, new Decimal(n)); 100 T.assertEqual(expected, new Decimal(n).valueOf()); 167 tx(function () {new Decimal(' NaN')}, "' NaN'"); 168 tx(function () {new Decimal('NaN ')}, "'NaN '"); 169 tx(function () {new Decimal(' NaN ')}, "' NaN '"); 170 tx(function () {new Decimal(' -NaN')}, "' -NaN'"); 171 tx(function () {new Decimal(' +NaN')}, "' +NaN'"); 172 tx(function () {new Decimal(' [all...] |
H A D | sum.js | 7 T.assertEqualDecimal(expected, Decimal.sum.apply(Decimal, arguments)); 10 expected = new Decimal(0); 13 t('0', new Decimal(0)); 15 t(0, new Decimal('-10'), 0, 0, 0, 0, 0, 10); 17 t(1, '2', new Decimal(3), new Decimal('4'), -10); 18 t(new Decimal(-10), '9', new Decimal(0.01), 0.99); 20 expected = new Decimal(1 [all...] |
H A D | toNearest.js | 9 Decimal.config({ 22 t(!isMinusZero(new Decimal(0).toNearest(0))); 23 t( isMinusZero(new Decimal(-1).toNearest(0))); 24 t( isMinusZero(new Decimal(-0).toNearest(0))); 25 t(!isMinusZero(new Decimal(1).toNearest(0))); 26 t(!isMinusZero(new Decimal(1).toNearest(-0))); 27 t(!isMinusZero(new Decimal(1).toNearest(-3))); 28 t( isMinusZero(new Decimal(-1).toNearest(-3))); 31 T.assertEqual(expected, new Decimal(n).toNearest(v, rm).valueOf()); 94 Decimal [all...] |
H A D | toDP.js | 6 T.assertEqual(expected, new Decimal(n).toDP(dp, rm).valueOf()); 13 Decimal.config({ 22 T.assert(Decimal.prototype.toDP === Decimal.prototype.toDecimalPlaces); 484 tx(function () {new Decimal('12.345').toDP('2')}, ".toDP('2')"); 485 tx(function () {new Decimal('12.345').toDP(new Decimal('2'))}, ".toDP(new Decimal('2'))"); 486 tx(function () {new Decimal('12.345').toDP(null)}, ".toDP(null)"); 487 tx(function () {new Decimal('12.34 [all...] |
H A D | toPrecision.js | 6 T.assertEqual(expected, new Decimal(n).toPrecision(sd, rm)); 13 Decimal.config({ 107 Decimal.rounding = 0; 175 Decimal.rounding = 1; 235 Decimal.rounding = 2; 288 Decimal.rounding = 3; 344 Decimal.rounding = 4; 389 Decimal.rounding = 5; 444 Decimal.rounding = 6; 511 tx(function () {new Decimal(1.2 [all...] |
H A D | toExponential.js | 6 T.assertEqual(expected, new Decimal(n).toExponential(dp)); 13 Decimal.config({ 110 Decimal.rounding = 0; 161 Decimal.rounding = 1; 213 Decimal.rounding = 2; 261 Decimal.rounding = 3; 316 Decimal.rounding = 4; 369 Decimal.rounding = 5; 422 Decimal.rounding = 6; 471 Decimal [all...] |
H A D | toFixed.js | 6 T.assertEqual(expected, new Decimal(n).toFixed(dp)); 13 Decimal.config({ 110 Decimal.rounding = 0; 154 Decimal.rounding = 1; 195 Decimal.rounding = 2; 238 Decimal.rounding = 3; 281 Decimal.rounding = 4; 282 Decimal.toExpNeg = Decimal.toExpPos = 0; 324 Decimal [all...] |
H A D | toSD.js | 6 T.assertEqual(expected, new Decimal(n).toSD(sd, rm).valueOf()); 13 Decimal.config({ 22 T.assert(Decimal.prototype.toSD === Decimal.prototype.toSignificantDigits); 43 Decimal.precision = 5; 45 Decimal.rounding = 0; 48 Decimal.rounding = 1; 51 Decimal.rounding = 2; 54 Decimal.rounding = 3; 57 Decimal [all...] |
H A D | toFraction.js | 6 T.assertEqual(expected, new Decimal(n).toFraction(maxDenominator).toString()); 13 Decimal.config({ 203 t('1111,9', '123.45', new Decimal(10)); 204 t('2469,20', '123.45', new Decimal('123e399')); 205 t('2469,20', '123.45', new Decimal('123')); 207 tx(function () {new Decimal('123.45').toFraction('')}, ".toFraction('')"); 208 tx(function () {new Decimal('123.45').toFraction(' ')}, ".toFraction(' ')"); 209 tx(function () {new Decimal('123.45').toFraction('\t')}, ".toFraction('\t')"); 210 tx(function () {new Decimal('123.45').toFraction(NaN)}, ".toFraction(NaN)"); 211 tx(function () {new Decimal('123.4 [all...] |
H A D | clone.js | 9 Decimal.config({ 18 var D1 = Decimal.clone({ precision: 1 }); 19 var D2 = Decimal.clone({ precision: 2 }); 20 var D3 = Decimal.clone({ precision: 3 }); 21 var D4 = Decimal.clone({ precision: 4 }); 22 var D5 = Decimal.clone({ precision: 5 }); 23 var D6 = Decimal.clone({ precision: 6 }); 24 var D7 = Decimal.clone({ precision: 7 }); 25 var D8 = Decimal.clone(); 27 var D9 = Decimal [all...] |
H A D | immutability.js | 2 // Also tests each Decimal.prototype method against its equivalent Decimal method where applicable. 7 Decimal.config({ 34 (x = Decimal.random()), 38 (x = Decimal.random().plus(randInt())), 43 a = new Decimal(v[i]); 44 aa = new Decimal(v[i]); 46 b = k == 0.5 ? new Decimal(a) : a[k < 0.5 ? 'plus' : 'minus'](Decimal.random().plus(randInt())); 47 bb = new Decimal( [all...] |
H A D | dpSd.js | 6 T.assertEqual(dp, new Decimal(n).dp()); 7 T.assertEqual(dp, new Decimal(n).decimalPlaces()); 8 T.assertEqual(sd, new Decimal(n).sd(zs)); 9 T.assertEqual(sd, new Decimal(n).precision(zs)); 16 Decimal.config({ 65 tx(function () {new Decimal(1).precision(null)}, "new Decimal(1).precision(null)"); 66 tx(function () {new Decimal(1).sd(null)}, "new Decimal(1).sd(null)"); 67 tx(function () {new Decimal( [all...] |
H A D | intPow.js | 7 T.assertEqual(expected, new Decimal(n).pow(exp).valueOf()); 14 Decimal.config({ 118 Decimal.precision = 20; 129 Decimal.precision = 600; 410 Decimal.toExpNeg = Decimal.toExpPos = 0; 543 tx(function () {new Decimal('12.345').pow(void 0)}, ".pow(void 0)"); 544 tx(function () {new Decimal('12.345').pow(null)}, ".pow(null)"); 545 tx(function () {new Decimal('12.345').pow(true)}, ".pow(true)"); 546 tx(function () {new Decimal('12.34 [all...] |
H A D | random.js | 16 Decimal.precision = sd; 17 r = Decimal.random(); 19 r = Decimal.random(sd); 25 tx(function () { Decimal.random(Infinity) }, 'Infinity'); 26 tx(function () { Decimal.random('-Infinity') }, "'-Infinity'"); 27 tx(function () { Decimal.random(NaN) }, 'NaN'); 28 tx(function () { Decimal.random(null) }, 'null');
|
H A D | toNumber.js | 5 Decimal.config({ 16 T.assert(1 / new Decimal(n).toNumber() === Infinity); 28 T.assert(1 / new Decimal(n).toNumber() === -Infinity); 39 T.assertEqual(expected, new Decimal(n).toNumber());
|
H A D | mod.js | 6 T.assertEqual(expected, new Decimal(a).mod(b).valueOf()); 9 Decimal.config({ 84 new Decimal(1).mod('-0.100000000000000006') // '0.099999999999999946' 836 Decimal.modulo = 1; 852 Decimal.modulo = 3; 868 Decimal.modulo = 9; 884 Decimal.modulo = 6; 899 Decimal.precision = sd; 900 Decimal.rounding = rm; 901 T.assertEqual(expected, new Decimal( [all...] |
H A D | toOctal.js | 6 Decimal.precision = sd; 7 Decimal.rounding = rm; 8 T.assertEqual(expected, new Decimal(n).toOctal()); 11 Decimal.config({ 313 T.assertEqual(expected, new Decimal(n).toOctal(sd, rm));
|
H A D | toHex.js | 6 Decimal.precision = sd; 7 Decimal.rounding = rm; 8 T.assertEqual(expected, new Decimal(n).toHex()); 11 Decimal.config({ 326 T.assertEqual(expected, new Decimal(n).toHex(sd, rm));
|
H A D | toBinary.js | 6 Decimal.precision = sd; 7 Decimal.rounding = rm; 8 T.assertEqual(expected, new Decimal(n).toBinary()); 11 Decimal.config({ 346 T.assertEqual(expected, new Decimal(n).toBinary(sd, rm));
|
/third_party/python/Lib/test/ |
H A D | test_decimal.py | 11 These are the test cases for the Decimal module. 14 the Decimal arithmetic using the tests provided by Mike Cowlishaw. The latter 137 """Class which tests the Decimal class against the IBM test cases.""" 156 # Decimal behaves differently from decNumber for these testcases so these 202 # Name adapter to be able to change the Decimal and Context 267 # Decimal instance. 292 return self.decimal.Decimal(v, context) 496 # The following classes test the behaviour of Decimal according to PEP 327 499 '''Unit tests for Explicit Construction cases of Decimal.''' 502 Decimal [all...] |
H A D | test_statistics.py | 21 from decimal import Decimal namespace 38 >>> _nan_equal(Decimal('NAN'), Decimal('NAN')) 40 >>> _nan_equal(Decimal('sNAN'), Decimal('sNAN')) 42 >>> _nan_equal(Decimal('NAN'), Decimal('sNAN')) 44 >>> _nan_equal(Decimal(42), Decimal('NAN')) 52 >>> _nan_equal(float('NAN'), Decimal('NA [all...] |
H A D | test_fractions.py | 3 from decimal import Decimal namespace 151 _components(F(Decimal('1.1')))) 153 _components(F(Decimal('3.5e-2')))) 155 _components(F(Decimal('.000e20')))) 157 self.assertRaises(ValueError, F, Decimal('nan')) 158 self.assertRaises(ValueError, F, Decimal('snan')) 159 self.assertRaises(OverflowError, F, Decimal('inf')) 160 self.assertRaises(OverflowError, F, Decimal('-inf')) 324 self.assertEqual(F(0), F.from_decimal(Decimal("-0"))) 325 self.assertEqual(F(5, 10), F.from_decimal(Decimal("0. [all...] |
/third_party/decimal.js/ |
H A D | decimal.js | 7 * An arbitrary-precision Decimal type for JavaScript. 35 // The initial configuration properties of the Decimal constructor. 39 // Most of these values can be changed at run-time using the `Decimal.config` method. 42 // E.g. `Decimal.config({ precision: 20 });` 58 // `Decimal.rounding = 4;` 59 // `Decimal.rounding = Decimal.ROUND_HALF_UP;` 101 Decimal, inexact, noConflict, quadrant, 108 tag = '[object Decimal]', 125 // Decimal 4387 Decimal.prototype = P; global() class [all...] |
/third_party/python/Lib/test/test_asyncio/ |
H A D | test_context.py | 17 a = decimal.Decimal(x) / decimal.Decimal(y) 19 b = decimal.Decimal(x) / decimal.Decimal(y ** 2)
|