MikeMcl / decimal.js

An arbitrary-precision Decimal type for JavaScript
http://mikemcl.github.io/decimal.js
MIT License
6.45k stars 475 forks source link

add a static ZERO costant #159

Open demanzano opened 4 years ago

demanzano commented 4 years ago

maybe there is and I'vent seen, but..

I think it would be very useful and convenient to have a static costant for the zero valure.

Something like:

import {Decimal} from 'decimal.js';
let myvar = Decimal.ZERO;

exactly as in Java's BigDecimal class (which to be honest exports also other values, like ONE, TWO etc. to 10.

This would be useful to avoid make an instance in every file / class where zero is needed, and should be very very easy to implement in Decimal.js

thanks

Ale

MikeMcl commented 4 years ago

Okay, I'll consider it for the upcoming update.

demanzano commented 4 years ago

thanks !