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



Bits error versus x



Bits error versus y



Bits error versus z



Bits error versus t



Bits error versus a
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -1.00000000000000003e-306Initial program 7.3
Simplified7.3
Taylor expanded in t around 0 10.9
Simplified4.3
Applied egg-rr4.3
if -1.00000000000000003e-306 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 0.0Initial program 61.8
Simplified61.4
Taylor expanded in t around 0 52.6
Simplified61.8
Applied egg-rr61.8
Taylor expanded in z around inf 10.7
Simplified2.2
if 0.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 8.0
Simplified8.0
Taylor expanded in t around 0 10.0
Simplified4.3
Applied egg-rr4.2
Taylor expanded in x around 0 13.9
Simplified2.9
Final simplification3.5
herbie shell --seed 2022170
(FPCore (x y z t a)
:name "Numeric.Signal:interpolate from hsignal-0.2.7.1"
:precision binary64
(+ x (* (- y z) (/ (- t x) (- a z)))))