(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- a t)))))
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma y (/ (- z t) (- a t)) x)))
(if (<= y -8.5196827904596e+17)
t_1
(if (<= y 3.7040622508066614e-90)
(- (+ x (/ (* y z) (- a t))) (/ (* y t) (- a t)))
t_1))))double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (a - t)));
}
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(y, ((z - t) / (a - t)), x);
double tmp;
if (y <= -8.5196827904596e+17) {
tmp = t_1;
} else if (y <= 3.7040622508066614e-90) {
tmp = (x + ((y * z) / (a - t))) - ((y * t) / (a - t));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(a - t)))) end
function code(x, y, z, t, a) t_1 = fma(y, Float64(Float64(z - t) / Float64(a - t)), x) tmp = 0.0 if (y <= -8.5196827904596e+17) tmp = t_1; elseif (y <= 3.7040622508066614e-90) tmp = Float64(Float64(x + Float64(Float64(y * z) / Float64(a - t))) - Float64(Float64(y * t) / Float64(a - t))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[y, -8.5196827904596e+17], t$95$1, If[LessEqual[y, 3.7040622508066614e-90], N[(N[(x + N[(N[(y * z), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(y * t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
x + y \cdot \frac{z - t}{a - t}
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, \frac{z - t}{a - t}, x\right)\\
\mathbf{if}\;y \leq -8.5196827904596 \cdot 10^{+17}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 3.7040622508066614 \cdot 10^{-90}:\\
\;\;\;\;\left(x + \frac{y \cdot z}{a - t}\right) - \frac{y \cdot t}{a - t}\\
\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
| Original | 1.4 |
|---|---|
| Target | 0.4 |
| Herbie | 0.5 |
if y < -851968279045959940 or 3.70406225080666137e-90 < y Initial program 0.6
Simplified0.6
if -851968279045959940 < y < 3.70406225080666137e-90Initial program 2.4
Simplified2.4
Taylor expanded in y around 0 0.3
Final simplification0.5
herbie shell --seed 2022129
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisLine from plot-0.2.3.4, B"
:precision binary64
:herbie-target
(if (< y -8.508084860551241e-17) (+ x (* y (/ (- z t) (- a t)))) (if (< y 2.894426862792089e-49) (+ x (* (* y (- z t)) (/ 1.0 (- a t)))) (+ x (* y (/ (- z t) (- a t))))))
(+ x (* y (/ (- z t) (- a t)))))