(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 (* (/ a z) t)))
(if (<= z -1.85e+155)
(* y (* x (/ z (fma 0.5 t_1 (- z)))))
(if (<= z 8.8e+129)
(* y (* x (/ z (sqrt (- (* z z) (* a t))))))
(* y (* x (/ z (fma -0.5 t_1 z))))))))double code(double x, double y, double z, double t, double a) {
return ((x * y) * z) / sqrt(((z * z) - (t * a)));
}
double code(double x, double y, double z, double t, double a) {
double t_1 = (a / z) * t;
double tmp;
if (z <= -1.85e+155) {
tmp = y * (x * (z / fma(0.5, t_1, -z)));
} else if (z <= 8.8e+129) {
tmp = y * (x * (z / sqrt(((z * z) - (a * t)))));
} else {
tmp = y * (x * (z / fma(-0.5, t_1, 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) t_1 = Float64(Float64(a / z) * t) tmp = 0.0 if (z <= -1.85e+155) tmp = Float64(y * Float64(x * Float64(z / fma(0.5, t_1, Float64(-z))))); elseif (z <= 8.8e+129) tmp = Float64(y * Float64(x * Float64(z / sqrt(Float64(Float64(z * z) - Float64(a * t)))))); else tmp = Float64(y * Float64(x * Float64(z / fma(-0.5, t_1, z)))); end return tmp end
code[x_, y_, z_, t_, a_] := N[(N[(N[(x * y), $MachinePrecision] * z), $MachinePrecision] / N[Sqrt[N[(N[(z * z), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(a / z), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[z, -1.85e+155], N[(y * N[(x * N[(z / N[(0.5 * t$95$1 + (-z)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8.8e+129], N[(y * N[(x * N[(z / N[Sqrt[N[(N[(z * z), $MachinePrecision] - N[(a * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(x * N[(z / N[(-0.5 * t$95$1 + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\frac{\left(x \cdot y\right) \cdot z}{\sqrt{z \cdot z - t \cdot a}}
\begin{array}{l}
t_1 := \frac{a}{z} \cdot t\\
\mathbf{if}\;z \leq -1.85 \cdot 10^{+155}:\\
\;\;\;\;y \cdot \left(x \cdot \frac{z}{\mathsf{fma}\left(0.5, t_1, -z\right)}\right)\\
\mathbf{elif}\;z \leq 8.8 \cdot 10^{+129}:\\
\;\;\;\;y \cdot \left(x \cdot \frac{z}{\sqrt{z \cdot z - a \cdot t}}\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(x \cdot \frac{z}{\mathsf{fma}\left(-0.5, t_1, z\right)}\right)\\
\end{array}
| Original | 24.6 |
|---|---|
| Target | 7.5 |
| Herbie | 6.1 |
if z < -1.8499999999999999e155Initial program 53.8
Simplified54.0
Applied egg-rr53.5
Applied egg-rr53.5
Taylor expanded in z around -inf 6.2
Simplified1.6
if -1.8499999999999999e155 < z < 8.7999999999999997e129Initial program 11.1
Simplified11.0
Applied egg-rr9.2
Applied egg-rr8.4
if 8.7999999999999997e129 < z Initial program 48.6
Simplified48.3
Applied egg-rr46.8
Applied egg-rr46.8
Taylor expanded in z around inf 5.2
Simplified1.6
Final simplification6.1
herbie shell --seed 2022210
(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)))))