We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Decimal128
Decimal256
Describe the bug Decimal128 as a example, we use the [u8;16] to store the value of the decimal.
In order to compare the decimal128, we should use the signed compare order.
But the current implementation just compare the [u8;16] to get the order.
For example: Decimal128(-1, 10,0).cmp(Decimal128(129,10,0) will get the result of Greater.
Decimal128(-1, 10,0)
Decimal128(129,10,0)
To Reproduce
#[test] fn compare_i128() { let v: i128 = -1; let b1: [u8; 16] = v.to_le_bytes(); let b2: [u8; 16] = 129_i128.to_le_bytes(); println!("{:?}", b1); println!("{:?}", b2); if b1.eq(&b2) { println!("=") } println!("{:?}", b1.cmp(&b2)); }
Expected behavior
Additional context
The text was updated successfully, but these errors were encountered:
FYI @viirya I will fix it.
Sorry, something went wrong.
Good catch!
liukun4515
Successfully merging a pull request may close this issue.
Describe the bug
Decimal128 as a example, we use the [u8;16] to store the value of the decimal.
In order to compare the decimal128, we should use the signed compare order.
But the current implementation just compare the [u8;16] to get the order.
For example:
Decimal128(-1, 10,0)
.cmp(Decimal128(129,10,0)
will get the result of Greater.To Reproduce
Expected behavior
Additional context
The text was updated successfully, but these errors were encountered: