Skip to content

Commit

Permalink
restore some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bksaiki committed Feb 27, 2024
1 parent 3b35327 commit cadafb3
Show file tree
Hide file tree
Showing 3 changed files with 232 additions and 266 deletions.
2 changes: 1 addition & 1 deletion src/rfloat/round.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ impl RFloatContext {
Some(c) => c,
None => Integer::zero(),
};

// rounding bits
let (halfway_bit, sticky_bit) = split.rs();

Expand Down
11 changes: 8 additions & 3 deletions src/split.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use num_traits::Zero;
use rug::Integer;

use crate::{util::*, RoundingContext};
use crate::rfloat::RFloat;
use crate::Real;
use crate::{util::*, RoundingContext};

/// Result of splitting a [`Real`] at binary digit `n`.
#[derive(Clone, Debug)]
Expand Down Expand Up @@ -66,7 +66,12 @@ impl Split {
pub fn new<T: Real>(num: &T, max_p: Option<usize>, n: isize) -> Self {
assert!(!num.is_nar(), "must be real {:?}", num);
let (high, low) = Self::split(num, n);
Self { high, low, max_p, n }
Self {
high,
low,
max_p,
n,
}
}

/// Extracts the upper value of the split.
Expand Down Expand Up @@ -103,7 +108,7 @@ impl Split {
}

/// Rounds this [`Split`] according to a [`RoundingContext`].
pub fn round<Ctx: RoundingContext>(&self, ctx: &Ctx) -> Ctx::Format {
pub fn round<Ctx: RoundingContext>(&self, ctx: &Ctx) -> Ctx::Format {
ctx.round_split(self.to_owned())
}
}

0 comments on commit cadafb3

Please sign in to comment.