Using big numbers in an Extension



I'm working on an extension that require me to process very large integers (> 50 digits).

I have previously used bignumber.js (https://github.com/MikeMcl/bignumber.js/) in Node, but can't seem to figure out how to use this library in a gnome-shell extension.

First, does there already exist methods I can use, aka BigNumber.js/BigDecimal.js, for processing large numbers in an extension?

If not, how do I use a library like bignumber.js in my extension?

I have tried this:

/* Include the library */
const ExtensionUtils = imports.misc.extensionUtils;
const Extension      = ExtensionUtils.getCurrentExtension();
const BigNumber    = Extension.imports.bignumbers;

/* Initialize */
let num = new BigNumber(0);

The last command throws this error:

TypeError: BigNumber is not a constructor

bleh...

Thanks in advance for any insights!


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]