Closed szgabsz91 closed 1 year ago
Interesting, but the JavaScript parser doesn't recognise it appropiately so it doesn't seem practical to make the change.
const log = console.log;
log(Number('\u22123')) // NaN
log(Number('−3')) // NaN
log(Number('\u002d3')) // -3
log(Number('-3')) // -3
I didn't know that the output of these methods need to be handled correctly by the Number
constructor, but if this is a requirement, then I guess this will remain as it is. Thanks for the quick answer!
The following methods format the
BigNumber
instance into a string:toExponential
toFixed
toFormat
toJSON
toPrecision
toString
valueOf
If the
BigNumber
instance is negative, these methods use the U+002D character (hyphen-minus) as the minus sign.However, if I'm correct, it would be better to use the U+2212 character (minus sign), as it is visually and semantically a better option for this use case.
If this change request is accepted, I think I could also provide a PR if it helps.
Thank you!