Skip to content

Commit

Permalink
Make sqrt 50 % faster
Browse files Browse the repository at this point in the history
  • Loading branch information
mwallerb committed Sep 12, 2024
1 parent 0889f0d commit def3ead
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/sqrt.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ DDouble sqrt(DDouble a)
//
double x0_half = 0.5 / y0;
double delta_y = x0_half * (std::fma(-y0, y0, a.hi()) + a.lo());
DDouble y1 = ExDouble(y0).add_small(delta_y);
return y1;

assert (y0 + delta_y == y0);
return DDouble(y0, delta_y);
}

XPREC_API_EXPORT
Expand Down

0 comments on commit def3ead

Please sign in to comment.