(FPCore (x y z t a) :precision binary64 (/ (- (* x y) (* (* z 9.0) t)) (* a 2.0)))
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (* 0.5 (* y (/ x a))) (* 4.5 (/ (* t z) a)))))
(if (<= (* x y) -5.957510284115416e+296)
t_1
(if (<= (* x y) 9.2735317214375e+303)
(-
(* 0.5 (/ (* x y) a))
(* 4.5 (* (/ t (* (cbrt a) (cbrt a))) (/ z (cbrt a)))))
t_1))))double code(double x, double y, double z, double t, double a) {
return ((x * y) - ((z * 9.0) * t)) / (a * 2.0);
}
double code(double x, double y, double z, double t, double a) {
double t_1 = (0.5 * (y * (x / a))) - (4.5 * ((t * z) / a));
double tmp;
if ((x * y) <= -5.957510284115416e+296) {
tmp = t_1;
} else if ((x * y) <= 9.2735317214375e+303) {
tmp = (0.5 * ((x * y) / a)) - (4.5 * ((t / (cbrt(a) * cbrt(a))) * (z / cbrt(a))));
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
return ((x * y) - ((z * 9.0) * t)) / (a * 2.0);
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (0.5 * (y * (x / a))) - (4.5 * ((t * z) / a));
double tmp;
if ((x * y) <= -5.957510284115416e+296) {
tmp = t_1;
} else if ((x * y) <= 9.2735317214375e+303) {
tmp = (0.5 * ((x * y) / a)) - (4.5 * ((t / (Math.cbrt(a) * Math.cbrt(a))) * (z / Math.cbrt(a))));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) return Float64(Float64(Float64(x * y) - Float64(Float64(z * 9.0) * t)) / Float64(a * 2.0)) end
function code(x, y, z, t, a) t_1 = Float64(Float64(0.5 * Float64(y * Float64(x / a))) - Float64(4.5 * Float64(Float64(t * z) / a))) tmp = 0.0 if (Float64(x * y) <= -5.957510284115416e+296) tmp = t_1; elseif (Float64(x * y) <= 9.2735317214375e+303) tmp = Float64(Float64(0.5 * Float64(Float64(x * y) / a)) - Float64(4.5 * Float64(Float64(t / Float64(cbrt(a) * cbrt(a))) * Float64(z / cbrt(a))))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := N[(N[(N[(x * y), $MachinePrecision] - N[(N[(z * 9.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] / N[(a * 2.0), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(0.5 * N[(y * N[(x / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(4.5 * N[(N[(t * z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -5.957510284115416e+296], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 9.2735317214375e+303], N[(N[(0.5 * N[(N[(x * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision] - N[(4.5 * N[(N[(t / N[(N[Power[a, 1/3], $MachinePrecision] * N[Power[a, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(z / N[Power[a, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}
\begin{array}{l}
t_1 := 0.5 \cdot \left(y \cdot \frac{x}{a}\right) - 4.5 \cdot \frac{t \cdot z}{a}\\
\mathbf{if}\;x \cdot y \leq -5.957510284115416 \cdot 10^{+296}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot y \leq 9.2735317214375 \cdot 10^{+303}:\\
\;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \left(\frac{t}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{z}{\sqrt[3]{a}}\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a
Results
| Original | 7.5 |
|---|---|
| Target | 5.7 |
| Herbie | 4.3 |
if (*.f64 x y) < -5.9575102841154163e296 or 9.2735317214374998e303 < (*.f64 x y) Initial program 58.6
Simplified58.6
Taylor expanded in z around 0 58.6
Applied *-un-lft-identity_binary6458.6
Applied times-frac_binary647.0
Simplified7.0
if -5.9575102841154163e296 < (*.f64 x y) < 9.2735317214374998e303Initial program 4.2
Simplified4.2
Taylor expanded in z around 0 4.1
Applied add-cube-cbrt_binary644.6
Applied times-frac_binary644.1
Final simplification4.3
herbie shell --seed 2022130
(FPCore (x y z t a)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, I"
:precision binary64
:herbie-target
(if (< a -2.090464557976709e+86) (- (* 0.5 (/ (* y x) a)) (* 4.5 (/ t (/ a z)))) (if (< a 2.144030707833976e+99) (/ (- (* x y) (* z (* 9.0 t))) (* a 2.0)) (- (* (/ y a) (* x 0.5)) (* (/ t a) (* z 4.5)))))
(/ (- (* x y) (* (* z 9.0) t)) (* a 2.0)))