
(FPCore (x y z t a) :precision binary64 (+ x (* (- y z) (/ (- t x) (- a z)))))
double code(double x, double y, double z, double t, double a) {
return x + ((y - z) * ((t - x) / (a - z)));
}
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
public static double code(double x, double y, double z, double t, double a) {
return x + ((y - z) * ((t - x) / (a - z)));
}
def code(x, y, z, t, a): return x + ((y - z) * ((t - x) / (a - z)))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) end
function tmp = code(x, y, z, t, a) tmp = x + ((y - z) * ((t - x) / (a - z))); 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]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \frac{t - x}{a - z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (* (- y z) (/ (- t x) (- a z)))))
double code(double x, double y, double z, double t, double a) {
return x + ((y - z) * ((t - x) / (a - z)));
}
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
public static double code(double x, double y, double z, double t, double a) {
return x + ((y - z) * ((t - x) / (a - z)));
}
def code(x, y, z, t, a): return x + ((y - z) * ((t - x) / (a - z)))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) end
function tmp = code(x, y, z, t, a) tmp = x + ((y - z) * ((t - x) / (a - z))); 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]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \frac{t - x}{a - z}
\end{array}
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* (- y z) (/ (- t x) (- a z))))))
(if (or (<= t_1 -2e-243) (not (<= t_1 0.0)))
(fma (- t x) (/ (- y z) (- a z)) x)
(- t (* (/ (- t x) z) (- y a))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + ((y - z) * ((t - x) / (a - z)));
double tmp;
if ((t_1 <= -2e-243) || !(t_1 <= 0.0)) {
tmp = fma((t - x), ((y - z) / (a - z)), x);
} else {
tmp = t - (((t - x) / z) * (y - a));
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(y - z) * Float64(Float64(t - x) / Float64(a - z)))) tmp = 0.0 if ((t_1 <= -2e-243) || !(t_1 <= 0.0)) tmp = fma(Float64(t - x), Float64(Float64(y - z) / Float64(a - z)), x); else tmp = Float64(t - Float64(Float64(Float64(t - x) / z) * Float64(y - a))); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -2e-243], N[Not[LessEqual[t$95$1, 0.0]], $MachinePrecision]], N[(N[(t - x), $MachinePrecision] * N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(t - N[(N[(N[(t - x), $MachinePrecision] / z), $MachinePrecision] * N[(y - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-243} \lor \neg \left(t\_1 \leq 0\right):\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y - z}{a - z}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t - \frac{t - x}{z} \cdot \left(y - a\right)\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -1.99999999999999999e-243 or 0.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 88.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6493.4
Applied rewrites93.4%
if -1.99999999999999999e-243 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 0.0Initial program 3.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f646.7
Applied rewrites6.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f646.7
Applied rewrites6.7%
Taylor expanded in z around inf
fp-cancel-sub-sign-invN/A
metadata-evalN/A
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
*-lft-identityN/A
associate-+l-N/A
div-subN/A
lower--.f64N/A
div-subN/A
associate-/l*N/A
associate-/l*N/A
distribute-rgt-out--N/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6499.7
Applied rewrites99.7%
Final simplification94.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (- t x) (/ y a) x)) (t_2 (* (- y z) (/ t (- a z)))))
(if (<= t -2.7e-43)
t_2
(if (<= t -1.18e-262)
t_1
(if (<= t 8.5e-136)
(* (- t x) (/ y (- a z)))
(if (<= t 7.5e-40) t_1 t_2))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((t - x), (y / a), x);
double t_2 = (y - z) * (t / (a - z));
double tmp;
if (t <= -2.7e-43) {
tmp = t_2;
} else if (t <= -1.18e-262) {
tmp = t_1;
} else if (t <= 8.5e-136) {
tmp = (t - x) * (y / (a - z));
} else if (t <= 7.5e-40) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(t - x), Float64(y / a), x) t_2 = Float64(Float64(y - z) * Float64(t / Float64(a - z))) tmp = 0.0 if (t <= -2.7e-43) tmp = t_2; elseif (t <= -1.18e-262) tmp = t_1; elseif (t <= 8.5e-136) tmp = Float64(Float64(t - x) * Float64(y / Float64(a - z))); elseif (t <= 7.5e-40) tmp = t_1; else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t - x), $MachinePrecision] * N[(y / a), $MachinePrecision] + x), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y - z), $MachinePrecision] * N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -2.7e-43], t$95$2, If[LessEqual[t, -1.18e-262], t$95$1, If[LessEqual[t, 8.5e-136], N[(N[(t - x), $MachinePrecision] * N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 7.5e-40], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(t - x, \frac{y}{a}, x\right)\\
t_2 := \left(y - z\right) \cdot \frac{t}{a - z}\\
\mathbf{if}\;t \leq -2.7 \cdot 10^{-43}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t \leq -1.18 \cdot 10^{-262}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 8.5 \cdot 10^{-136}:\\
\;\;\;\;\left(t - x\right) \cdot \frac{y}{a - z}\\
\mathbf{elif}\;t \leq 7.5 \cdot 10^{-40}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if t < -2.69999999999999991e-43 or 7.50000000000000069e-40 < t Initial program 86.4%
Taylor expanded in x around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6472.9
Applied rewrites72.9%
if -2.69999999999999991e-43 < t < -1.17999999999999994e-262 or 8.49999999999999973e-136 < t < 7.50000000000000069e-40Initial program 65.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6478.2
Applied rewrites78.2%
Taylor expanded in z around 0
lower-/.f6456.0
Applied rewrites56.0%
if -1.17999999999999994e-262 < t < 8.49999999999999973e-136Initial program 59.1%
Taylor expanded in y around inf
div-subN/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6460.3
Applied rewrites60.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1.28e+135) (not (<= a 5.8e+102))) (+ x (* (/ (- y z) a) (- t x))) (fma (- (- t x)) (/ (- y a) z) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.28e+135) || !(a <= 5.8e+102)) {
tmp = x + (((y - z) / a) * (t - x));
} else {
tmp = fma(-(t - x), ((y - a) / z), t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1.28e+135) || !(a <= 5.8e+102)) tmp = Float64(x + Float64(Float64(Float64(y - z) / a) * Float64(t - x))); else tmp = fma(Float64(-Float64(t - x)), Float64(Float64(y - a) / z), t); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1.28e+135], N[Not[LessEqual[a, 5.8e+102]], $MachinePrecision]], N[(x + N[(N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-N[(t - x), $MachinePrecision]) * N[(N[(y - a), $MachinePrecision] / z), $MachinePrecision] + t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.28 \cdot 10^{+135} \lor \neg \left(a \leq 5.8 \cdot 10^{+102}\right):\\
\;\;\;\;x + \frac{y - z}{a} \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-\left(t - x\right), \frac{y - a}{z}, t\right)\\
\end{array}
\end{array}
if a < -1.28e135 or 5.8000000000000005e102 < a Initial program 89.5%
Taylor expanded in a around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6485.0
Applied rewrites85.0%
if -1.28e135 < a < 5.8000000000000005e102Initial program 71.7%
Taylor expanded in z around inf
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
+-commutativeN/A
mul-1-negN/A
distribute-rgt-out--N/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6479.0
Applied rewrites79.0%
Final simplification80.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1.28e+135) (not (<= a 5.8e+102))) (fma (- y z) (/ (- t x) a) x) (fma (- (- t x)) (/ (- y a) z) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.28e+135) || !(a <= 5.8e+102)) {
tmp = fma((y - z), ((t - x) / a), x);
} else {
tmp = fma(-(t - x), ((y - a) / z), t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1.28e+135) || !(a <= 5.8e+102)) tmp = fma(Float64(y - z), Float64(Float64(t - x) / a), x); else tmp = fma(Float64(-Float64(t - x)), Float64(Float64(y - a) / z), t); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1.28e+135], N[Not[LessEqual[a, 5.8e+102]], $MachinePrecision]], N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], N[((-N[(t - x), $MachinePrecision]) * N[(N[(y - a), $MachinePrecision] / z), $MachinePrecision] + t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.28 \cdot 10^{+135} \lor \neg \left(a \leq 5.8 \cdot 10^{+102}\right):\\
\;\;\;\;\mathsf{fma}\left(y - z, \frac{t - x}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-\left(t - x\right), \frac{y - a}{z}, t\right)\\
\end{array}
\end{array}
if a < -1.28e135 or 5.8000000000000005e102 < a Initial program 89.5%
Taylor expanded in a around inf
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6482.1
Applied rewrites82.1%
if -1.28e135 < a < 5.8000000000000005e102Initial program 71.7%
Taylor expanded in z around inf
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
+-commutativeN/A
mul-1-negN/A
distribute-rgt-out--N/A
associate-/l*N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6479.0
Applied rewrites79.0%
Final simplification79.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1.25e-17) (not (<= a 5.8e+102))) (fma (- y z) (/ (- t x) a) x) (- t (/ (* (- y a) (- t x)) z))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.25e-17) || !(a <= 5.8e+102)) {
tmp = fma((y - z), ((t - x) / a), x);
} else {
tmp = t - (((y - a) * (t - x)) / z);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1.25e-17) || !(a <= 5.8e+102)) tmp = fma(Float64(y - z), Float64(Float64(t - x) / a), x); else tmp = Float64(t - Float64(Float64(Float64(y - a) * Float64(t - x)) / z)); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1.25e-17], N[Not[LessEqual[a, 5.8e+102]], $MachinePrecision]], N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], N[(t - N[(N[(N[(y - a), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.25 \cdot 10^{-17} \lor \neg \left(a \leq 5.8 \cdot 10^{+102}\right):\\
\;\;\;\;\mathsf{fma}\left(y - z, \frac{t - x}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t - \frac{\left(y - a\right) \cdot \left(t - x\right)}{z}\\
\end{array}
\end{array}
if a < -1.25e-17 or 5.8000000000000005e102 < a Initial program 85.9%
Taylor expanded in a around inf
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6474.2
Applied rewrites74.2%
if -1.25e-17 < a < 5.8000000000000005e102Initial program 71.0%
Taylor expanded in z around -inf
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
lower-/.f64N/A
Applied rewrites65.1%
Taylor expanded in z around inf
Applied rewrites78.7%
Final simplification77.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -9.2e-18) (not (<= a 1.25e+102))) (fma (- y z) (/ (- t x) a) x) (- t (/ (* (- t x) y) z))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -9.2e-18) || !(a <= 1.25e+102)) {
tmp = fma((y - z), ((t - x) / a), x);
} else {
tmp = t - (((t - x) * y) / z);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -9.2e-18) || !(a <= 1.25e+102)) tmp = fma(Float64(y - z), Float64(Float64(t - x) / a), x); else tmp = Float64(t - Float64(Float64(Float64(t - x) * y) / z)); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -9.2e-18], N[Not[LessEqual[a, 1.25e+102]], $MachinePrecision]], N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], N[(t - N[(N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -9.2 \cdot 10^{-18} \lor \neg \left(a \leq 1.25 \cdot 10^{+102}\right):\\
\;\;\;\;\mathsf{fma}\left(y - z, \frac{t - x}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t - \frac{\left(t - x\right) \cdot y}{z}\\
\end{array}
\end{array}
if a < -9.2000000000000004e-18 or 1.25e102 < a Initial program 85.9%
Taylor expanded in a around inf
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6474.2
Applied rewrites74.2%
if -9.2000000000000004e-18 < a < 1.25e102Initial program 71.0%
Taylor expanded in z around -inf
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
lower-/.f64N/A
Applied rewrites65.1%
Taylor expanded in a around 0
Applied rewrites73.2%
Final simplification73.6%
(FPCore (x y z t a) :precision binary64 (if (<= a -1.28e+135) (fma (- y z) (/ t a) x) (if (<= a 5.8e+102) (- t (/ (* (- t x) y) z)) (fma (- t x) (/ y a) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.28e+135) {
tmp = fma((y - z), (t / a), x);
} else if (a <= 5.8e+102) {
tmp = t - (((t - x) * y) / z);
} else {
tmp = fma((t - x), (y / a), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.28e+135) tmp = fma(Float64(y - z), Float64(t / a), x); elseif (a <= 5.8e+102) tmp = Float64(t - Float64(Float64(Float64(t - x) * y) / z)); else tmp = fma(Float64(t - x), Float64(y / a), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.28e+135], N[(N[(y - z), $MachinePrecision] * N[(t / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[a, 5.8e+102], N[(t - N[(N[(N[(t - x), $MachinePrecision] * y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(N[(t - x), $MachinePrecision] * N[(y / a), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.28 \cdot 10^{+135}:\\
\;\;\;\;\mathsf{fma}\left(y - z, \frac{t}{a}, x\right)\\
\mathbf{elif}\;a \leq 5.8 \cdot 10^{+102}:\\
\;\;\;\;t - \frac{\left(t - x\right) \cdot y}{z}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y}{a}, x\right)\\
\end{array}
\end{array}
if a < -1.28e135Initial program 87.8%
Taylor expanded in a around inf
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6483.9
Applied rewrites83.9%
Taylor expanded in x around 0
Applied rewrites81.0%
if -1.28e135 < a < 5.8000000000000005e102Initial program 71.7%
Taylor expanded in z around -inf
fp-cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
lower--.f64N/A
lower-/.f64N/A
Applied rewrites60.3%
Taylor expanded in a around 0
Applied rewrites69.7%
if 5.8000000000000005e102 < a Initial program 91.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6496.9
Applied rewrites96.9%
Taylor expanded in z around 0
lower-/.f6480.1
Applied rewrites80.1%
(FPCore (x y z t a) :precision binary64 (if (<= a -6.2e+48) (fma (- y z) (/ t a) x) (if (<= a 7.2e-137) (* (- t x) (/ y (- a z))) (fma (- t x) (/ y a) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -6.2e+48) {
tmp = fma((y - z), (t / a), x);
} else if (a <= 7.2e-137) {
tmp = (t - x) * (y / (a - z));
} else {
tmp = fma((t - x), (y / a), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -6.2e+48) tmp = fma(Float64(y - z), Float64(t / a), x); elseif (a <= 7.2e-137) tmp = Float64(Float64(t - x) * Float64(y / Float64(a - z))); else tmp = fma(Float64(t - x), Float64(y / a), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -6.2e+48], N[(N[(y - z), $MachinePrecision] * N[(t / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[a, 7.2e-137], N[(N[(t - x), $MachinePrecision] * N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t - x), $MachinePrecision] * N[(y / a), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -6.2 \cdot 10^{+48}:\\
\;\;\;\;\mathsf{fma}\left(y - z, \frac{t}{a}, x\right)\\
\mathbf{elif}\;a \leq 7.2 \cdot 10^{-137}:\\
\;\;\;\;\left(t - x\right) \cdot \frac{y}{a - z}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y}{a}, x\right)\\
\end{array}
\end{array}
if a < -6.20000000000000011e48Initial program 85.4%
Taylor expanded in a around inf
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6470.6
Applied rewrites70.6%
Taylor expanded in x around 0
Applied rewrites68.6%
if -6.20000000000000011e48 < a < 7.20000000000000013e-137Initial program 69.3%
Taylor expanded in y around inf
div-subN/A
associate-/l*N/A
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6458.0
Applied rewrites58.0%
if 7.20000000000000013e-137 < a Initial program 81.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6489.0
Applied rewrites89.0%
Taylor expanded in z around 0
lower-/.f6456.9
Applied rewrites56.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.9e+26) (not (<= z 1.25e+164))) (+ x (- t x)) (fma (- t x) (/ y a) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.9e+26) || !(z <= 1.25e+164)) {
tmp = x + (t - x);
} else {
tmp = fma((t - x), (y / a), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.9e+26) || !(z <= 1.25e+164)) tmp = Float64(x + Float64(t - x)); else tmp = fma(Float64(t - x), Float64(y / a), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.9e+26], N[Not[LessEqual[z, 1.25e+164]], $MachinePrecision]], N[(x + N[(t - x), $MachinePrecision]), $MachinePrecision], N[(N[(t - x), $MachinePrecision] * N[(y / a), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.9 \cdot 10^{+26} \lor \neg \left(z \leq 1.25 \cdot 10^{+164}\right):\\
\;\;\;\;x + \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y}{a}, x\right)\\
\end{array}
\end{array}
if z < -1.9000000000000001e26 or 1.24999999999999987e164 < z Initial program 60.8%
Taylor expanded in z around inf
lower--.f6444.8
Applied rewrites44.8%
if -1.9000000000000001e26 < z < 1.24999999999999987e164Initial program 84.9%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6488.4
Applied rewrites88.4%
Taylor expanded in z around 0
lower-/.f6456.9
Applied rewrites56.9%
Final simplification52.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.8e+26) (not (<= z 1.25e+164))) (+ x (- t x)) (fma (/ (- t x) a) y x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.8e+26) || !(z <= 1.25e+164)) {
tmp = x + (t - x);
} else {
tmp = fma(((t - x) / a), y, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.8e+26) || !(z <= 1.25e+164)) tmp = Float64(x + Float64(t - x)); else tmp = fma(Float64(Float64(t - x) / a), y, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.8e+26], N[Not[LessEqual[z, 1.25e+164]], $MachinePrecision]], N[(x + N[(t - x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] * y + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.8 \cdot 10^{+26} \lor \neg \left(z \leq 1.25 \cdot 10^{+164}\right):\\
\;\;\;\;x + \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{t - x}{a}, y, x\right)\\
\end{array}
\end{array}
if z < -1.80000000000000012e26 or 1.24999999999999987e164 < z Initial program 60.8%
Taylor expanded in z around inf
lower--.f6444.8
Applied rewrites44.8%
if -1.80000000000000012e26 < z < 1.24999999999999987e164Initial program 84.9%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6455.1
Applied rewrites55.1%
Final simplification51.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.8e+26) (not (<= z 3.1e+169))) (+ x (- t x)) (fma (- y z) (/ t a) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.8e+26) || !(z <= 3.1e+169)) {
tmp = x + (t - x);
} else {
tmp = fma((y - z), (t / a), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.8e+26) || !(z <= 3.1e+169)) tmp = Float64(x + Float64(t - x)); else tmp = fma(Float64(y - z), Float64(t / a), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.8e+26], N[Not[LessEqual[z, 3.1e+169]], $MachinePrecision]], N[(x + N[(t - x), $MachinePrecision]), $MachinePrecision], N[(N[(y - z), $MachinePrecision] * N[(t / a), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.8 \cdot 10^{+26} \lor \neg \left(z \leq 3.1 \cdot 10^{+169}\right):\\
\;\;\;\;x + \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y - z, \frac{t}{a}, x\right)\\
\end{array}
\end{array}
if z < -1.80000000000000012e26 or 3.1e169 < z Initial program 59.7%
Taylor expanded in z around inf
lower--.f6444.9
Applied rewrites44.9%
if -1.80000000000000012e26 < z < 3.1e169Initial program 84.8%
Taylor expanded in a around inf
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6458.7
Applied rewrites58.7%
Taylor expanded in x around 0
Applied rewrites48.9%
Final simplification47.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.15e+24) (not (<= z 2.75e+32))) (+ x (- t x)) (* (- t x) (/ y a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.15e+24) || !(z <= 2.75e+32)) {
tmp = x + (t - x);
} else {
tmp = (t - x) * (y / a);
}
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
real(8) :: tmp
if ((z <= (-1.15d+24)) .or. (.not. (z <= 2.75d+32))) then
tmp = x + (t - x)
else
tmp = (t - x) * (y / a)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.15e+24) || !(z <= 2.75e+32)) {
tmp = x + (t - x);
} else {
tmp = (t - x) * (y / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.15e+24) or not (z <= 2.75e+32): tmp = x + (t - x) else: tmp = (t - x) * (y / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.15e+24) || !(z <= 2.75e+32)) tmp = Float64(x + Float64(t - x)); else tmp = Float64(Float64(t - x) * Float64(y / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.15e+24) || ~((z <= 2.75e+32))) tmp = x + (t - x); else tmp = (t - x) * (y / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.15e+24], N[Not[LessEqual[z, 2.75e+32]], $MachinePrecision]], N[(x + N[(t - x), $MachinePrecision]), $MachinePrecision], N[(N[(t - x), $MachinePrecision] * N[(y / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.15 \cdot 10^{+24} \lor \neg \left(z \leq 2.75 \cdot 10^{+32}\right):\\
\;\;\;\;x + \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t - x\right) \cdot \frac{y}{a}\\
\end{array}
\end{array}
if z < -1.15e24 or 2.74999999999999992e32 < z Initial program 64.1%
Taylor expanded in z around inf
lower--.f6440.4
Applied rewrites40.4%
if -1.15e24 < z < 2.74999999999999992e32Initial program 87.6%
Taylor expanded in a around inf
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6464.0
Applied rewrites64.0%
Taylor expanded in a around 0
Applied rewrites42.1%
Taylor expanded in y around inf
Applied rewrites36.3%
Final simplification38.2%
(FPCore (x y z t a) :precision binary64 (+ x (- t x)))
double code(double x, double y, double z, double t, double a) {
return x + (t - x);
}
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 + (t - x)
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (t - x);
}
def code(x, y, z, t, a): return x + (t - x)
function code(x, y, z, t, a) return Float64(x + Float64(t - x)) end
function tmp = code(x, y, z, t, a) tmp = x + (t - x); end
code[x_, y_, z_, t_, a_] := N[(x + N[(t - x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(t - x\right)
\end{array}
Initial program 76.3%
Taylor expanded in z around inf
lower--.f6423.2
Applied rewrites23.2%
(FPCore (x y z t a) :precision binary64 (+ x (- x)))
double code(double x, double y, double z, double t, double a) {
return x + -x;
}
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 + -x
end function
public static double code(double x, double y, double z, double t, double a) {
return x + -x;
}
def code(x, y, z, t, a): return x + -x
function code(x, y, z, t, a) return Float64(x + Float64(-x)) end
function tmp = code(x, y, z, t, a) tmp = x + -x; end
code[x_, y_, z_, t_, a_] := N[(x + (-x)), $MachinePrecision]
\begin{array}{l}
\\
x + \left(-x\right)
\end{array}
Initial program 76.3%
Taylor expanded in z around inf
lower--.f6423.2
Applied rewrites23.2%
Taylor expanded in x around inf
Applied rewrites2.7%
herbie shell --seed 2024320
(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)))))