
(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 15 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 (<= t_1 -4e-274)
(fma (- t x) (/ (- y z) (- a z)) x)
(if (<= t_1 0.0)
(fma (- x t) (/ (- y a) z) t)
(fma (- t x) (- (/ y (- a z)) (/ z (- a z))) x)))))
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 <= -4e-274) {
tmp = fma((t - x), ((y - z) / (a - z)), x);
} else if (t_1 <= 0.0) {
tmp = fma((x - t), ((y - a) / z), t);
} else {
tmp = fma((t - x), ((y / (a - z)) - (z / (a - z))), x);
}
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 <= -4e-274) tmp = fma(Float64(t - x), Float64(Float64(y - z) / Float64(a - z)), x); elseif (t_1 <= 0.0) tmp = fma(Float64(x - t), Float64(Float64(y - a) / z), t); else tmp = fma(Float64(t - x), Float64(Float64(y / Float64(a - z)) - Float64(z / Float64(a - z))), x); 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[LessEqual[t$95$1, -4e-274], N[(N[(t - x), $MachinePrecision] * N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(N[(x - t), $MachinePrecision] * N[(N[(y - a), $MachinePrecision] / z), $MachinePrecision] + t), $MachinePrecision], N[(N[(t - x), $MachinePrecision] * N[(N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision] - N[(z / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $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 -4 \cdot 10^{-274}:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y - z}{a - z}, x\right)\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\mathsf{fma}\left(x - t, \frac{y - a}{z}, t\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y}{a - z} - \frac{z}{a - z}, x\right)\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -3.99999999999999986e-274Initial program 92.1%
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-/.f6498.5
Applied rewrites98.5%
if -3.99999999999999986e-274 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 0.0Initial program 3.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-/.f646.4
Applied rewrites6.4%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r*N/A
mul-1-negN/A
associate-*r/N/A
div-subN/A
mul-1-negN/A
associate-*r*N/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
Applied rewrites97.6%
Taylor expanded in x around 0
Applied rewrites97.6%
if 0.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 88.3%
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-/.f6492.3
Applied rewrites92.3%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lower--.f64N/A
lower-/.f64N/A
lower-/.f6492.3
Applied rewrites92.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* (- y z) (/ (- t x) (- a z))))))
(if (or (<= t_1 -4e-274) (not (<= t_1 0.0)))
(fma (- t x) (/ (- y z) (- a z)) x)
(fma (- x t) (/ (- y a) z) t))))
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 <= -4e-274) || !(t_1 <= 0.0)) {
tmp = fma((t - x), ((y - z) / (a - z)), x);
} else {
tmp = fma((x - t), ((y - a) / z), t);
}
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 <= -4e-274) || !(t_1 <= 0.0)) tmp = fma(Float64(t - x), Float64(Float64(y - z) / Float64(a - z)), x); else tmp = fma(Float64(x - t), Float64(Float64(y - a) / z), t); 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, -4e-274], 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[(N[(x - t), $MachinePrecision] * N[(N[(y - a), $MachinePrecision] / z), $MachinePrecision] + t), $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 -4 \cdot 10^{-274} \lor \neg \left(t\_1 \leq 0\right):\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y - z}{a - z}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x - t, \frac{y - a}{z}, t\right)\\
\end{array}
\end{array}
if (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < -3.99999999999999986e-274 or 0.0 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) Initial program 90.0%
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-/.f6495.0
Applied rewrites95.0%
if -3.99999999999999986e-274 < (+.f64 x (*.f64 (-.f64 y z) (/.f64 (-.f64 t x) (-.f64 a z)))) < 0.0Initial program 3.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-/.f646.4
Applied rewrites6.4%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r*N/A
mul-1-negN/A
associate-*r/N/A
div-subN/A
mul-1-negN/A
associate-*r*N/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
Applied rewrites97.6%
Taylor expanded in x around 0
Applied rewrites97.6%
Final simplification95.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ (- t x) a) y x)))
(if (<= a -0.041)
t_1
(if (<= a 2.2e-192)
(fma (- t) (/ y z) t)
(if (<= a 1.25e+35) (fma (/ x z) y t) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((t - x) / a), y, x);
double tmp;
if (a <= -0.041) {
tmp = t_1;
} else if (a <= 2.2e-192) {
tmp = fma(-t, (y / z), t);
} else if (a <= 1.25e+35) {
tmp = fma((x / z), y, t);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(t - x) / a), y, x) tmp = 0.0 if (a <= -0.041) tmp = t_1; elseif (a <= 2.2e-192) tmp = fma(Float64(-t), Float64(y / z), t); elseif (a <= 1.25e+35) tmp = fma(Float64(x / z), y, t); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] * y + x), $MachinePrecision]}, If[LessEqual[a, -0.041], t$95$1, If[LessEqual[a, 2.2e-192], N[((-t) * N[(y / z), $MachinePrecision] + t), $MachinePrecision], If[LessEqual[a, 1.25e+35], N[(N[(x / z), $MachinePrecision] * y + t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{t - x}{a}, y, x\right)\\
\mathbf{if}\;a \leq -0.041:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 2.2 \cdot 10^{-192}:\\
\;\;\;\;\mathsf{fma}\left(-t, \frac{y}{z}, t\right)\\
\mathbf{elif}\;a \leq 1.25 \cdot 10^{+35}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{z}, y, t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -0.0410000000000000017 or 1.25000000000000005e35 < a Initial program 92.4%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6475.2
Applied rewrites75.2%
if -0.0410000000000000017 < a < 2.20000000000000006e-192Initial program 71.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-/.f6477.9
Applied rewrites77.9%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r*N/A
mul-1-negN/A
associate-*r/N/A
div-subN/A
mul-1-negN/A
associate-*r*N/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
Applied rewrites82.3%
Taylor expanded in a around 0
Applied rewrites75.4%
Taylor expanded in x around 0
Applied rewrites64.6%
if 2.20000000000000006e-192 < a < 1.25000000000000005e35Initial program 67.5%
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-/.f6473.6
Applied rewrites73.6%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r*N/A
mul-1-negN/A
associate-*r/N/A
div-subN/A
mul-1-negN/A
associate-*r*N/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
Applied rewrites78.1%
Taylor expanded in a around 0
Applied rewrites67.3%
Taylor expanded in x around inf
Applied rewrites60.1%
Final simplification68.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma x (/ z (- a z)) x)))
(if (<= a -2.9e+140)
t_1
(if (<= a -0.45)
(* t (/ (- y z) a))
(if (<= a 1.65e+66) (fma (- t) (/ y z) t) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(x, (z / (a - z)), x);
double tmp;
if (a <= -2.9e+140) {
tmp = t_1;
} else if (a <= -0.45) {
tmp = t * ((y - z) / a);
} else if (a <= 1.65e+66) {
tmp = fma(-t, (y / z), t);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(x, Float64(z / Float64(a - z)), x) tmp = 0.0 if (a <= -2.9e+140) tmp = t_1; elseif (a <= -0.45) tmp = Float64(t * Float64(Float64(y - z) / a)); elseif (a <= 1.65e+66) tmp = fma(Float64(-t), Float64(y / z), t); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x * N[(z / N[(a - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -2.9e+140], t$95$1, If[LessEqual[a, -0.45], N[(t * N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 1.65e+66], N[((-t) * N[(y / z), $MachinePrecision] + t), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(x, \frac{z}{a - z}, x\right)\\
\mathbf{if}\;a \leq -2.9 \cdot 10^{+140}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq -0.45:\\
\;\;\;\;t \cdot \frac{y - z}{a}\\
\mathbf{elif}\;a \leq 1.65 \cdot 10^{+66}:\\
\;\;\;\;\mathsf{fma}\left(-t, \frac{y}{z}, t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -2.8999999999999999e140 or 1.6500000000000001e66 < a Initial program 94.4%
Taylor expanded in y around 0
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower--.f6469.6
Applied rewrites69.6%
Taylor expanded in t around 0
Applied rewrites57.8%
if -2.8999999999999999e140 < a < -0.450000000000000011Initial program 91.4%
Taylor expanded in x around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6466.4
Applied rewrites66.4%
Taylor expanded in a around inf
Applied rewrites48.3%
if -0.450000000000000011 < a < 1.6500000000000001e66Initial program 70.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-/.f6477.1
Applied rewrites77.1%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r*N/A
mul-1-negN/A
associate-*r/N/A
div-subN/A
mul-1-negN/A
associate-*r*N/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
Applied rewrites80.8%
Taylor expanded in a around 0
Applied rewrites71.9%
Taylor expanded in x around 0
Applied rewrites59.9%
Final simplification58.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -0.52) (not (<= a 1.06e+66))) (fma (- t x) (/ (- y z) a) x) (fma (- x t) (/ (- y a) z) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -0.52) || !(a <= 1.06e+66)) {
tmp = fma((t - x), ((y - z) / a), x);
} else {
tmp = fma((x - t), ((y - a) / z), t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -0.52) || !(a <= 1.06e+66)) tmp = fma(Float64(t - x), Float64(Float64(y - z) / a), x); else tmp = fma(Float64(x - t), Float64(Float64(y - a) / z), t); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -0.52], N[Not[LessEqual[a, 1.06e+66]], $MachinePrecision]], N[(N[(t - x), $MachinePrecision] * N[(N[(y - z), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], N[(N[(x - t), $MachinePrecision] * N[(N[(y - a), $MachinePrecision] / z), $MachinePrecision] + t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -0.52 \lor \neg \left(a \leq 1.06 \cdot 10^{+66}\right):\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y - z}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x - t, \frac{y - a}{z}, t\right)\\
\end{array}
\end{array}
if a < -0.52000000000000002 or 1.06000000000000004e66 < a Initial program 93.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-/.f6496.0
Applied rewrites96.0%
Taylor expanded in a around inf
lower-/.f64N/A
lower--.f6486.6
Applied rewrites86.6%
if -0.52000000000000002 < a < 1.06000000000000004e66Initial program 70.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-/.f6477.1
Applied rewrites77.1%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r*N/A
mul-1-negN/A
associate-*r/N/A
div-subN/A
mul-1-negN/A
associate-*r*N/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
Applied rewrites80.8%
Taylor expanded in x around 0
Applied rewrites80.8%
Final simplification83.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -0.52) (not (<= a 1.06e+66))) (fma (- y z) (/ (- t x) a) x) (fma (- x t) (/ (- y a) z) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -0.52) || !(a <= 1.06e+66)) {
tmp = fma((y - z), ((t - x) / a), x);
} else {
tmp = fma((x - t), ((y - a) / z), t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -0.52) || !(a <= 1.06e+66)) tmp = fma(Float64(y - z), Float64(Float64(t - x) / a), x); else tmp = fma(Float64(x - t), Float64(Float64(y - a) / z), t); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -0.52], N[Not[LessEqual[a, 1.06e+66]], $MachinePrecision]], N[(N[(y - z), $MachinePrecision] * N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], N[(N[(x - t), $MachinePrecision] * N[(N[(y - a), $MachinePrecision] / z), $MachinePrecision] + t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -0.52 \lor \neg \left(a \leq 1.06 \cdot 10^{+66}\right):\\
\;\;\;\;\mathsf{fma}\left(y - z, \frac{t - x}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x - t, \frac{y - a}{z}, t\right)\\
\end{array}
\end{array}
if a < -0.52000000000000002 or 1.06000000000000004e66 < a Initial program 93.7%
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--.f6485.7
Applied rewrites85.7%
if -0.52000000000000002 < a < 1.06000000000000004e66Initial program 70.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-/.f6477.1
Applied rewrites77.1%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r*N/A
mul-1-negN/A
associate-*r/N/A
div-subN/A
mul-1-negN/A
associate-*r*N/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
Applied rewrites80.8%
Taylor expanded in x around 0
Applied rewrites80.8%
Final simplification82.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -0.37) (not (<= a 1.06e+66))) (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 <= -0.37) || !(a <= 1.06e+66)) {
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 <= -0.37) || !(a <= 1.06e+66)) 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, -0.37], N[Not[LessEqual[a, 1.06e+66]], $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 -0.37 \lor \neg \left(a \leq 1.06 \cdot 10^{+66}\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 < -0.37 or 1.06000000000000004e66 < a Initial program 93.7%
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--.f6485.7
Applied rewrites85.7%
if -0.37 < a < 1.06000000000000004e66Initial program 70.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-/.f6477.1
Applied rewrites77.1%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r*N/A
mul-1-negN/A
associate-*r/N/A
div-subN/A
mul-1-negN/A
associate-*r*N/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
Applied rewrites80.8%
Taylor expanded in x around 0
Applied rewrites80.8%
Taylor expanded in y around inf
Applied rewrites76.3%
Final simplification80.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -0.37) (not (<= a 1.06e+66))) (fma (- t x) (/ y a) x) (fma (- x t) (/ y z) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -0.37) || !(a <= 1.06e+66)) {
tmp = fma((t - x), (y / a), x);
} else {
tmp = fma((x - t), (y / z), t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -0.37) || !(a <= 1.06e+66)) tmp = fma(Float64(t - x), Float64(y / 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, -0.37], N[Not[LessEqual[a, 1.06e+66]], $MachinePrecision]], N[(N[(t - x), $MachinePrecision] * N[(y / 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 -0.37 \lor \neg \left(a \leq 1.06 \cdot 10^{+66}\right):\\
\;\;\;\;\mathsf{fma}\left(t - x, \frac{y}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x - t, \frac{y}{z}, t\right)\\
\end{array}
\end{array}
if a < -0.37 or 1.06000000000000004e66 < a Initial program 93.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-/.f6496.0
Applied rewrites96.0%
Taylor expanded in z around 0
lower-/.f6477.4
Applied rewrites77.4%
if -0.37 < a < 1.06000000000000004e66Initial program 70.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-/.f6477.1
Applied rewrites77.1%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r*N/A
mul-1-negN/A
associate-*r/N/A
div-subN/A
mul-1-negN/A
associate-*r*N/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
Applied rewrites80.8%
Taylor expanded in x around 0
Applied rewrites80.8%
Taylor expanded in y around inf
Applied rewrites76.3%
Final simplification76.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -0.37) (not (<= a 1.06e+66))) (fma (/ (- t x) a) y x) (fma (- x t) (/ y z) t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -0.37) || !(a <= 1.06e+66)) {
tmp = fma(((t - x) / a), y, x);
} else {
tmp = fma((x - t), (y / z), t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -0.37) || !(a <= 1.06e+66)) tmp = fma(Float64(Float64(t - x) / a), y, 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, -0.37], N[Not[LessEqual[a, 1.06e+66]], $MachinePrecision]], N[(N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] * y + x), $MachinePrecision], N[(N[(x - t), $MachinePrecision] * N[(y / z), $MachinePrecision] + t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -0.37 \lor \neg \left(a \leq 1.06 \cdot 10^{+66}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{t - x}{a}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x - t, \frac{y}{z}, t\right)\\
\end{array}
\end{array}
if a < -0.37 or 1.06000000000000004e66 < a Initial program 93.7%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6477.1
Applied rewrites77.1%
if -0.37 < a < 1.06000000000000004e66Initial program 70.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-/.f6477.1
Applied rewrites77.1%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r*N/A
mul-1-negN/A
associate-*r/N/A
div-subN/A
mul-1-negN/A
associate-*r*N/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
Applied rewrites80.8%
Taylor expanded in x around 0
Applied rewrites80.8%
Taylor expanded in y around inf
Applied rewrites76.3%
Final simplification76.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -0.37) (not (<= a 1.06e+66))) (fma (/ (- t x) a) y x) (fma (/ (- x t) z) y t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -0.37) || !(a <= 1.06e+66)) {
tmp = fma(((t - x) / a), y, x);
} else {
tmp = fma(((x - t) / z), y, t);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -0.37) || !(a <= 1.06e+66)) tmp = fma(Float64(Float64(t - x) / a), y, 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, -0.37], N[Not[LessEqual[a, 1.06e+66]], $MachinePrecision]], N[(N[(N[(t - x), $MachinePrecision] / a), $MachinePrecision] * y + x), $MachinePrecision], N[(N[(N[(x - t), $MachinePrecision] / z), $MachinePrecision] * y + t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -0.37 \lor \neg \left(a \leq 1.06 \cdot 10^{+66}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{t - x}{a}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x - t}{z}, y, t\right)\\
\end{array}
\end{array}
if a < -0.37 or 1.06000000000000004e66 < a Initial program 93.7%
Taylor expanded in z around 0
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f6477.1
Applied rewrites77.1%
if -0.37 < a < 1.06000000000000004e66Initial program 70.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-/.f6477.1
Applied rewrites77.1%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r*N/A
mul-1-negN/A
associate-*r/N/A
div-subN/A
mul-1-negN/A
associate-*r*N/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
Applied rewrites80.8%
Taylor expanded in a around 0
Applied rewrites71.9%
Final simplification74.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -9.5e+26) (not (<= z 2.1e-30))) (fma (/ x z) y t) (* t (/ y (- a z)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -9.5e+26) || !(z <= 2.1e-30)) {
tmp = fma((x / z), y, t);
} else {
tmp = t * (y / (a - z));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -9.5e+26) || !(z <= 2.1e-30)) tmp = fma(Float64(x / z), y, t); else tmp = Float64(t * Float64(y / Float64(a - z))); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -9.5e+26], N[Not[LessEqual[z, 2.1e-30]], $MachinePrecision]], N[(N[(x / z), $MachinePrecision] * y + t), $MachinePrecision], N[(t * N[(y / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.5 \cdot 10^{+26} \lor \neg \left(z \leq 2.1 \cdot 10^{-30}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{z}, y, t\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{y}{a - z}\\
\end{array}
\end{array}
if z < -9.50000000000000054e26 or 2.1000000000000002e-30 < z Initial program 70.0%
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-/.f6475.1
Applied rewrites75.1%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r*N/A
mul-1-negN/A
associate-*r/N/A
div-subN/A
mul-1-negN/A
associate-*r*N/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
Applied rewrites74.2%
Taylor expanded in a around 0
Applied rewrites67.1%
Taylor expanded in x around inf
Applied rewrites60.0%
if -9.50000000000000054e26 < z < 2.1000000000000002e-30Initial program 89.5%
Taylor expanded in x around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6445.2
Applied rewrites45.2%
Taylor expanded in y around inf
Applied rewrites43.9%
Final simplification51.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -6e-17) (not (<= z 2.1e-44))) (fma (/ x z) y t) (* t (/ y a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -6e-17) || !(z <= 2.1e-44)) {
tmp = fma((x / z), y, t);
} else {
tmp = t * (y / a);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -6e-17) || !(z <= 2.1e-44)) tmp = fma(Float64(x / z), y, t); else tmp = Float64(t * Float64(y / a)); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -6e-17], N[Not[LessEqual[z, 2.1e-44]], $MachinePrecision]], N[(N[(x / z), $MachinePrecision] * y + t), $MachinePrecision], N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6 \cdot 10^{-17} \lor \neg \left(z \leq 2.1 \cdot 10^{-44}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{z}, y, t\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{y}{a}\\
\end{array}
\end{array}
if z < -6.00000000000000012e-17 or 2.10000000000000001e-44 < z Initial program 73.0%
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-/.f6477.7
Applied rewrites77.7%
Taylor expanded in z around inf
associate--l+N/A
associate-*r/N/A
associate-*r*N/A
mul-1-negN/A
associate-*r/N/A
div-subN/A
mul-1-negN/A
associate-*r*N/A
distribute-lft-out--N/A
distribute-rgt-out--N/A
associate-*r/N/A
distribute-rgt-out--N/A
Applied rewrites72.4%
Taylor expanded in a around 0
Applied rewrites65.8%
Taylor expanded in x around inf
Applied rewrites54.8%
if -6.00000000000000012e-17 < z < 2.10000000000000001e-44Initial program 88.6%
Taylor expanded in x around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6442.0
Applied rewrites42.0%
Taylor expanded in z around 0
Applied rewrites33.5%
Final simplification45.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.1e+42) (not (<= z 2.8e-43))) (+ x (- t x)) (* t (/ y a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.1e+42) || !(z <= 2.8e-43)) {
tmp = x + (t - x);
} else {
tmp = t * (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.1d+42)) .or. (.not. (z <= 2.8d-43))) then
tmp = x + (t - x)
else
tmp = t * (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.1e+42) || !(z <= 2.8e-43)) {
tmp = x + (t - x);
} else {
tmp = t * (y / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.1e+42) or not (z <= 2.8e-43): tmp = x + (t - x) else: tmp = t * (y / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.1e+42) || !(z <= 2.8e-43)) tmp = Float64(x + Float64(t - x)); else tmp = Float64(t * Float64(y / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.1e+42) || ~((z <= 2.8e-43))) tmp = x + (t - x); else tmp = t * (y / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.1e+42], N[Not[LessEqual[z, 2.8e-43]], $MachinePrecision]], N[(x + N[(t - x), $MachinePrecision]), $MachinePrecision], N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.1 \cdot 10^{+42} \lor \neg \left(z \leq 2.8 \cdot 10^{-43}\right):\\
\;\;\;\;x + \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{y}{a}\\
\end{array}
\end{array}
if z < -1.1000000000000001e42 or 2.7999999999999998e-43 < z Initial program 71.0%
Taylor expanded in z around inf
lower--.f6435.6
Applied rewrites35.6%
if -1.1000000000000001e42 < z < 2.7999999999999998e-43Initial program 88.7%
Taylor expanded in x around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6444.7
Applied rewrites44.7%
Taylor expanded in z around 0
Applied rewrites31.2%
Final simplification33.4%
(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 79.8%
Taylor expanded in z around inf
lower--.f6419.7
Applied rewrites19.7%
(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 79.8%
Taylor expanded in z around inf
lower--.f6419.7
Applied rewrites19.7%
Taylor expanded in x around inf
Applied rewrites2.8%
herbie shell --seed 2024337
(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)))))