(FPCore (x y z t a)
:precision binary64
(/ (* (* x y) z) (sqrt (- (* z z) (* t a)))))
↓
(FPCore (x y z t a)
:precision binary64
(if (<= z -4.2e+157)
(* y (- x))
(if (<= z 1e+95)
(* x (* y (/ z (sqrt (- (* z z) (* t a))))))
(* x (* y (/ z (+ z (* -0.5 (* a (/ t z))))))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -4.2e+157) {
tmp = y * -x;
} else if (z <= 1e+95) {
tmp = x * (y * (z / sqrt(((z * z) - (t * a)))));
} else {
tmp = x * (y * (z / (z + (-0.5 * (a * (t / z))))));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = ((x * y) * z) / sqrt(((z * z) - (t * a)))
end function
↓
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (z <= (-4.2d+157)) then
tmp = y * -x
else if (z <= 1d+95) then
tmp = x * (y * (z / sqrt(((z * z) - (t * a)))))
else
tmp = x * (y * (z / (z + ((-0.5d0) * (a * (t / z))))))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
return ((x * y) * z) / Math.sqrt(((z * z) - (t * a)));
}
↓
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -4.2e+157) {
tmp = y * -x;
} else if (z <= 1e+95) {
tmp = x * (y * (z / Math.sqrt(((z * z) - (t * a)))));
} else {
tmp = x * (y * (z / (z + (-0.5 * (a * (t / z))))));
}
return tmp;
}
def code(x, y, z, t, a):
tmp = 0
if z <= -4.2e+157:
tmp = y * -x
elif z <= 1e+95:
tmp = x * (y * (z / math.sqrt(((z * z) - (t * a)))))
else:
tmp = x * (y * (z / (z + (-0.5 * (a * (t / z))))))
return tmp
function code(x, y, z, t, a)
return Float64(Float64(Float64(x * y) * z) / sqrt(Float64(Float64(z * z) - Float64(t * a))))
end
↓
function code(x, y, z, t, a)
tmp = 0.0
if (z <= -4.2e+157)
tmp = Float64(y * Float64(-x));
elseif (z <= 1e+95)
tmp = Float64(x * Float64(y * Float64(z / sqrt(Float64(Float64(z * z) - Float64(t * a))))));
else
tmp = Float64(x * Float64(y * Float64(z / Float64(z + Float64(-0.5 * Float64(a * Float64(t / z)))))));
end
return tmp
end
function tmp = code(x, y, z, t, a)
tmp = ((x * y) * z) / sqrt(((z * z) - (t * a)));
end
↓
function tmp_2 = code(x, y, z, t, a)
tmp = 0.0;
if (z <= -4.2e+157)
tmp = y * -x;
elseif (z <= 1e+95)
tmp = x * (y * (z / sqrt(((z * z) - (t * a)))));
else
tmp = x * (y * (z / (z + (-0.5 * (a * (t / z))))));
end
tmp_2 = tmp;
end
\[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}
\]
Simplified53.8
\[\leadsto \color{blue}{x \cdot \left(y \cdot \frac{z}{\sqrt{z \cdot z - t \cdot a}}\right)}
\]
Proof
(*.f64 x (*.f64 y (/.f64 z (sqrt.f64 (-.f64 (*.f64 z z) (*.f64 t a)))))): 0 points increase in error, 0 points decrease in error
(Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 x y) (/.f64 z (sqrt.f64 (-.f64 (*.f64 z z) (*.f64 t a)))))): 1 points increase in error, 0 points decrease in error
(Rewrite=> associate-*r/_binary64 (/.f64 (*.f64 (*.f64 x y) z) (sqrt.f64 (-.f64 (*.f64 z z) (*.f64 t a))))): 2 points increase in error, 0 points decrease in error
(*.f64 (neg.f64 y) x): 0 points increase in error, 0 points decrease in error
(*.f64 (Rewrite<= mul-1-neg_binary64 (*.f64 -1 y)) x): 0 points increase in error, 0 points decrease in error
(Rewrite<= associate-*r*_binary64 (*.f64 -1 (*.f64 y x))): 3 points increase in error, 0 points decrease in error
if -4.2e157 < z < 1.00000000000000002e95
Initial program 11.7
\[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}
\]
Simplified9.0
\[\leadsto \color{blue}{x \cdot \left(y \cdot \frac{z}{\sqrt{z \cdot z - t \cdot a}}\right)}
\]
Proof
(*.f64 x (*.f64 y (/.f64 z (sqrt.f64 (-.f64 (*.f64 z z) (*.f64 t a)))))): 0 points increase in error, 0 points decrease in error
(Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 x y) (/.f64 z (sqrt.f64 (-.f64 (*.f64 z z) (*.f64 t a)))))): 1 points increase in error, 0 points decrease in error
(Rewrite=> associate-*r/_binary64 (/.f64 (*.f64 (*.f64 x y) z) (sqrt.f64 (-.f64 (*.f64 z z) (*.f64 t a))))): 2 points increase in error, 0 points decrease in error
if 1.00000000000000002e95 < z
Initial program 43.3
\[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}
\]
Simplified41.1
\[\leadsto \color{blue}{x \cdot \left(y \cdot \frac{z}{\sqrt{z \cdot z - t \cdot a}}\right)}
\]
Proof
(*.f64 x (*.f64 y (/.f64 z (sqrt.f64 (-.f64 (*.f64 z z) (*.f64 t a)))))): 0 points increase in error, 0 points decrease in error
(Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 x y) (/.f64 z (sqrt.f64 (-.f64 (*.f64 z z) (*.f64 t a)))))): 1 points increase in error, 0 points decrease in error
(Rewrite=> associate-*r/_binary64 (/.f64 (*.f64 (*.f64 x y) z) (sqrt.f64 (-.f64 (*.f64 z z) (*.f64 t a))))): 2 points increase in error, 0 points decrease in error
herbie shell --seed 2022343
(FPCore (x y z t a)
:name "Statistics.Math.RootFinding:ridders from math-functions-0.1.5.2"
:precision binary64
:herbie-target
(if (< z -3.1921305903852764e+46) (- (* y x)) (if (< z 5.976268120920894e+90) (/ (* x z) (/ (sqrt (- (* z z) (* a t))) y)) (* y x)))
(/ (* (* x y) z) (sqrt (- (* z z) (* t a)))))