Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect handling of "_" chars in decimal part of number #100

Closed
DanielBauman88 opened this issue May 10, 2023 · 1 comment
Closed

Incorrect handling of "_" chars in decimal part of number #100

DanielBauman88 opened this issue May 10, 2023 · 1 comment

Comments

@DanielBauman88
Copy link
Contributor

To see this run
println!("{}", BigDecimal::from_str("1_1.2_2").unwrap().to_string()); and you will see 1.122 as the output.

@DanielBauman88
Copy link
Contributor Author

Proposed fix: #99

DanielBauman88 added a commit to DanielBauman88/bigdecimal-rs that referenced this issue May 10, 2023
BigDecimal supports '_' chars as visual
seperators in number strings in the pre and
post "." parts of the number.

The counting of post "." digits however
counts all characters but it should exclude '_' chars.

The underscore support comes from BigDecimal's use of num-bigint
https://github.com/rust-num/num-bigint/blob/6f2b8e0fc218dbd0f49bebb8db2d1a771fe6bafa/src/biguint/convert.rs#L246

akubera#100
akubera pushed a commit that referenced this issue May 12, 2023
BigDecimal supports '_' chars as visual
seperators in number strings in the pre and
post "." parts of the number.

The counting of post "." digits however
counts all characters but it should exclude '_' chars.

The underscore support comes from BigDecimal's use of num-bigint
https://github.com/rust-num/num-bigint/blob/6f2b8e0fc218dbd0f49bebb8db2d1a771fe6bafa/src/biguint/convert.rs#L246

#100
akubera pushed a commit that referenced this issue May 12, 2023
BigDecimal supports '_' chars as visual
seperators in number strings in the pre and
post "." parts of the number.

The counting of post "." digits however
counts all characters but it should exclude '_' chars.

The underscore support comes from BigDecimal's use of num-bigint
https://github.com/rust-num/num-bigint/blob/6f2b8e0fc218dbd0f49bebb8db2d1a771fe6bafa/src/biguint/convert.rs#L246

#100
@akubera akubera closed this as completed May 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants