(FPCore (x y z t a) :precision binary64 (+ x (/ (* y (- z t)) (- z a))))
(FPCore (x y z t a)
:precision binary64
(if (<= y -1.74052409511644e-97)
(fma y (/ (- z t) (- z a)) x)
(if (<= y 2.8892448090824406e-235)
(- (+ x (/ (* y z) (- z a))) (/ (* y t) (- z a)))
(fma y (/ (/ 1.0 (- z a)) (/ 1.0 (- z t))) x))))double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / (z - a));
}
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -1.74052409511644e-97) {
tmp = fma(y, ((z - t) / (z - a)), x);
} else if (y <= 2.8892448090824406e-235) {
tmp = (x + ((y * z) / (z - a))) - ((y * t) / (z - a));
} else {
tmp = fma(y, ((1.0 / (z - a)) / (1.0 / (z - t))), x);
}
return tmp;
}
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y * Float64(z - t)) / Float64(z - a))) end
function code(x, y, z, t, a) tmp = 0.0 if (y <= -1.74052409511644e-97) tmp = fma(y, Float64(Float64(z - t) / Float64(z - a)), x); elseif (y <= 2.8892448090824406e-235) tmp = Float64(Float64(x + Float64(Float64(y * z) / Float64(z - a))) - Float64(Float64(y * t) / Float64(z - a))); else tmp = fma(y, Float64(Float64(1.0 / Float64(z - a)) / Float64(1.0 / Float64(z - t))), x); end return tmp end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -1.74052409511644e-97], N[(y * N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[y, 2.8892448090824406e-235], N[(N[(x + N[(N[(y * z), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(y * t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(1.0 / N[(z - a), $MachinePrecision]), $MachinePrecision] / N[(1.0 / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]]
x + \frac{y \cdot \left(z - t\right)}{z - a}
\begin{array}{l}
\mathbf{if}\;y \leq -1.74052409511644 \cdot 10^{-97}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z - t}{z - a}, x\right)\\
\mathbf{elif}\;y \leq 2.8892448090824406 \cdot 10^{-235}:\\
\;\;\;\;\left(x + \frac{y \cdot z}{z - a}\right) - \frac{y \cdot t}{z - a}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{\frac{1}{z - a}}{\frac{1}{z - t}}, x\right)\\
\end{array}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a
| Original | 10.7 |
|---|---|
| Target | 1.2 |
| Herbie | 0.7 |
if y < -1.74052409511643997e-97Initial program 17.8
Simplified0.6
if -1.74052409511643997e-97 < y < 2.88924480908244063e-235Initial program 0.2
Simplified2.6
Applied egg-rr2.7
Taylor expanded in y around 0 0.2
Simplified0.2
if 2.88924480908244063e-235 < y Initial program 11.5
Simplified1.1
Applied egg-rr1.1
Applied egg-rr1.1
Final simplification0.7
herbie shell --seed 2022133
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTicks from plot-0.2.3.4, A"
:precision binary64
:herbie-target
(+ x (/ y (/ (- z a) (- z t))))
(+ x (/ (* y (- z t)) (- z a))))