Skip to content

Negative ordering issue #5

@leontoeides

Description

@leontoeides

Hello,

Thank you for the great crate.

Unfortunately for me, I spent some time building something similar to decimal-bytes and found your crate after-the-fact.

I was looking at switching to your crate, wired it into my test framework, and found 1 issue:

use decimal_bytes::Decimal;
use rust_decimal::Decimal as RustDecimal;
use std::str::FromStr;

let a = Decimal::try_from(RustDecimal::from_str("-1.500001").unwrap()).unwrap();
let b = Decimal::try_from(RustDecimal::from_str("-1.5").unwrap()).unwrap();

// Fails: -1.500001 should be less than -1.5
assert!(a.as_bytes() < b.as_bytes());

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or requestpriority-lowLow priority issueuser-requestThis issue was directly requested by a user

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions