Numeral-js icon indicating copy to clipboard operation
Numeral-js copied to clipboard

NaN returned if value < 1e-6

Open tab00 opened this issue 7 years ago • 8 comments

I need my app to display formatted values less than 0.00000100. However numeral returns NaN for such values.

Here are reproducible test cases:

console.log(`1e-8, ${numeral(1e-8).format('0,0.00000000')}`) //output: NaN
console.log(`1e-7, ${numeral(1e-7).format('0,0.00000000')}`) //output: NaN
console.log(`9e-7, ${numeral(9e-7).format('0,0.00000000')}`) //output: NaN
console.log(`9.999999e-7, ${numeral(9.999999e-7).format('0,0.00000000')}`) //output: NaN
console.log(`1e-6, ${numeral(1e-6).format('0,0.00000000')}`) //output: 0.00000100

Please fix this. Thank you.

tab00 avatar Oct 02 '17 10:10 tab00

I have the same problem. Everything below e-6 is not working. Any ideas how to fix this?

michaelvolz avatar Oct 11 '17 07:10 michaelvolz

This is a duplicate of #514 and #512. There are already several pull requests to fix it.

thmaterna avatar Oct 18 '17 12:10 thmaterna

@thmaterna @RaviDasari @JasonRammoray @adamwdraper Any update on the status of this issue?

There are 2 open issues, #512 and #563, and 2 PRs #564 and #514 open to fix this issue.

@adamwdraper would you be able to review #564? @thmaterna has noted #514 will not cover all cases.

turnerniles avatar Nov 09 '17 20:11 turnerniles

unfortunately, no update from @adamwdraper

RaviDasari avatar Nov 09 '17 20:11 RaviDasari

Has this repository been abandoned? We need a new maintainer to fix this problem that I still experience (and any other problems).

tab00 avatar Apr 11 '18 09:04 tab00

@tab00 see #431

lutangar avatar Apr 12 '18 07:04 lutangar

Have you tried numbro?

BenjaminVanRyseghem avatar Apr 12 '18 07:04 BenjaminVanRyseghem

fuck

huihongzhou avatar Mar 30 '21 12:03 huihongzhou