Skip to content

Commit 61878da

Browse files
committed
Address review suggestions
Will squash with previous commit for PR merge if all changes are agreed on.
1 parent 127dec1 commit 61878da

2 files changed

Lines changed: 8 additions & 18 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@
44
/.vscode/settings.json
55
benchmark/Cargo.lock
66
benchmark/target
7+
fuzz/target
8+
fuzz/Cargo.lock

float/src/math/trig.rs

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@ impl<R: Round> Context<R> {
4242
/// Returns the internal work context, the reduced argument `r`, and the quadrant `k % 4`.
4343
fn reduce_to_quadrant<const B: Word>(self, x: &Repr<B>) -> (Self, FBig<R, B>, Quadrant) {
4444
let work_context = self.compute_work_context_trig(x);
45-
let x_f = FBig::<R, B>::new(x.clone(), self)
46-
.with_precision(work_context.precision)
47-
.value();
45+
let x_f = FBig::<R, B>::new(work_context.repr_round(x.clone()).value(), work_context);
4846

4947
let pi = work_context.pi::<B>().value();
5048
let half_pi = &pi / 2;
@@ -300,9 +298,7 @@ impl<R: Round> Context<R> {
300298
let work_precision = self.precision + guard_digits;
301299
let work_context = Self::new(work_precision);
302300

303-
let x_f = FBig::<R, B>::new(x.clone(), *self)
304-
.with_precision(work_context.precision)
305-
.value();
301+
let x_f = FBig::<R, B>::new(work_context.repr_round(x.clone()).value(), work_context);
306302

307303
let res = work_context.asin_internal(&x_f);
308304
FpResult::Normal(res.with_precision(self.precision).map(|v| v.repr))
@@ -347,9 +343,7 @@ impl<R: Round> Context<R> {
347343
let work_precision = self.precision + guard_digits;
348344
let work_context = Self::new(work_precision);
349345

350-
let x_f = FBig::<R, B>::new(x.clone(), *self)
351-
.with_precision(work_context.precision)
352-
.value();
346+
let x_f = FBig::<R, B>::new(work_context.repr_round(x.clone()).value(), work_context);
353347

354348
let asin_x = work_context.asin_internal(&x_f);
355349
let pi = work_context.pi::<B>().value();
@@ -383,9 +377,7 @@ impl<R: Round> Context<R> {
383377
let work_precision = self.precision + guard_digits;
384378
let work_context = Self::new(work_precision);
385379

386-
let x_f = FBig::<R, B>::new(x.clone(), *self)
387-
.with_precision(work_context.precision)
388-
.value();
380+
let x_f = FBig::<R, B>::new(work_context.repr_round(x.clone()).value(), work_context);
389381
let res = work_context.atan_with_reduction(&x_f);
390382
FpResult::Normal(res.with_precision(self.precision).map(|v| v.repr))
391383
}
@@ -479,12 +471,8 @@ impl<R: Round> Context<R> {
479471
return FpResult::Normal(res.with_precision(self.precision).map(|v| v.repr));
480472
}
481473

482-
let y_f = FBig::<R, B>::new(y.clone(), *self)
483-
.with_precision(work_context.precision)
484-
.value();
485-
let x_f = FBig::<R, B>::new(x.clone(), *self)
486-
.with_precision(work_context.precision)
487-
.value();
474+
let y_f = FBig::<R, B>::new(work_context.repr_round(y.clone()).value(), work_context);
475+
let x_f = FBig::<R, B>::new(work_context.repr_round(x.clone()).value(), work_context);
488476

489477
match x_f.cmp(&FBig::<R, B>::ZERO) {
490478
Ordering::Greater => {

0 commit comments

Comments
 (0)