
(FPCore (x y z t a) :precision binary64 (- x (/ (- y z) (/ (+ (- t z) 1.0) a))))
double code(double x, double y, double z, double t, double a) {
return x - ((y - z) / (((t - z) + 1.0) / a));
}
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 - z) + 1.0d0) / a))
end function
public static double code(double x, double y, double z, double t, double a) {
return x - ((y - z) / (((t - z) + 1.0) / a));
}
def code(x, y, z, t, a): return x - ((y - z) / (((t - z) + 1.0) / a))
function code(x, y, z, t, a) return Float64(x - Float64(Float64(y - z) / Float64(Float64(Float64(t - z) + 1.0) / a))) end
function tmp = code(x, y, z, t, a) tmp = x - ((y - z) / (((t - z) + 1.0) / a)); end
code[x_, y_, z_, t_, a_] := N[(x - N[(N[(y - z), $MachinePrecision] / N[(N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y - z}{\frac{\left(t - z\right) + 1}{a}}
\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 z) 1.0) a))))
double code(double x, double y, double z, double t, double a) {
return x - ((y - z) / (((t - z) + 1.0) / a));
}
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 - z) + 1.0d0) / a))
end function
public static double code(double x, double y, double z, double t, double a) {
return x - ((y - z) / (((t - z) + 1.0) / a));
}
def code(x, y, z, t, a): return x - ((y - z) / (((t - z) + 1.0) / a))
function code(x, y, z, t, a) return Float64(x - Float64(Float64(y - z) / Float64(Float64(Float64(t - z) + 1.0) / a))) end
function tmp = code(x, y, z, t, a) tmp = x - ((y - z) / (((t - z) + 1.0) / a)); end
code[x_, y_, z_, t_, a_] := N[(x - N[(N[(y - z), $MachinePrecision] / N[(N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y - z}{\frac{\left(t - z\right) + 1}{a}}
\end{array}
(FPCore (x y z t a) :precision binary64 (fma (/ a (- -1.0 (- t z))) (- y z) x))
double code(double x, double y, double z, double t, double a) {
return fma((a / (-1.0 - (t - z))), (y - z), x);
}
function code(x, y, z, t, a) return fma(Float64(a / Float64(-1.0 - Float64(t - z))), Float64(y - z), x) end
code[x_, y_, z_, t_, a_] := N[(N[(a / N[(-1.0 - N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{a}{-1 - \left(t - z\right)}, y - z, x\right)
\end{array}
Initial program 96.9%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lift-/.f64N/A
clear-numN/A
distribute-lft-neg-inN/A
clear-numN/A
lift-/.f64N/A
distribute-frac-neg2N/A
lower-fma.f64N/A
Applied rewrites97.2%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* (- a) y)) (t_2 (/ (- z y) (/ (- -1.0 (- t z)) a)))) (if (<= t_2 (- INFINITY)) t_1 (if (<= t_2 1e+216) (- x a) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = -a * y;
double t_2 = (z - y) / ((-1.0 - (t - z)) / a);
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_2 <= 1e+216) {
tmp = x - a;
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = -a * y;
double t_2 = (z - y) / ((-1.0 - (t - z)) / a);
double tmp;
if (t_2 <= -Double.POSITIVE_INFINITY) {
tmp = t_1;
} else if (t_2 <= 1e+216) {
tmp = x - a;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = -a * y t_2 = (z - y) / ((-1.0 - (t - z)) / a) tmp = 0 if t_2 <= -math.inf: tmp = t_1 elif t_2 <= 1e+216: tmp = x - a else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(-a) * y) t_2 = Float64(Float64(z - y) / Float64(Float64(-1.0 - Float64(t - z)) / a)) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_1; elseif (t_2 <= 1e+216) tmp = Float64(x - a); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = -a * y; t_2 = (z - y) / ((-1.0 - (t - z)) / a); tmp = 0.0; if (t_2 <= -Inf) tmp = t_1; elseif (t_2 <= 1e+216) tmp = x - a; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[((-a) * y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(z - y), $MachinePrecision] / N[(N[(-1.0 - N[(t - z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, 1e+216], N[(x - a), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-a\right) \cdot y\\
t_2 := \frac{z - y}{\frac{-1 - \left(t - z\right)}{a}}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10^{+216}:\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (-.f64 y z) (/.f64 (+.f64 (-.f64 t z) #s(literal 1 binary64)) a)) < -inf.0 or 1e216 < (/.f64 (-.f64 y z) (/.f64 (+.f64 (-.f64 t z) #s(literal 1 binary64)) a)) Initial program 99.8%
Taylor expanded in t around 0
sub-negN/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
distribute-neg-fracN/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower--.f6481.9
Applied rewrites81.9%
Taylor expanded in a around inf
Applied rewrites70.6%
Taylor expanded in z around 0
Applied rewrites64.2%
if -inf.0 < (/.f64 (-.f64 y z) (/.f64 (+.f64 (-.f64 t z) #s(literal 1 binary64)) a)) < 1e216Initial program 96.5%
Taylor expanded in z around inf
lower--.f6465.2
Applied rewrites65.2%
Final simplification65.1%
(FPCore (x y z t a)
:precision binary64
(if (<= z -1.45)
(- x a)
(if (<= z 5e-247)
(fma (fma (- 1.0 y) z (- y)) a x)
(if (<= z 6.5e+18) (fma (/ y t) (- a) x) (- x a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.45) {
tmp = x - a;
} else if (z <= 5e-247) {
tmp = fma(fma((1.0 - y), z, -y), a, x);
} else if (z <= 6.5e+18) {
tmp = fma((y / t), -a, x);
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.45) tmp = Float64(x - a); elseif (z <= 5e-247) tmp = fma(fma(Float64(1.0 - y), z, Float64(-y)), a, x); elseif (z <= 6.5e+18) tmp = fma(Float64(y / t), Float64(-a), x); else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.45], N[(x - a), $MachinePrecision], If[LessEqual[z, 5e-247], N[(N[(N[(1.0 - y), $MachinePrecision] * z + (-y)), $MachinePrecision] * a + x), $MachinePrecision], If[LessEqual[z, 6.5e+18], N[(N[(y / t), $MachinePrecision] * (-a) + x), $MachinePrecision], N[(x - a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.45:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 5 \cdot 10^{-247}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(1 - y, z, -y\right), a, x\right)\\
\mathbf{elif}\;z \leq 6.5 \cdot 10^{+18}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{t}, -a, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -1.44999999999999996 or 6.5e18 < z Initial program 94.5%
Taylor expanded in z around inf
lower--.f6479.0
Applied rewrites79.0%
if -1.44999999999999996 < z < 4.99999999999999978e-247Initial program 99.9%
Taylor expanded in t around 0
sub-negN/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
distribute-neg-fracN/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower--.f6482.2
Applied rewrites82.2%
Taylor expanded in z around 0
Applied rewrites82.2%
if 4.99999999999999978e-247 < z < 6.5e18Initial program 98.2%
Taylor expanded in t around inf
mul-1-negN/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-neg.f6477.3
Applied rewrites77.3%
Taylor expanded in z around 0
Applied rewrites77.3%
(FPCore (x y z t a)
:precision binary64
(if (<= z -1.45)
(- x a)
(if (<= z 5e-247)
(fma (fma (- 1.0 y) z (- y)) a x)
(if (<= z 6.5e+18) (fma (/ (- a) t) y x) (- x a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.45) {
tmp = x - a;
} else if (z <= 5e-247) {
tmp = fma(fma((1.0 - y), z, -y), a, x);
} else if (z <= 6.5e+18) {
tmp = fma((-a / t), y, x);
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.45) tmp = Float64(x - a); elseif (z <= 5e-247) tmp = fma(fma(Float64(1.0 - y), z, Float64(-y)), a, x); elseif (z <= 6.5e+18) tmp = fma(Float64(Float64(-a) / t), y, x); else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.45], N[(x - a), $MachinePrecision], If[LessEqual[z, 5e-247], N[(N[(N[(1.0 - y), $MachinePrecision] * z + (-y)), $MachinePrecision] * a + x), $MachinePrecision], If[LessEqual[z, 6.5e+18], N[(N[((-a) / t), $MachinePrecision] * y + x), $MachinePrecision], N[(x - a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.45:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 5 \cdot 10^{-247}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(1 - y, z, -y\right), a, x\right)\\
\mathbf{elif}\;z \leq 6.5 \cdot 10^{+18}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-a}{t}, y, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -1.44999999999999996 or 6.5e18 < z Initial program 94.5%
Taylor expanded in z around inf
lower--.f6479.0
Applied rewrites79.0%
if -1.44999999999999996 < z < 4.99999999999999978e-247Initial program 99.9%
Taylor expanded in t around 0
sub-negN/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
distribute-neg-fracN/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower--.f6482.2
Applied rewrites82.2%
Taylor expanded in z around 0
Applied rewrites82.2%
if 4.99999999999999978e-247 < z < 6.5e18Initial program 98.2%
Taylor expanded in t around inf
mul-1-negN/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-neg.f6477.3
Applied rewrites77.3%
Taylor expanded in y around inf
Applied rewrites27.3%
Taylor expanded in z around 0
Applied rewrites75.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ a (- t)) (- y z) x)))
(if (<= t -1.5e+51)
t_1
(if (<= t 2.8e+30) (fma (/ (- z y) (- 1.0 z)) a x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((a / -t), (y - z), x);
double tmp;
if (t <= -1.5e+51) {
tmp = t_1;
} else if (t <= 2.8e+30) {
tmp = fma(((z - y) / (1.0 - z)), a, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(a / Float64(-t)), Float64(y - z), x) tmp = 0.0 if (t <= -1.5e+51) tmp = t_1; elseif (t <= 2.8e+30) tmp = fma(Float64(Float64(z - y) / Float64(1.0 - z)), a, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(a / (-t)), $MachinePrecision] * N[(y - z), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[t, -1.5e+51], t$95$1, If[LessEqual[t, 2.8e+30], N[(N[(N[(z - y), $MachinePrecision] / N[(1.0 - z), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{a}{-t}, y - z, x\right)\\
\mathbf{if}\;t \leq -1.5 \cdot 10^{+51}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 2.8 \cdot 10^{+30}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - y}{1 - z}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.5e51 or 2.79999999999999983e30 < t Initial program 98.0%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lift-/.f64N/A
clear-numN/A
distribute-lft-neg-inN/A
clear-numN/A
lift-/.f64N/A
distribute-frac-neg2N/A
lower-fma.f64N/A
Applied rewrites98.7%
Taylor expanded in t around inf
mul-1-negN/A
lower-neg.f6488.1
Applied rewrites88.1%
if -1.5e51 < t < 2.79999999999999983e30Initial program 96.2%
Taylor expanded in t around 0
sub-negN/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
distribute-neg-fracN/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower--.f6495.8
Applied rewrites95.8%
Final simplification92.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ a (- t)) (- y z) x)))
(if (<= t -1.5e+51)
t_1
(if (<= t 2.8e+30) (fma (/ a (- z 1.0)) (- y z) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((a / -t), (y - z), x);
double tmp;
if (t <= -1.5e+51) {
tmp = t_1;
} else if (t <= 2.8e+30) {
tmp = fma((a / (z - 1.0)), (y - z), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(a / Float64(-t)), Float64(y - z), x) tmp = 0.0 if (t <= -1.5e+51) tmp = t_1; elseif (t <= 2.8e+30) tmp = fma(Float64(a / Float64(z - 1.0)), Float64(y - z), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(a / (-t)), $MachinePrecision] * N[(y - z), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[t, -1.5e+51], t$95$1, If[LessEqual[t, 2.8e+30], N[(N[(a / N[(z - 1.0), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{a}{-t}, y - z, x\right)\\
\mathbf{if}\;t \leq -1.5 \cdot 10^{+51}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 2.8 \cdot 10^{+30}:\\
\;\;\;\;\mathsf{fma}\left(\frac{a}{z - 1}, y - z, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.5e51 or 2.79999999999999983e30 < t Initial program 98.0%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lift-/.f64N/A
clear-numN/A
distribute-lft-neg-inN/A
clear-numN/A
lift-/.f64N/A
distribute-frac-neg2N/A
lower-fma.f64N/A
Applied rewrites98.7%
Taylor expanded in t around inf
mul-1-negN/A
lower-neg.f6488.1
Applied rewrites88.1%
if -1.5e51 < t < 2.79999999999999983e30Initial program 96.2%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lift-/.f64N/A
clear-numN/A
distribute-lft-neg-inN/A
clear-numN/A
lift-/.f64N/A
distribute-frac-neg2N/A
lower-fma.f64N/A
Applied rewrites96.2%
Taylor expanded in t around 0
lower--.f6492.1
Applied rewrites92.1%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma (/ z (- (- t -1.0) z)) a x))) (if (<= z -6.8e-57) t_1 (if (<= z 7e-11) (fma (/ y (- -1.0 t)) a x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((z / ((t - -1.0) - z)), a, x);
double tmp;
if (z <= -6.8e-57) {
tmp = t_1;
} else if (z <= 7e-11) {
tmp = fma((y / (-1.0 - t)), a, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(z / Float64(Float64(t - -1.0) - z)), a, x) tmp = 0.0 if (z <= -6.8e-57) tmp = t_1; elseif (z <= 7e-11) tmp = fma(Float64(y / Float64(-1.0 - t)), a, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z / N[(N[(t - -1.0), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision]}, If[LessEqual[z, -6.8e-57], t$95$1, If[LessEqual[z, 7e-11], N[(N[(y / N[(-1.0 - t), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{z}{\left(t - -1\right) - z}, a, x\right)\\
\mathbf{if}\;z \leq -6.8 \cdot 10^{-57}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 7 \cdot 10^{-11}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{-1 - t}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -6.80000000000000032e-57 or 7.00000000000000038e-11 < z Initial program 94.5%
Taylor expanded in y around 0
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f6487.8
Applied rewrites87.8%
if -6.80000000000000032e-57 < z < 7.00000000000000038e-11Initial program 99.8%
Taylor expanded in z around 0
sub-negN/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
distribute-neg-frac2N/A
lower-/.f64N/A
distribute-neg-inN/A
metadata-evalN/A
unsub-negN/A
lower--.f6493.3
Applied rewrites93.3%
Final simplification90.3%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma z (/ a (- (- t -1.0) z)) x))) (if (<= z -1.95e-97) t_1 (if (<= z 7e-11) (fma (/ y (- -1.0 t)) a x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(z, (a / ((t - -1.0) - z)), x);
double tmp;
if (z <= -1.95e-97) {
tmp = t_1;
} else if (z <= 7e-11) {
tmp = fma((y / (-1.0 - t)), a, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(z, Float64(a / Float64(Float64(t - -1.0) - z)), x) tmp = 0.0 if (z <= -1.95e-97) tmp = t_1; elseif (z <= 7e-11) tmp = fma(Float64(y / Float64(-1.0 - t)), a, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(z * N[(a / N[(N[(t - -1.0), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[z, -1.95e-97], t$95$1, If[LessEqual[z, 7e-11], N[(N[(y / N[(-1.0 - t), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(z, \frac{a}{\left(t - -1\right) - z}, x\right)\\
\mathbf{if}\;z \leq -1.95 \cdot 10^{-97}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 7 \cdot 10^{-11}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{-1 - t}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.9499999999999999e-97 or 7.00000000000000038e-11 < z Initial program 94.9%
Taylor expanded in y around 0
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f6486.0
Applied rewrites86.0%
Applied rewrites82.6%
if -1.9499999999999999e-97 < z < 7.00000000000000038e-11Initial program 99.8%
Taylor expanded in z around 0
sub-negN/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
distribute-neg-frac2N/A
lower-/.f64N/A
distribute-neg-inN/A
metadata-evalN/A
unsub-negN/A
lower--.f6496.3
Applied rewrites96.3%
Final simplification88.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ a z) (- y z) x)))
(if (<= z -4.2e-16)
t_1
(if (<= z 1.15e+15) (fma (/ y (- -1.0 t)) a x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma((a / z), (y - z), x);
double tmp;
if (z <= -4.2e-16) {
tmp = t_1;
} else if (z <= 1.15e+15) {
tmp = fma((y / (-1.0 - t)), a, x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(a / z), Float64(y - z), x) tmp = 0.0 if (z <= -4.2e-16) tmp = t_1; elseif (z <= 1.15e+15) tmp = fma(Float64(y / Float64(-1.0 - t)), a, x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(a / z), $MachinePrecision] * N[(y - z), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[z, -4.2e-16], t$95$1, If[LessEqual[z, 1.15e+15], N[(N[(y / N[(-1.0 - t), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{a}{z}, y - z, x\right)\\
\mathbf{if}\;z \leq -4.2 \cdot 10^{-16}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.15 \cdot 10^{+15}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{-1 - t}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -4.2000000000000002e-16 or 1.15e15 < z Initial program 94.6%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lift-/.f64N/A
clear-numN/A
distribute-lft-neg-inN/A
clear-numN/A
lift-/.f64N/A
distribute-frac-neg2N/A
lower-fma.f64N/A
Applied rewrites95.1%
Taylor expanded in z around inf
lower-/.f6482.3
Applied rewrites82.3%
if -4.2000000000000002e-16 < z < 1.15e15Initial program 99.1%
Taylor expanded in z around 0
sub-negN/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
distribute-neg-frac2N/A
lower-/.f64N/A
distribute-neg-inN/A
metadata-evalN/A
unsub-negN/A
lower--.f6490.1
Applied rewrites90.1%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.35e-56) (fma (/ z (- 1.0 z)) a x) (if (<= z 6.5e+18) (fma (/ y (- -1.0 t)) a x) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.35e-56) {
tmp = fma((z / (1.0 - z)), a, x);
} else if (z <= 6.5e+18) {
tmp = fma((y / (-1.0 - t)), a, x);
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.35e-56) tmp = fma(Float64(z / Float64(1.0 - z)), a, x); elseif (z <= 6.5e+18) tmp = fma(Float64(y / Float64(-1.0 - t)), a, x); else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.35e-56], N[(N[(z / N[(1.0 - z), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision], If[LessEqual[z, 6.5e+18], N[(N[(y / N[(-1.0 - t), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.35 \cdot 10^{-56}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{1 - z}, a, x\right)\\
\mathbf{elif}\;z \leq 6.5 \cdot 10^{+18}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{-1 - t}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -1.34999999999999997e-56Initial program 97.2%
Taylor expanded in y around 0
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f6484.9
Applied rewrites84.9%
Taylor expanded in t around 0
Applied rewrites75.4%
if -1.34999999999999997e-56 < z < 6.5e18Initial program 99.1%
Taylor expanded in z around 0
sub-negN/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
distribute-neg-frac2N/A
lower-/.f64N/A
distribute-neg-inN/A
metadata-evalN/A
unsub-negN/A
lower--.f6491.6
Applied rewrites91.6%
if 6.5e18 < z Initial program 92.0%
Taylor expanded in z around inf
lower--.f6483.8
Applied rewrites83.8%
(FPCore (x y z t a) :precision binary64 (if (<= z -4.2) (- x a) (if (<= z 6.5e+18) (fma (/ y (- -1.0 t)) a x) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -4.2) {
tmp = x - a;
} else if (z <= 6.5e+18) {
tmp = fma((y / (-1.0 - t)), a, x);
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -4.2) tmp = Float64(x - a); elseif (z <= 6.5e+18) tmp = fma(Float64(y / Float64(-1.0 - t)), a, x); else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -4.2], N[(x - a), $MachinePrecision], If[LessEqual[z, 6.5e+18], N[(N[(y / N[(-1.0 - t), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.2:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 6.5 \cdot 10^{+18}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{-1 - t}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -4.20000000000000018 or 6.5e18 < z Initial program 94.5%
Taylor expanded in z around inf
lower--.f6479.0
Applied rewrites79.0%
if -4.20000000000000018 < z < 6.5e18Initial program 99.1%
Taylor expanded in z around 0
sub-negN/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
distribute-neg-frac2N/A
lower-/.f64N/A
distribute-neg-inN/A
metadata-evalN/A
unsub-negN/A
lower--.f6489.6
Applied rewrites89.6%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.45) (- x a) (if (<= z 1950000.0) (fma (fma (- 1.0 y) z (- y)) a x) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.45) {
tmp = x - a;
} else if (z <= 1950000.0) {
tmp = fma(fma((1.0 - y), z, -y), a, x);
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.45) tmp = Float64(x - a); elseif (z <= 1950000.0) tmp = fma(fma(Float64(1.0 - y), z, Float64(-y)), a, x); else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.45], N[(x - a), $MachinePrecision], If[LessEqual[z, 1950000.0], N[(N[(N[(1.0 - y), $MachinePrecision] * z + (-y)), $MachinePrecision] * a + x), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.45:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 1950000:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(1 - y, z, -y\right), a, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -1.44999999999999996 or 1.95e6 < z Initial program 93.8%
Taylor expanded in z around inf
lower--.f6478.5
Applied rewrites78.5%
if -1.44999999999999996 < z < 1.95e6Initial program 99.8%
Taylor expanded in t around 0
sub-negN/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
distribute-neg-fracN/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower--.f6476.0
Applied rewrites76.0%
Taylor expanded in z around 0
Applied rewrites75.8%
(FPCore (x y z t a) :precision binary64 (if (<= z -3.9) (- x a) (if (<= z 1960000.0) (fma (- y) a x) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.9) {
tmp = x - a;
} else if (z <= 1960000.0) {
tmp = fma(-y, a, x);
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.9) tmp = Float64(x - a); elseif (z <= 1960000.0) tmp = fma(Float64(-y), a, x); else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.9], N[(x - a), $MachinePrecision], If[LessEqual[z, 1960000.0], N[((-y) * a + x), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.9:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 1960000:\\
\;\;\;\;\mathsf{fma}\left(-y, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -3.89999999999999991 or 1.96e6 < z Initial program 93.8%
Taylor expanded in z around inf
lower--.f6478.5
Applied rewrites78.5%
if -3.89999999999999991 < z < 1.96e6Initial program 99.8%
Taylor expanded in t around 0
sub-negN/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
distribute-neg-fracN/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower--.f6476.0
Applied rewrites76.0%
Taylor expanded in z around 0
Applied rewrites69.7%
(FPCore (x y z t a) :precision binary64 (- x a))
double code(double x, double y, double z, double t, double a) {
return x - a;
}
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 - a
end function
public static double code(double x, double y, double z, double t, double a) {
return x - a;
}
def code(x, y, z, t, a): return x - a
function code(x, y, z, t, a) return Float64(x - a) end
function tmp = code(x, y, z, t, a) tmp = x - a; end
code[x_, y_, z_, t_, a_] := N[(x - a), $MachinePrecision]
\begin{array}{l}
\\
x - a
\end{array}
Initial program 96.9%
Taylor expanded in z around inf
lower--.f6459.1
Applied rewrites59.1%
(FPCore (x y z t a) :precision binary64 (- a))
double code(double x, double y, double z, double t, double a) {
return -a;
}
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 = -a
end function
public static double code(double x, double y, double z, double t, double a) {
return -a;
}
def code(x, y, z, t, a): return -a
function code(x, y, z, t, a) return Float64(-a) end
function tmp = code(x, y, z, t, a) tmp = -a; end
code[x_, y_, z_, t_, a_] := (-a)
\begin{array}{l}
\\
-a
\end{array}
Initial program 96.9%
Taylor expanded in z around inf
lower--.f6459.1
Applied rewrites59.1%
Taylor expanded in a around inf
Applied rewrites19.1%
(FPCore (x y z t a) :precision binary64 (- x (* (/ (- y z) (+ (- t z) 1.0)) a)))
double code(double x, double y, double z, double t, double a) {
return x - (((y - z) / ((t - z) + 1.0)) * a);
}
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 - z) + 1.0d0)) * a)
end function
public static double code(double x, double y, double z, double t, double a) {
return x - (((y - z) / ((t - z) + 1.0)) * a);
}
def code(x, y, z, t, a): return x - (((y - z) / ((t - z) + 1.0)) * a)
function code(x, y, z, t, a) return Float64(x - Float64(Float64(Float64(y - z) / Float64(Float64(t - z) + 1.0)) * a)) end
function tmp = code(x, y, z, t, a) tmp = x - (((y - z) / ((t - z) + 1.0)) * a); end
code[x_, y_, z_, t_, a_] := N[(x - N[(N[(N[(y - z), $MachinePrecision] / N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y - z}{\left(t - z\right) + 1} \cdot a
\end{array}
herbie shell --seed 2024243
(FPCore (x y z t a)
:name "Graphics.Rendering.Chart.SparkLine:renderSparkLine from Chart-1.5.3"
:precision binary64
:alt
(! :herbie-platform default (- x (* (/ (- y z) (+ (- t z) 1)) a)))
(- x (/ (- y z) (/ (+ (- t z) 1.0) a))))