From 10f66a1285418ce3f3742b32b6ce23d93a475e64 Mon Sep 17 00:00:00 2001 From: Steve Ognibene Date: Wed, 10 Dec 2014 23:14:37 -0500 Subject: [PATCH] Add support for new call in big.js v3.0.0 --- big.js/big.js-tests.ts | 17 +++++++++++++++++ big.js/big.js.d.ts | 3 +++ 2 files changed, 20 insertions(+) diff --git a/big.js/big.js-tests.ts b/big.js/big.js-tests.ts index 6de9ee7cc..df6128314 100644 --- a/big.js/big.js-tests.ts +++ b/big.js/big.js-tests.ts @@ -230,4 +230,21 @@ function propertiesTest3() { y.c // '0' [0].toString() y.e // 0 y.s // -1 +} + +// see http://mikemcl.github.io/big.js/#faq +// "How can I simultaneously use different decimal places and/or rounding mode settings for different Big numbers?" +function testMultipleConstructors() { + + var Big10 = Big(); + + // Set the decimal places of division operations for each constructor. + Big.DP = 3; + Big10.DP = 10; + + var x = Big(5); + var y = Big10(5); + + x.div(3) // 1.667 + y.div(3) // 1.6666666667 } \ No newline at end of file diff --git a/big.js/big.js.d.ts b/big.js/big.js.d.ts index 4f6278a80..0e4ac48be 100644 --- a/big.js/big.js.d.ts +++ b/big.js/big.js.d.ts @@ -42,6 +42,9 @@ declare module BigJsLibrary { (value: string): BigJS; /** A decimal value. */ (value: BigJS): BigJS; + + /** A decimal value. */ + (): BigJS; } /** BigJS instance methods */