(FPCore (x y z t a)
:precision binary64
(/ (* (* x y) z) (sqrt (- (* z z) (* t a)))))
↓
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (* z z) (* a t))))
(if (<= z -1e+68)
(/ (* x y) (/ (- (* 0.5 (/ a (/ z t))) z) z))
(if (<= z -2.95e-161)
(* y (/ x (/ (sqrt t_1) z)))
(if (<= z 4.2e-177)
(* x (* y (* z (pow (exp -0.5) (+ (log (- t)) (log a))))))
(if (<= z 0.1)
(* x (* y (* z (pow t_1 -0.5))))
(/ (* x y) (sqrt (- 1.0 (* (/ t z) (/ a z)))))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z * z) - (a * t);
double tmp;
if (z <= -1e+68) {
tmp = (x * y) / (((0.5 * (a / (z / t))) - z) / z);
} else if (z <= -2.95e-161) {
tmp = y * (x / (sqrt(t_1) / z));
} else if (z <= 4.2e-177) {
tmp = x * (y * (z * pow(exp(-0.5), (log(-t) + log(a)))));
} else if (z <= 0.1) {
tmp = x * (y * (z * pow(t_1, -0.5)));
} else {
tmp = (x * y) / sqrt((1.0 - ((t / z) * (a / 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) :: t_1
real(8) :: tmp
t_1 = (z * z) - (a * t)
if (z <= (-1d+68)) then
tmp = (x * y) / (((0.5d0 * (a / (z / t))) - z) / z)
else if (z <= (-2.95d-161)) then
tmp = y * (x / (sqrt(t_1) / z))
else if (z <= 4.2d-177) then
tmp = x * (y * (z * (exp((-0.5d0)) ** (log(-t) + log(a)))))
else if (z <= 0.1d0) then
tmp = x * (y * (z * (t_1 ** (-0.5d0))))
else
tmp = (x * y) / sqrt((1.0d0 - ((t / z) * (a / 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 t_1 = (z * z) - (a * t);
double tmp;
if (z <= -1e+68) {
tmp = (x * y) / (((0.5 * (a / (z / t))) - z) / z);
} else if (z <= -2.95e-161) {
tmp = y * (x / (Math.sqrt(t_1) / z));
} else if (z <= 4.2e-177) {
tmp = x * (y * (z * Math.pow(Math.exp(-0.5), (Math.log(-t) + Math.log(a)))));
} else if (z <= 0.1) {
tmp = x * (y * (z * Math.pow(t_1, -0.5)));
} else {
tmp = (x * y) / Math.sqrt((1.0 - ((t / z) * (a / z))));
}
return tmp;
}
(*.f64 1/2 (/.f64 a (/.f64 z t))): 0 points increase in error, 0 points decrease in error
(*.f64 1/2 (Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 a t) z))): 50 points increase in error, 39 points decrease in error
if -9.99999999999999953e67 < z < -2.9500000000000001e-161
Initial program 8.0
\[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}
\]
Simplified5.7
\[\leadsto \color{blue}{\frac{x \cdot y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}}
\]
Proof
(/.f64 (*.f64 x y) (/.f64 (sqrt.f64 (-.f64 (*.f64 z z) (*.f64 t a))) z)): 0 points increase in error, 0 points decrease in error
(Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 (*.f64 x y) z) (sqrt.f64 (-.f64 (*.f64 z z) (*.f64 t a))))): 61 points increase in error, 7 points decrease in error
Applied egg-rr6.0
\[\leadsto \frac{x \cdot y}{\color{blue}{{\left(z \cdot z - t \cdot a\right)}^{0.25} \cdot \left({\left(z \cdot z - t \cdot a\right)}^{0.25} \cdot \frac{1}{z}\right)}}
\]
Applied egg-rr5.0
\[\leadsto \color{blue}{\frac{x}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}} \cdot y}
\]
if -2.9500000000000001e-161 < z < 4.20000000000000002e-177
Initial program 17.7
\[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}
\]
Applied egg-rr17.2
\[\leadsto \color{blue}{x \cdot \left(\left(y \cdot z\right) \cdot {\left(z \cdot z - t \cdot a\right)}^{-0.5}\right)}
\]
Simplified18.2
\[\leadsto \color{blue}{x \cdot \left(y \cdot \left(z \cdot {\left(z \cdot z - a \cdot t\right)}^{-0.5}\right)\right)}
\]
Proof
(*.f64 x (*.f64 y (*.f64 z (pow.f64 (-.f64 (*.f64 z z) (*.f64 a t)) -1/2)))): 0 points increase in error, 0 points decrease in error
(*.f64 x (*.f64 y (*.f64 z (pow.f64 (-.f64 (*.f64 z z) (Rewrite=> *-commutative_binary64 (*.f64 t a))) -1/2)))): 0 points increase in error, 0 points decrease in error
(*.f64 x (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 y z) (pow.f64 (-.f64 (*.f64 z z) (*.f64 t a)) -1/2)))): 53 points increase in error, 12 points decrease in error
if 4.20000000000000002e-177 < z < 0.10000000000000001
Initial program 9.1
\[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}
\]
Applied egg-rr9.2
\[\leadsto \color{blue}{x \cdot \left(\left(y \cdot z\right) \cdot {\left(z \cdot z - t \cdot a\right)}^{-0.5}\right)}
\]
Simplified7.2
\[\leadsto \color{blue}{x \cdot \left(y \cdot \left(z \cdot {\left(z \cdot z - a \cdot t\right)}^{-0.5}\right)\right)}
\]
Proof
(*.f64 x (*.f64 y (*.f64 z (pow.f64 (-.f64 (*.f64 z z) (*.f64 a t)) -1/2)))): 0 points increase in error, 0 points decrease in error
(*.f64 x (*.f64 y (*.f64 z (pow.f64 (-.f64 (*.f64 z z) (Rewrite=> *-commutative_binary64 (*.f64 t a))) -1/2)))): 0 points increase in error, 0 points decrease in error
(*.f64 x (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 y z) (pow.f64 (-.f64 (*.f64 z z) (*.f64 t a)) -1/2)))): 53 points increase in error, 12 points decrease in error
if 0.10000000000000001 < z
Initial program 33.9
\[\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}
\]
Simplified31.3
\[\leadsto \color{blue}{\frac{x \cdot y}{\frac{\sqrt{z \cdot z - t \cdot a}}{z}}}
\]
Proof
(/.f64 (*.f64 x y) (/.f64 (sqrt.f64 (-.f64 (*.f64 z z) (*.f64 t a))) z)): 0 points increase in error, 0 points decrease in error
(Rewrite<= associate-/l*_binary64 (/.f64 (*.f64 (*.f64 x y) z) (sqrt.f64 (-.f64 (*.f64 z z) (*.f64 t a))))): 61 points increase in error, 7 points decrease in error
Applied egg-rr36.5
\[\leadsto \frac{x \cdot y}{\color{blue}{\sqrt{\frac{z \cdot z - t \cdot a}{z \cdot z}}}}
\]
(sqrt.f64 (-.f64 1 (*.f64 (/.f64 t z) (/.f64 a z)))): 0 points increase in error, 0 points decrease in error
(sqrt.f64 (-.f64 (Rewrite<= *-inverses_binary64 (/.f64 (*.f64 z z) (*.f64 z z))) (*.f64 (/.f64 t z) (/.f64 a z)))): 98 points increase in error, 0 points decrease in error
(sqrt.f64 (-.f64 (/.f64 (*.f64 z z) (*.f64 z z)) (Rewrite<= times-frac_binary64 (/.f64 (*.f64 t a) (*.f64 z z))))): 8 points increase in error, 6 points decrease in error
(sqrt.f64 (Rewrite<= div-sub_binary64 (/.f64 (-.f64 (*.f64 z z) (*.f64 t a)) (*.f64 z z)))): 0 points increase in error, 1 points decrease in error
herbie shell --seed 2022329
(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)))))