(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
(+
(* x (/ z (- a z)))
(-
(+ x (/ t (/ (- a z) y)))
(+ (/ t (+ (/ a z) -1.0)) (* x (/ y (- a z)))))))
(t_2 (+ x (* (- y z) (/ (- t x) (- a z))))))
(if (<= t_2 -1e-250)
t_1
(if (<= t_2 0.0)
(+
(* x (/ y z))
(+ t (- (* t (/ a z)) (+ (/ t (/ z y)) (* x (/ a z))))))
t_1))))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 = (x * (z / (a - z))) + ((x + (t / ((a - z) / y))) - ((t / ((a / z) + -1.0)) + (x * (y / (a - z)))));
double t_2 = x + ((y - z) * ((t - x) / (a - z)));
double tmp;
if (t_2 <= -1e-250) {
tmp = t_1;
} else if (t_2 <= 0.0) {
tmp = (x * (y / z)) + (t + ((t * (a / z)) - ((t / (z / y)) + (x * (a / z)))));
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + ((y - z) * ((t - x) / (a - z)))
end function
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (x * (z / (a - z))) + ((x + (t / ((a - z) / y))) - ((t / ((a / z) + (-1.0d0))) + (x * (y / (a - z)))))
t_2 = x + ((y - z) * ((t - x) / (a - z)))
if (t_2 <= (-1d-250)) then
tmp = t_1
else if (t_2 <= 0.0d0) then
tmp = (x * (y / z)) + (t + ((t * (a / z)) - ((t / (z / y)) + (x * (a / z)))))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y - z) * ((t - x) / (a - z)));
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (x * (z / (a - z))) + ((x + (t / ((a - z) / y))) - ((t / ((a / z) + -1.0)) + (x * (y / (a - z)))));
double t_2 = x + ((y - z) * ((t - x) / (a - z)));
double tmp;
if (t_2 <= -1e-250) {
tmp = t_1;
} else if (t_2 <= 0.0) {
tmp = (x * (y / z)) + (t + ((t * (a / z)) - ((t / (z / y)) + (x * (a / z)))));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): return x + ((y - z) * ((t - x) / (a - z)))
def code(x, y, z, t, a): t_1 = (x * (z / (a - z))) + ((x + (t / ((a - z) / y))) - ((t / ((a / z) + -1.0)) + (x * (y / (a - z))))) t_2 = x + ((y - z) * ((t - x) / (a - z))) tmp = 0 if t_2 <= -1e-250: tmp = t_1 elif t_2 <= 0.0: tmp = (x * (y / z)) + (t + ((t * (a / z)) - ((t / (z / y)) + (x * (a / z))))) else: tmp = t_1 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(x * Float64(z / Float64(a - z))) + Float64(Float64(x + Float64(t / Float64(Float64(a - z) / y))) - Float64(Float64(t / Float64(Float64(a / z) + -1.0)) + Float64(x * Float64(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-250) tmp = t_1; elseif (t_2 <= 0.0) tmp = Float64(Float64(x * Float64(y / z)) + Float64(t + Float64(Float64(t * Float64(a / z)) - Float64(Float64(t / Float64(z / y)) + Float64(x * Float64(a / z)))))); else tmp = t_1; end return tmp end
function tmp = code(x, y, z, t, a) tmp = x + ((y - z) * ((t - x) / (a - z))); end
function tmp_2 = code(x, y, z, t, a) t_1 = (x * (z / (a - z))) + ((x + (t / ((a - z) / y))) - ((t / ((a / z) + -1.0)) + (x * (y / (a - z))))); t_2 = x + ((y - z) * ((t - x) / (a - z))); tmp = 0.0; if (t_2 <= -1e-250) tmp = t_1; elseif (t_2 <= 0.0) tmp = (x * (y / z)) + (t + ((t * (a / z)) - ((t / (z / y)) + (x * (a / z))))); else tmp = t_1; end tmp_2 = 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[(x * N[(z / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(x + N[(t / N[(N[(a - z), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(t / N[(N[(a / z), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision] + N[(x * N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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-250], t$95$1, If[LessEqual[t$95$2, 0.0], N[(N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision] + N[(t + N[(N[(t * N[(a / z), $MachinePrecision]), $MachinePrecision] - N[(N[(t / N[(z / y), $MachinePrecision]), $MachinePrecision] + N[(x * N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
x + \left(y - z\right) \cdot \frac{t - x}{a - z}
\begin{array}{l}
t_1 := x \cdot \frac{z}{a - z} + \left(\left(x + \frac{t}{\frac{a - z}{y}}\right) - \left(\frac{t}{\frac{a}{z} + -1} + x \cdot \frac{y}{a - z}\right)\right)\\
t_2 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\
\mathbf{if}\;t_2 \leq -1 \cdot 10^{-250}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_2 \leq 0:\\
\;\;\;\;x \cdot \frac{y}{z} + \left(t + \left(t \cdot \frac{a}{z} - \left(\frac{t}{\frac{z}{y}} + x \cdot \frac{a}{z}\right)\right)\right)\\
\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
Results
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -1.0000000000000001e-250 or 0.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 7.0
Simplified7.0
Taylor expanded in y around 0 17.4
Simplified6.3
Taylor expanded in t around 0 12.9
Simplified3.9
if -1.0000000000000001e-250 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 0.0Initial program 59.5
Simplified59.0
Taylor expanded in z around inf 13.0
Simplified4.3
Final simplification3.9
herbie shell --seed 2022162
(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)))))