
(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 13 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 (/ (- t x) (- a z))) (t_2 (+ x (* (- y z) t_1))))
(if (or (<= t_2 -2e-194) (not (<= t_2 0.0)))
(fma t_1 (- y z) x)
(fma (- (- t x)) (/ (- y a) z) t))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (t - x) / (a - z);
double t_2 = x + ((y - z) * t_1);
double tmp;
if ((t_2 <= -2e-194) || !(t_2 <= 0.0)) {
tmp = fma(t_1, (y - z), x);
} else {
tmp = fma(-(t - x), ((y - a) / z), t);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(t - x) / Float64(a - z)) t_2 = Float64(x + Float64(Float64(y - z) * t_1)) tmp = 0.0 if ((t_2 <= -2e-194) || !(t_2 <= 0.0)) tmp = fma(t_1, Float64(y - z), x); else tmp = fma(Float64(-Float64(t - x)), Float64(Float64(y - a) / z), t); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t - x), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(N[(y - z), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$2, -2e-194], N[Not[LessEqual[t$95$2, 0.0]], $MachinePrecision]], N[(t$95$1 * N[(y - z), $MachinePrecision] + x), $MachinePrecision], N[((-N[(t - x), $MachinePrecision]) * N[(N[(y - a), $MachinePrecision] / z), $MachinePrecision] + t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t - x}{a - z}\\
t_2 := x + \left(y - z\right) \cdot t\_1\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{-194} \lor \neg \left(t\_2 \leq 0\right):\\
\;\;\;\;\mathsf{fma}\left(t\_1, y - z, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-\left(t - x\right), \frac{y - a}{z}, t\right)\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -2.00000000000000004e-194 or 0.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 91.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6491.6
Applied rewrites91.6%
if -2.00000000000000004e-194 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 0.0Initial program 13.9%
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--.f6491.1
Applied rewrites91.1%
Final simplification91.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -4.4e+42) (not (<= z 8.4e+37))) (fma (- (- t x)) (/ (- y a) z) t) (fma (- t x) (/ (- y z) a) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -4.4e+42) || !(z <= 8.4e+37)) {
tmp = fma(-(t - x), ((y - a) / z), t);
} else {
tmp = fma((t - x), ((y - z) / a), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -4.4e+42) || !(z <= 8.4e+37)) tmp = fma(Float64(-Float64(t - x)), Float64(Float64(y - a) / z), t); else tmp = fma(Float64(t - x), Float64(Float64(y - z) / a), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -4.4e+42], N[Not[LessEqual[z, 8.4e+37]], $MachinePrecision]], N[((-N[(t - x), $MachinePrecision]) * N[(N[(y - a), $MachinePrecision] / z), $MachinePrecision] + t), $MachinePrecision], N[(N[(t - x), $MachinePrecision] * N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.4 \cdot 10^{+42} \lor \neg \left(z \leq 8.4 \cdot 10^{+37}\right):\\
\;\;\;\;\mathsf{fma}\left(-\left(t - x\right), \frac{y - a}{z}, t\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y - z}{a}, x\right)\\
\end{array}
\end{array}
if z < -4.4000000000000003e42 or 8.4000000000000004e37 < z Initial program 67.6%
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--.f6482.8
Applied rewrites82.8%
if -4.4000000000000003e42 < z < 8.4000000000000004e37Initial program 94.3%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6494.3
Applied rewrites94.3%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6478.6
Applied rewrites78.6%
Final simplification80.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -8e-92) (not (<= a 3.6e+145))) (fma (- t x) (/ (- y z) a) x) (fma (- x t) (/ y z) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -8e-92) || !(a <= 3.6e+145)) {
tmp = fma((t - x), ((y - z) / a), x);
} else {
tmp = fma((x - t), (y / z), t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -8e-92) || !(a <= 3.6e+145)) tmp = fma(Float64(t - x), Float64(Float64(y - z) / a), x); else tmp = fma(Float64(x - t), Float64(y / z), t); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -8e-92], N[Not[LessEqual[a, 3.6e+145]], $MachinePrecision]], N[(N[(t - x), $MachinePrecision] * N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], N[(N[(x - t), $MachinePrecision] * N[(y / z), $MachinePrecision] + t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -8 \cdot 10^{-92} \lor \neg \left(a \leq 3.6 \cdot 10^{+145}\right):\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y - z}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x - t, \frac{y}{z}, t\right)\\
\end{array}
\end{array}
if a < -7.9999999999999999e-92 or 3.59999999999999974e145 < a Initial program 86.7%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6486.7
Applied rewrites86.7%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6477.7
Applied rewrites77.7%
if -7.9999999999999999e-92 < a < 3.59999999999999974e145Initial program 77.2%
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--.f6480.3
Applied rewrites80.3%
Taylor expanded in y around inf
Applied rewrites78.5%
Taylor expanded in x around 0
Applied rewrites78.5%
Final simplification78.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -8e-92) (not (<= a 9.2e+76))) (fma (- y z) (/ (- t x) a) x) (fma (- x t) (/ y z) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -8e-92) || !(a <= 9.2e+76)) {
tmp = fma((y - z), ((t - x) / a), x);
} else {
tmp = fma((x - t), (y / z), t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -8e-92) || !(a <= 9.2e+76)) tmp = fma(Float64(y - z), Float64(Float64(t - x) / a), x); else tmp = fma(Float64(x - t), Float64(y / z), t); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -8e-92], N[Not[LessEqual[a, 9.2e+76]], $MachinePrecision]], N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], N[(N[(x - t), $MachinePrecision] * N[(y / z), $MachinePrecision] + t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -8 \cdot 10^{-92} \lor \neg \left(a \leq 9.2 \cdot 10^{+76}\right):\\
\;\;\;\;\mathsf{fma}\left(y - z, \frac{t - x}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x - t, \frac{y}{z}, t\right)\\
\end{array}
\end{array}
if a < -7.9999999999999999e-92 or 9.20000000000000005e76 < a Initial program 87.0%
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--.f6475.4
Applied rewrites75.4%
if -7.9999999999999999e-92 < a < 9.20000000000000005e76Initial program 76.2%
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--.f6482.6
Applied rewrites82.6%
Taylor expanded in y around inf
Applied rewrites80.5%
Taylor expanded in x around 0
Applied rewrites80.5%
Final simplification78.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -8.5e-76) (not (<= z 8e+38))) (fma (- x t) (/ y z) t) (fma (- t x) (/ y a) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -8.5e-76) || !(z <= 8e+38)) {
tmp = fma((x - t), (y / z), t);
} else {
tmp = fma((t - x), (y / a), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -8.5e-76) || !(z <= 8e+38)) tmp = fma(Float64(x - t), Float64(y / z), t); else tmp = fma(Float64(t - x), Float64(y / a), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -8.5e-76], N[Not[LessEqual[z, 8e+38]], $MachinePrecision]], N[(N[(x - t), $MachinePrecision] * N[(y / z), $MachinePrecision] + t), $MachinePrecision], N[(N[(t - x), $MachinePrecision] * N[(y / a), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.5 \cdot 10^{-76} \lor \neg \left(z \leq 8 \cdot 10^{+38}\right):\\
\;\;\;\;\mathsf{fma}\left(x - t, \frac{y}{z}, t\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y}{a}, x\right)\\
\end{array}
\end{array}
if z < -8.50000000000000038e-76 or 7.99999999999999982e38 < z Initial program 70.9%
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%
Taylor expanded in y around inf
Applied rewrites74.2%
Taylor expanded in x around 0
Applied rewrites74.2%
if -8.50000000000000038e-76 < z < 7.99999999999999982e38Initial program 94.9%
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--.f6426.5
Applied rewrites26.5%
Taylor expanded in y around inf
Applied rewrites26.9%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower--.f64N/A
lower-/.f6479.9
Applied rewrites79.9%
Final simplification76.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -8e+34) (not (<= a 3.6e+145))) (fma y (/ t a) x) (fma (- x t) (/ y z) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -8e+34) || !(a <= 3.6e+145)) {
tmp = fma(y, (t / a), x);
} else {
tmp = fma((x - t), (y / z), t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -8e+34) || !(a <= 3.6e+145)) tmp = fma(y, Float64(t / a), x); else tmp = fma(Float64(x - t), Float64(y / z), t); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -8e+34], N[Not[LessEqual[a, 3.6e+145]], $MachinePrecision]], N[(y * N[(t / a), $MachinePrecision] + x), $MachinePrecision], N[(N[(x - t), $MachinePrecision] * N[(y / z), $MachinePrecision] + t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -8 \cdot 10^{+34} \lor \neg \left(a \leq 3.6 \cdot 10^{+145}\right):\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x - t, \frac{y}{z}, t\right)\\
\end{array}
\end{array}
if a < -7.99999999999999956e34 or 3.59999999999999974e145 < a Initial program 89.1%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6489.1
Applied rewrites89.1%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6478.0
Applied rewrites78.0%
Taylor expanded in x around 0
Applied rewrites73.8%
if -7.99999999999999956e34 < a < 3.59999999999999974e145Initial program 77.5%
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--.f6476.5
Applied rewrites76.5%
Taylor expanded in y around inf
Applied rewrites74.4%
Taylor expanded in x around 0
Applied rewrites74.4%
Final simplification74.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -8e+34) (not (<= a 3.6e+145))) (fma y (/ t a) x) (fma (/ (- x t) z) y t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -8e+34) || !(a <= 3.6e+145)) {
tmp = fma(y, (t / a), x);
} else {
tmp = fma(((x - t) / z), y, t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -8e+34) || !(a <= 3.6e+145)) tmp = fma(y, Float64(t / a), x); else tmp = fma(Float64(Float64(x - t) / z), y, t); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -8e+34], N[Not[LessEqual[a, 3.6e+145]], $MachinePrecision]], N[(y * N[(t / a), $MachinePrecision] + x), $MachinePrecision], N[(N[(N[(x - t), $MachinePrecision] / z), $MachinePrecision] * y + t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -8 \cdot 10^{+34} \lor \neg \left(a \leq 3.6 \cdot 10^{+145}\right):\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x - t}{z}, y, t\right)\\
\end{array}
\end{array}
if a < -7.99999999999999956e34 or 3.59999999999999974e145 < a Initial program 89.1%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6489.1
Applied rewrites89.1%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6478.0
Applied rewrites78.0%
Taylor expanded in x around 0
Applied rewrites73.8%
if -7.99999999999999956e34 < a < 3.59999999999999974e145Initial program 77.5%
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--.f6476.5
Applied rewrites76.5%
Taylor expanded in a around 0
Applied rewrites73.7%
Final simplification73.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -3.9e-48) (not (<= a 1.16e+120))) (fma y (/ t a) x) (fma (- t) (/ y z) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -3.9e-48) || !(a <= 1.16e+120)) {
tmp = fma(y, (t / a), x);
} else {
tmp = fma(-t, (y / z), t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -3.9e-48) || !(a <= 1.16e+120)) tmp = fma(y, Float64(t / a), x); else tmp = fma(Float64(-t), Float64(y / z), t); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -3.9e-48], N[Not[LessEqual[a, 1.16e+120]], $MachinePrecision]], N[(y * N[(t / a), $MachinePrecision] + x), $MachinePrecision], N[((-t) * N[(y / z), $MachinePrecision] + t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.9 \cdot 10^{-48} \lor \neg \left(a \leq 1.16 \cdot 10^{+120}\right):\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-t, \frac{y}{z}, t\right)\\
\end{array}
\end{array}
if a < -3.9e-48 or 1.16000000000000003e120 < a Initial program 87.4%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6487.4
Applied rewrites87.4%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6473.1
Applied rewrites73.1%
Taylor expanded in x around 0
Applied rewrites68.1%
if -3.9e-48 < a < 1.16000000000000003e120Initial program 77.3%
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--.f6478.9
Applied rewrites78.9%
Taylor expanded in y around inf
Applied rewrites77.1%
Taylor expanded in x around 0
Applied rewrites58.7%
Final simplification62.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -2.7e-92) (not (<= a 1.75e-137))) (fma y (/ t a) x) (* (/ (- x t) z) y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -2.7e-92) || !(a <= 1.75e-137)) {
tmp = fma(y, (t / a), x);
} else {
tmp = ((x - t) / z) * y;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -2.7e-92) || !(a <= 1.75e-137)) tmp = fma(y, Float64(t / a), x); else tmp = Float64(Float64(Float64(x - t) / z) * y); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -2.7e-92], N[Not[LessEqual[a, 1.75e-137]], $MachinePrecision]], N[(y * N[(t / a), $MachinePrecision] + x), $MachinePrecision], N[(N[(N[(x - t), $MachinePrecision] / z), $MachinePrecision] * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.7 \cdot 10^{-92} \lor \neg \left(a \leq 1.75 \cdot 10^{-137}\right):\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x - t}{z} \cdot y\\
\end{array}
\end{array}
if a < -2.69999999999999995e-92 or 1.7500000000000001e-137 < a Initial program 83.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6483.3
Applied rewrites83.3%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6461.0
Applied rewrites61.0%
Taylor expanded in x around 0
Applied rewrites54.7%
if -2.69999999999999995e-92 < a < 1.7500000000000001e-137Initial program 77.8%
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--.f6491.1
Applied rewrites91.1%
Taylor expanded in y around inf
Applied rewrites48.3%
Final simplification52.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -8.2e+135) (not (<= z 7.5e+139))) (+ x (- t x)) (fma y (/ t a) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -8.2e+135) || !(z <= 7.5e+139)) {
tmp = x + (t - x);
} else {
tmp = fma(y, (t / a), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -8.2e+135) || !(z <= 7.5e+139)) tmp = Float64(x + Float64(t - x)); else tmp = fma(y, Float64(t / a), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -8.2e+135], N[Not[LessEqual[z, 7.5e+139]], $MachinePrecision]], N[(x + N[(t - x), $MachinePrecision]), $MachinePrecision], N[(y * N[(t / a), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.2 \cdot 10^{+135} \lor \neg \left(z \leq 7.5 \cdot 10^{+139}\right):\\
\;\;\;\;x + \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t}{a}, x\right)\\
\end{array}
\end{array}
if z < -8.2e135 or 7.49999999999999992e139 < z Initial program 64.3%
Taylor expanded in z around inf
lower--.f6443.7
Applied rewrites43.7%
if -8.2e135 < z < 7.49999999999999992e139Initial program 89.1%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6489.0
Applied rewrites89.0%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6463.7
Applied rewrites63.7%
Taylor expanded in x around 0
Applied rewrites55.8%
Final simplification52.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -5.2e+92) (not (<= y 2.9e-40))) (* (/ x z) y) (+ x (- t x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -5.2e+92) || !(y <= 2.9e-40)) {
tmp = (x / z) * y;
} else {
tmp = x + (t - x);
}
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 ((y <= (-5.2d+92)) .or. (.not. (y <= 2.9d-40))) then
tmp = (x / z) * y
else
tmp = x + (t - x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -5.2e+92) || !(y <= 2.9e-40)) {
tmp = (x / z) * y;
} else {
tmp = x + (t - x);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -5.2e+92) or not (y <= 2.9e-40): tmp = (x / z) * y else: tmp = x + (t - x) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -5.2e+92) || !(y <= 2.9e-40)) tmp = Float64(Float64(x / z) * y); else tmp = Float64(x + Float64(t - x)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((y <= -5.2e+92) || ~((y <= 2.9e-40))) tmp = (x / z) * y; else tmp = x + (t - x); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -5.2e+92], N[Not[LessEqual[y, 2.9e-40]], $MachinePrecision]], N[(N[(x / z), $MachinePrecision] * y), $MachinePrecision], N[(x + N[(t - x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.2 \cdot 10^{+92} \lor \neg \left(y \leq 2.9 \cdot 10^{-40}\right):\\
\;\;\;\;\frac{x}{z} \cdot y\\
\mathbf{else}:\\
\;\;\;\;x + \left(t - x\right)\\
\end{array}
\end{array}
if y < -5.1999999999999998e92 or 2.8999999999999999e-40 < y Initial program 85.9%
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--.f6454.9
Applied rewrites54.9%
Taylor expanded in y around inf
Applied rewrites55.2%
Taylor expanded in x around inf
Applied rewrites36.9%
Taylor expanded in y around inf
Applied rewrites37.4%
if -5.1999999999999998e92 < y < 2.8999999999999999e-40Initial program 77.6%
Taylor expanded in z around inf
lower--.f6432.2
Applied rewrites32.2%
Final simplification34.6%
(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 81.6%
Taylor expanded in z around inf
lower--.f6420.8
Applied rewrites20.8%
(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 81.6%
Taylor expanded in z around inf
lower--.f6420.8
Applied rewrites20.8%
Taylor expanded in x around inf
Applied rewrites2.7%
herbie shell --seed 2024338
(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)))))