MikeMcl / bignumber.js

A JavaScript library for arbitrary-precision decimal and non-decimal arithmetic
http://mikemcl.github.io/bignumber.js
MIT License
6.68k stars 742 forks source link

Enhancement: Add support for custom minus sign in toFormat method #289

Open skynightz opened 3 years ago

skynightz commented 3 years ago

It would be great to be able to specify a string or a character to customize negative sign of a value. It's using the character "hypen minus" (decimal code: 45) in your code and we want to use the "minus sign" (decimal code: 8722) instead.

Skywalker13 commented 3 years ago

ping.. please

MikeMcl commented 3 years ago

It's reasonable but the changes to the behaviour of toString would break creating a BigNumber from a BigNumber's toString value, which is unacceptable.

skynightz commented 3 years ago

I modified also the toString method because it was used in toFormat for the "-Infinity" case. it wasn't formating the string in this case. I can modify my PR to change only the toFormat method.

skynightz commented 3 years ago

I reverted my changes in toString method and handle the case for negative infinity in toFormat method.

MikeMcl commented 3 years ago

Okay, I'll take a look presently.