(FPCore (x y z t)
:precision binary64
(- x (/ (* (* y 2.0) z) (- (* (* z 2.0) z) (* y t)))))
↓
(FPCore (x y z t)
:precision binary64
(if (<= z -1.05e-121)
(- x (* (* y 2.0) (/ z (- (* z (* 2.0 z)) (* y t)))))
(if (<= z 5e-150)
(- x (/ (* z -2.0) t))
(if (<= z 1.45e+65)
(- x (/ (* (* y 2.0) z) (- (* (* z 2.0) z) (* y t))))
(- x (/ y z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.05e-121) {
tmp = x - ((y * 2.0) * (z / ((z * (2.0 * z)) - (y * t))));
} else if (z <= 5e-150) {
tmp = x - ((z * -2.0) / t);
} else if (z <= 1.45e+65) {
tmp = x - (((y * 2.0) * z) / (((z * 2.0) * z) - (y * t)));
} else {
tmp = x - (y / z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x - (((y * 2.0d0) * z) / (((z * 2.0d0) * z) - (y * t)))
end function
↓
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-1.05d-121)) then
tmp = x - ((y * 2.0d0) * (z / ((z * (2.0d0 * z)) - (y * t))))
else if (z <= 5d-150) then
tmp = x - ((z * (-2.0d0)) / t)
else if (z <= 1.45d+65) then
tmp = x - (((y * 2.0d0) * z) / (((z * 2.0d0) * z) - (y * t)))
else
tmp = x - (y / z)
end if
code = tmp
end function
herbie shell --seed 2023073
(FPCore (x y z t)
:name "Numeric.AD.Rank1.Halley:findZero from ad-4.2.4"
:precision binary64
:herbie-target
(- x (/ 1.0 (- (/ z y) (/ (/ t 2.0) z))))
(- x (/ (* (* y 2.0) z) (- (* (* z 2.0) z) (* y t)))))