(FPCore (x y z t a) :precision binary64 (- x (/ (- y z) (/ (+ (- t z) 1.0) a))))
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ a (+ (- t z) 1.0)) (- z y) x)) (t_2 (- (+ t 1.0) z)))
(if (<= a -4.878938494260088e+107)
t_1
(if (<= a 4.65178715222157e-28)
(- (fma a (/ z t_2) x) (/ (* a y) t_2))
t_1))))double code(double x, double y, double z, double t, double a) {
return x - ((y - z) / (((t - z) + 1.0) / a));
}
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((a / ((t - z) + 1.0)), (z - y), x);
double t_2 = (t + 1.0) - z;
double tmp;
if (a <= -4.878938494260088e+107) {
tmp = t_1;
} else if (a <= 4.65178715222157e-28) {
tmp = fma(a, (z / t_2), x) - ((a * y) / t_2);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) return Float64(x - Float64(Float64(y - z) / Float64(Float64(Float64(t - z) + 1.0) / a))) end
function code(x, y, z, t, a) t_1 = fma(Float64(a / Float64(Float64(t - z) + 1.0)), Float64(z - y), x) t_2 = Float64(Float64(t + 1.0) - z) tmp = 0.0 if (a <= -4.878938494260088e+107) tmp = t_1; elseif (a <= 4.65178715222157e-28) tmp = Float64(fma(a, Float64(z / t_2), x) - Float64(Float64(a * y) / t_2)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := N[(x - N[(N[(y - z), $MachinePrecision] / N[(N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(a / N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * N[(z - y), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t + 1.0), $MachinePrecision] - z), $MachinePrecision]}, If[LessEqual[a, -4.878938494260088e+107], t$95$1, If[LessEqual[a, 4.65178715222157e-28], N[(N[(a * N[(z / t$95$2), $MachinePrecision] + x), $MachinePrecision] - N[(N[(a * y), $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
x - \frac{y - z}{\frac{\left(t - z\right) + 1}{a}}
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{a}{\left(t - z\right) + 1}, z - y, x\right)\\
t_2 := \left(t + 1\right) - z\\
\mathbf{if}\;a \leq -4.878938494260088 \cdot 10^{+107}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \leq 4.65178715222157 \cdot 10^{-28}:\\
\;\;\;\;\mathsf{fma}\left(a, \frac{z}{t_2}, x\right) - \frac{a \cdot y}{t_2}\\
\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 | 2.0 |
|---|---|
| Target | 0.2 |
| Herbie | 0.4 |
if a < -4.8789384942600881e107 or 4.65178715222157008e-28 < a Initial program 0.2
Simplified0.1
if -4.8789384942600881e107 < a < 4.65178715222157008e-28Initial program 3.1
Simplified2.9
Taylor expanded in a around 0 1.4
Applied *-un-lft-identity_binary641.4
Applied times-frac_binary640.6
Applied fma-def_binary640.6
Final simplification0.4
herbie shell --seed 2022131
(FPCore (x y z t a)
:name "Graphics.Rendering.Chart.SparkLine:renderSparkLine from Chart-1.5.3"
:precision binary64
:herbie-target
(- x (* (/ (- y z) (+ (- t z) 1.0)) a))
(- x (/ (- y z) (/ (+ (- t z) 1.0) a))))