Andrew Kubera

Results 148 comments of Andrew Kubera

Yeah, that sounds good to me. I'm not familiar with implementing serde transformations. Is it essentially a function mapping `&str -> BigDecimal`? I've been splitting code into "impl" modules instead...

This is much needed, thanks. I think started that at some point, but I can't find the commits 😬 . Like the other traits, I'd like to break this out...

Regarding `EXPONENTIAL_FORMAT_THRESHOLD`, I think I'll make that a compile-time configurable; like [`RUST_BIGDECIMAL_DEFAULT_PRECISION`](https://github.com/akubera/bigdecimal-rs/blob/trunk/build.rs#L24C33-L24C33). Most people wont care, but someone might find it useful. It looks like Python's default decimal formatter only...

I found my [feature/impl-fmt](https://github.com/akubera/bigdecimal-rs/tree/feature/impl-fmt) branch. I rebased that onto trunk and I'll get your changes in there somewhere.

I applied your changes to the split file instead of `src/lib.rs`. [exponential-format](https://github.com/akubera/bigdecimal-rs/tree/exponential-format) Only significant change was moving the `format_exponential` out of the fmt method, and leaving the other code in...

One thing to note: I set `EXPONENTIAL_FORMAT_THRESHOLD = 2` (small value) and the exponential form is chosen when given a value like 7000: ``` println!("{}", BigDecimal::from(7000)); -> "7.000E3" ``` Is...

The special case `scale == 0` always means the BigDecimal is an integer, and the BigInt may be printed verbatim. So that's one.

Comparing to other libraries: ```java // Java import java.math.*; class BigDecimalTest { public static void main(String[] args) { String[] strs = new String[]{ "0.123", "0.000001", "0.0000001", "100", "100e3", "1000000000", "1000000000.00000",...

``` 0.1 -> 0.1 0.10 -> 0.10 0.100 -> 0.100 0.1000 -> 0.1000 ... 0.100000000 -> 0.100000000 ... 0.100000000000000000000000000 -> 0.100000000000000000000000000 ``` So trailing zeros don't matter. I think the...

Ok: We have decimal with digits ``` dddddddddd ``` Only thing that determines exponential is placement of the decimal point. Value or number of digits do not matter: ``` dddddddddd0…00.