Uploaded image for project: 'Compass '
  1. Compass
  2. COMPASS-3659

decimal128: should implement PartialOrd Trait

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • None
    • None
    • None
    • None

    Description

      bson crate requires to have a partial ord trait. This will be very tricky when comparing exponents and significands as numbers like `1x10^3` is equal to `1x10^2`. Good example of comparison logic is in the Java Implementation: https://github.com/mongodb/mongo-csharp-driver/blob/v2.8.1/src/MongoDB.Bson/ObjectModel/Decimal128.cs#L1901

       

      PartialOrd implementation example:
      impl PartialOrd for Person { fn partial_cmp(&self, other: &Person) -> Option<Ordering> { Some(self.cmp(other))
      }
      }

      Attachments

        Activity

          People

            irina.shestak@mongodb.com Irina Shestak (Inactive)
            irina.shestak@mongodb.com Irina Shestak (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: