(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
(let* ((t_1 (- x (/ y z)))
(t_2 (- x (/ (* (* y 2.0) z) (- (* (* z 2.0) z) (* y t))))))
(if (<= z -4.8e+102)
t_1
(if (<= z -1e-161)
t_2
(if (<= z 1.4e-163)
(- x (/ (* -2.0 z) t))
(if (<= z 6.6e+54) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = x - (y / z);
double t_2 = x - (((y * 2.0) * z) / (((z * 2.0) * z) - (y * t)));
double tmp;
if (z <= -4.8e+102) {
tmp = t_1;
} else if (z <= -1e-161) {
tmp = t_2;
} else if (z <= 1.4e-163) {
tmp = x - ((-2.0 * z) / t);
} else if (z <= 6.6e+54) {
tmp = t_2;
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = x - (y / z)
t_2 = x - (((y * 2.0d0) * z) / (((z * 2.0d0) * z) - (y * t)))
if (z <= (-4.8d+102)) then
tmp = t_1
else if (z <= (-1d-161)) then
tmp = t_2
else if (z <= 1.4d-163) then
tmp = x - (((-2.0d0) * z) / t)
else if (z <= 6.6d+54) then
tmp = t_2
else
tmp = t_1
end if
code = tmp
end function
herbie shell --seed 2023010
(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)))))