(FPCore (x y z t) :precision binary64 (+ (- x (/ y (* z 3.0))) (/ t (* (* z 3.0) y))))
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (fma -0.3333333333333333 (/ (- y (/ t y)) z) x))
(t_2 (+ (- x (/ y (* z 3.0))) (/ t (* y (* z 3.0))))))
(if (<= t_2 (- INFINITY))
t_1
(if (<= t_2 2.5911697485361947e+232) t_2 t_1))))double code(double x, double y, double z, double t) {
return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y));
}
double code(double x, double y, double z, double t) {
double t_1 = fma(-0.3333333333333333, ((y - (t / y)) / z), x);
double t_2 = (x - (y / (z * 3.0))) + (t / (y * (z * 3.0)));
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_2 <= 2.5911697485361947e+232) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) return Float64(Float64(x - Float64(y / Float64(z * 3.0))) + Float64(t / Float64(Float64(z * 3.0) * y))) end
function code(x, y, z, t) t_1 = fma(-0.3333333333333333, Float64(Float64(y - Float64(t / y)) / z), x) t_2 = Float64(Float64(x - Float64(y / Float64(z * 3.0))) + Float64(t / Float64(y * Float64(z * 3.0)))) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_1; elseif (t_2 <= 2.5911697485361947e+232) tmp = t_2; else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := N[(N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t / N[(N[(z * 3.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(-0.3333333333333333 * N[(N[(y - N[(t / y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t / N[(y * N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, 2.5911697485361947e+232], t$95$2, t$95$1]]]]
\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}
\begin{array}{l}
t_1 := \mathsf{fma}\left(-0.3333333333333333, \frac{y - \frac{t}{y}}{z}, x\right)\\
t_2 := \left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{y \cdot \left(z \cdot 3\right)}\\
\mathbf{if}\;t_2 \leq -\infty:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_2 \leq 2.5911697485361947 \cdot 10^{+232}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
| Original | 3.6 |
|---|---|
| Target | 1.7 |
| Herbie | 1.3 |
if (+.f64 (-.f64 x (/.f64 y (*.f64 z 3))) (/.f64 t (*.f64 (*.f64 z 3) y))) < -inf.0 or 2.59116974853619466e232 < (+.f64 (-.f64 x (/.f64 y (*.f64 z 3))) (/.f64 t (*.f64 (*.f64 z 3) y))) Initial program 18.7
Simplified5.1
Applied egg-rr5.1
Applied egg-rr5.1
if -inf.0 < (+.f64 (-.f64 x (/.f64 y (*.f64 z 3))) (/.f64 t (*.f64 (*.f64 z 3) y))) < 2.59116974853619466e232Initial program 0.5
Final simplification1.3
herbie shell --seed 2022146
(FPCore (x y z t)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, H"
:precision binary64
:herbie-target
(+ (- x (/ y (* z 3.0))) (/ (/ t (* z 3.0)) y))
(+ (- x (/ y (* z 3.0))) (/ t (* (* z 3.0) y))))