Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decimals #1

Closed
fvdm opened this issue May 28, 2012 · 1 comment
Closed

Decimals #1

fvdm opened this issue May 28, 2012 · 1 comment

Comments

@fvdm
Copy link

fvdm commented May 28, 2012

Hello,

When using decimals they are floored to the nearest integer. Is it possible to use decimal numbers in Bignum?

Example:

console.log( bignum('1.618033988749895').toString() );
// result: 1
@justmoon
Copy link
Owner

justmoon commented Jun 4, 2012

Sorry, decimals aren't supported in the underlying library (openssl/bn.h) for this module, so they likely won't be added ever.

It might be possible to add this feature to node-bigint, which is based on libgmp, which does support decimals. But it would require some substantial effort.

Note that in many cases you can emulate fixed-length decimals just by calculating with integers and adding a decimal point whenever you print out the numbers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants