Skip to content

Commit

Permalink
remove extra check
Browse files Browse the repository at this point in the history
  • Loading branch information
Manishearth committed Sep 30, 2024
1 parent 585cd2a commit 94f05ab
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
2 changes: 1 addition & 1 deletion tutorials/cpp/fixeddecimal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ int main() {
return 1;
}

decimal = FixedDecimal::from_double_with_floating_precision(100.01).ok().value();
decimal = FixedDecimal::from_double_with_round_trip_precision(100.01).ok().value();
out = fdf->format(*decimal.get());
std::cout << "Formatted float value is " << out << std::endl;
if (out != "১০০.০১") {
Expand Down
5 changes: 1 addition & 4 deletions utils/zerovec/src/varzerovec/components.rs
Original file line number Diff line number Diff line change
Expand Up @@ -563,16 +563,13 @@ where
predicate: impl FnMut(&T) -> Ordering,
range: Range<usize>,
) -> Option<Result<usize, usize>> {
if range.start > self.len() {
return None;
}
if range.end > self.len() {
return None;
}
if range.end < range.start {
return None;
}
// Safety: We bounds checked above
// Safety: We bounds checked above: end is in-bounds or len, and start is <= end
let range_absolute =
unsafe { self.binary_search_in_range_unchecked(predicate, range.clone()) };
// The values returned are relative to the range start
Expand Down

0 comments on commit 94f05ab

Please sign in to comment.