rust-decimal icon indicating copy to clipboard operation
rust-decimal copied to clipboard

from_str should support scientific notation

Open blastrock opened this issue 8 months ago • 1 comments

Hi,

I have a case where numbers might be in classical notation, or in scientific notation for very small numbers. I understand that from_str handles the first case, and from_scientific the second. This forces me to write code like:

Decimal::from_str(fields[1])
                            .or_else(|_| Decimal::from_scientific(fields[1]))

It would help me if from_str just handles any notation.

blastrock avatar Apr 20 '25 19:04 blastrock

I suspect this could fit nicely into the 2.0 branch.

Tony-Samuels avatar Apr 20 '25 22:04 Tony-Samuels