
(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
(let* ((t_1 (/ (- y z) (/ (+ (- t z) 1.0) a))))
(if (or (<= t_1 -1e+57) (not (<= t_1 2.5e-71)))
(- x t_1)
(- x (/ (fma y a (* (- z) a)) (+ 1.0 (- t z)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y - z) / (((t - z) + 1.0) / a);
double tmp;
if ((t_1 <= -1e+57) || !(t_1 <= 2.5e-71)) {
tmp = x - t_1;
} else {
tmp = x - (fma(y, a, (-z * a)) / (1.0 + (t - z)));
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(y - z) / Float64(Float64(Float64(t - z) + 1.0) / a)) tmp = 0.0 if ((t_1 <= -1e+57) || !(t_1 <= 2.5e-71)) tmp = Float64(x - t_1); else tmp = Float64(x - Float64(fma(y, a, Float64(Float64(-z) * a)) / Float64(1.0 + Float64(t - z)))); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] / N[(N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -1e+57], N[Not[LessEqual[t$95$1, 2.5e-71]], $MachinePrecision]], N[(x - t$95$1), $MachinePrecision], N[(x - N[(N[(y * a + N[((-z) * a), $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y - z}{\frac{\left(t - z\right) + 1}{a}}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+57} \lor \neg \left(t\_1 \leq 2.5 \cdot 10^{-71}\right):\\
\;\;\;\;x - t\_1\\
\mathbf{else}:\\
\;\;\;\;x - \frac{\mathsf{fma}\left(y, a, \left(-z\right) \cdot a\right)}{1 + \left(t - z\right)}\\
\end{array}
\end{array}
if (/.f64 (-.f64 y z) (/.f64 (+.f64 (-.f64 t z) #s(literal 1 binary64)) a)) < -1.00000000000000005e57 or 2.49999999999999999e-71 < (/.f64 (-.f64 y z) (/.f64 (+.f64 (-.f64 t z) #s(literal 1 binary64)) a)) Initial program 99.8%
if -1.00000000000000005e57 < (/.f64 (-.f64 y z) (/.f64 (+.f64 (-.f64 t z) #s(literal 1 binary64)) a)) < 2.49999999999999999e-71Initial program 92.5%
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6499.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
Applied rewrites99.9%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
sub-negN/A
lift-neg.f64N/A
distribute-rgt-inN/A
lower-fma.f64N/A
lower-*.f6499.9
Applied rewrites99.9%
Final simplification99.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- y z) (/ (+ (- t z) 1.0) a))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 5e+293)))
(* y (/ a z))
(- x a))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y - z) / (((t - z) + 1.0) / a);
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 5e+293)) {
tmp = y * (a / z);
} else {
tmp = x - a;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (y - z) / (((t - z) + 1.0) / a);
double tmp;
if ((t_1 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 5e+293)) {
tmp = y * (a / z);
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y - z) / (((t - z) + 1.0) / a) tmp = 0 if (t_1 <= -math.inf) or not (t_1 <= 5e+293): tmp = y * (a / z) else: tmp = x - a return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y - z) / Float64(Float64(Float64(t - z) + 1.0) / a)) tmp = 0.0 if ((t_1 <= Float64(-Inf)) || !(t_1 <= 5e+293)) tmp = Float64(y * Float64(a / z)); else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y - z) / (((t - z) + 1.0) / a); tmp = 0.0; if ((t_1 <= -Inf) || ~((t_1 <= 5e+293))) tmp = y * (a / z); else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] / N[(N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 5e+293]], $MachinePrecision]], N[(y * N[(a / z), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y - z}{\frac{\left(t - z\right) + 1}{a}}\\
\mathbf{if}\;t\_1 \leq -\infty \lor \neg \left(t\_1 \leq 5 \cdot 10^{+293}\right):\\
\;\;\;\;y \cdot \frac{a}{z}\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if (/.f64 (-.f64 y z) (/.f64 (+.f64 (-.f64 t z) #s(literal 1 binary64)) a)) < -inf.0 or 5.00000000000000033e293 < (/.f64 (-.f64 y z) (/.f64 (+.f64 (-.f64 t z) #s(literal 1 binary64)) a)) Initial program 99.9%
Taylor expanded in y around inf
mul-1-negN/A
*-commutativeN/A
associate-*r/N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f6495.5
Applied rewrites95.5%
Taylor expanded in z around inf
Applied rewrites60.2%
Applied rewrites68.2%
if -inf.0 < (/.f64 (-.f64 y z) (/.f64 (+.f64 (-.f64 t z) #s(literal 1 binary64)) a)) < 5.00000000000000033e293Initial program 95.6%
Taylor expanded in z around inf
lower--.f6461.8
Applied rewrites61.8%
Final simplification62.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- y z) (/ (+ (- t z) 1.0) a))))
(if (<= t_1 (- INFINITY))
(* y (/ a z))
(if (<= t_1 5e+293) (- x a) (* (/ y z) a)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y - z) / (((t - z) + 1.0) / a);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = y * (a / z);
} else if (t_1 <= 5e+293) {
tmp = x - a;
} else {
tmp = (y / z) * a;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (y - z) / (((t - z) + 1.0) / a);
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = y * (a / z);
} else if (t_1 <= 5e+293) {
tmp = x - a;
} else {
tmp = (y / z) * a;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y - z) / (((t - z) + 1.0) / a) tmp = 0 if t_1 <= -math.inf: tmp = y * (a / z) elif t_1 <= 5e+293: tmp = x - a else: tmp = (y / z) * a return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y - z) / Float64(Float64(Float64(t - z) + 1.0) / a)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(y * Float64(a / z)); elseif (t_1 <= 5e+293) tmp = Float64(x - a); else tmp = Float64(Float64(y / z) * a); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y - z) / (((t - z) + 1.0) / a); tmp = 0.0; if (t_1 <= -Inf) tmp = y * (a / z); elseif (t_1 <= 5e+293) tmp = x - a; else tmp = (y / z) * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] / N[(N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(y * N[(a / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+293], N[(x - a), $MachinePrecision], N[(N[(y / z), $MachinePrecision] * a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y - z}{\frac{\left(t - z\right) + 1}{a}}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;y \cdot \frac{a}{z}\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+293}:\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z} \cdot a\\
\end{array}
\end{array}
if (/.f64 (-.f64 y z) (/.f64 (+.f64 (-.f64 t z) #s(literal 1 binary64)) a)) < -inf.0Initial program 100.0%
Taylor expanded in y around inf
mul-1-negN/A
*-commutativeN/A
associate-*r/N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f64100.0
Applied rewrites100.0%
Taylor expanded in z around inf
Applied rewrites71.4%
Applied rewrites71.4%
if -inf.0 < (/.f64 (-.f64 y z) (/.f64 (+.f64 (-.f64 t z) #s(literal 1 binary64)) a)) < 5.00000000000000033e293Initial program 95.6%
Taylor expanded in z around inf
lower--.f6461.8
Applied rewrites61.8%
if 5.00000000000000033e293 < (/.f64 (-.f64 y z) (/.f64 (+.f64 (-.f64 t z) #s(literal 1 binary64)) a)) Initial program 99.9%
Taylor expanded in y around inf
mul-1-negN/A
*-commutativeN/A
associate-*r/N/A
distribute-lft-neg-inN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-+.f6493.4
Applied rewrites93.4%
Taylor expanded in z around inf
Applied rewrites54.9%
Applied rewrites66.7%
Final simplification62.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -8.8e+139) (not (<= z 1.1e+177))) (- x (fma a (/ (- (+ 1.0 t) y) z) a)) (- x (/ (* (- y z) a) (+ 1.0 (- t z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -8.8e+139) || !(z <= 1.1e+177)) {
tmp = x - fma(a, (((1.0 + t) - y) / z), a);
} else {
tmp = x - (((y - z) * a) / (1.0 + (t - z)));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -8.8e+139) || !(z <= 1.1e+177)) tmp = Float64(x - fma(a, Float64(Float64(Float64(1.0 + t) - y) / z), a)); else tmp = Float64(x - Float64(Float64(Float64(y - z) * a) / Float64(1.0 + Float64(t - z)))); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -8.8e+139], N[Not[LessEqual[z, 1.1e+177]], $MachinePrecision]], N[(x - N[(a * N[(N[(N[(1.0 + t), $MachinePrecision] - y), $MachinePrecision] / z), $MachinePrecision] + a), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(N[(y - z), $MachinePrecision] * a), $MachinePrecision] / N[(1.0 + N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.8 \cdot 10^{+139} \lor \neg \left(z \leq 1.1 \cdot 10^{+177}\right):\\
\;\;\;\;x - \mathsf{fma}\left(a, \frac{\left(1 + t\right) - y}{z}, a\right)\\
\mathbf{else}:\\
\;\;\;\;x - \frac{\left(y - z\right) \cdot a}{1 + \left(t - z\right)}\\
\end{array}
\end{array}
if z < -8.7999999999999998e139 or 1.0999999999999999e177 < z Initial program 90.6%
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6463.0
lift-+.f64N/A
+-commutativeN/A
lower-+.f6463.0
Applied rewrites63.0%
Taylor expanded in z around inf
associate--l+N/A
distribute-lft-out--N/A
div-subN/A
+-commutativeN/A
associate-*r/N/A
distribute-lft-out--N/A
associate-*r*N/A
mul-1-negN/A
cancel-sign-subN/A
+-commutativeN/A
mul-1-negN/A
sub-negN/A
distribute-lft-out--N/A
associate-/l*N/A
Applied rewrites94.5%
if -8.7999999999999998e139 < z < 1.0999999999999999e177Initial program 98.2%
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6493.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6493.8
Applied rewrites93.8%
Final simplification94.0%
(FPCore (x y z t a)
:precision binary64
(if (<= z -1.35e+177)
(- x a)
(if (<= z 0.00205)
(fma (- a) (/ y (+ 1.0 t)) x)
(if (<= z 4.65e+142) (- x (* a (/ y (- 1.0 z)))) (- x a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.35e+177) {
tmp = x - a;
} else if (z <= 0.00205) {
tmp = fma(-a, (y / (1.0 + t)), x);
} else if (z <= 4.65e+142) {
tmp = x - (a * (y / (1.0 - z)));
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.35e+177) tmp = Float64(x - a); elseif (z <= 0.00205) tmp = fma(Float64(-a), Float64(y / Float64(1.0 + t)), x); elseif (z <= 4.65e+142) tmp = Float64(x - Float64(a * Float64(y / Float64(1.0 - z)))); else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.35e+177], N[(x - a), $MachinePrecision], If[LessEqual[z, 0.00205], N[((-a) * N[(y / N[(1.0 + t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 4.65e+142], N[(x - N[(a * N[(y / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.35 \cdot 10^{+177}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 0.00205:\\
\;\;\;\;\mathsf{fma}\left(-a, \frac{y}{1 + t}, x\right)\\
\mathbf{elif}\;z \leq 4.65 \cdot 10^{+142}:\\
\;\;\;\;x - a \cdot \frac{y}{1 - z}\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -1.34999999999999995e177 or 4.6499999999999999e142 < z Initial program 89.2%
Taylor expanded in z around inf
lower--.f6483.7
Applied rewrites83.7%
if -1.34999999999999995e177 < z < 0.00205000000000000017Initial program 99.3%
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6494.2
lift-+.f64N/A
+-commutativeN/A
lower-+.f6494.2
Applied rewrites94.2%
Taylor expanded in z around 0
sub-negN/A
+-commutativeN/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-+.f6489.0
Applied rewrites89.0%
if 0.00205000000000000017 < z < 4.6499999999999999e142Initial program 96.5%
Taylor expanded in t around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6474.4
Applied rewrites74.4%
Taylor expanded in y around inf
Applied rewrites80.9%
Final simplification86.9%
(FPCore (x y z t a)
:precision binary64
(if (<= z -0.00052)
(- x a)
(if (<= z 3.7e-42)
(- x (* (- y z) (fma z a a)))
(if (<= z 2.1e+139) (fma (/ z (+ 1.0 t)) a x) (- x a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -0.00052) {
tmp = x - a;
} else if (z <= 3.7e-42) {
tmp = x - ((y - z) * fma(z, a, a));
} else if (z <= 2.1e+139) {
tmp = fma((z / (1.0 + t)), a, x);
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -0.00052) tmp = Float64(x - a); elseif (z <= 3.7e-42) tmp = Float64(x - Float64(Float64(y - z) * fma(z, a, a))); elseif (z <= 2.1e+139) tmp = fma(Float64(z / Float64(1.0 + t)), a, x); else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -0.00052], N[(x - a), $MachinePrecision], If[LessEqual[z, 3.7e-42], N[(x - N[(N[(y - z), $MachinePrecision] * N[(z * a + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.1e+139], N[(N[(z / N[(1.0 + t), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision], N[(x - a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.00052:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 3.7 \cdot 10^{-42}:\\
\;\;\;\;x - \left(y - z\right) \cdot \mathsf{fma}\left(z, a, a\right)\\
\mathbf{elif}\;z \leq 2.1 \cdot 10^{+139}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{1 + t}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -5.19999999999999954e-4 or 2.0999999999999999e139 < z Initial program 92.2%
Taylor expanded in z around inf
lower--.f6476.0
Applied rewrites76.0%
if -5.19999999999999954e-4 < z < 3.7000000000000002e-42Initial program 99.1%
Taylor expanded in t around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6481.4
Applied rewrites81.4%
Taylor expanded in z around 0
Applied rewrites81.4%
if 3.7000000000000002e-42 < z < 2.0999999999999999e139Initial program 97.6%
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
lower-+.f6474.3
Applied rewrites74.3%
Taylor expanded in z around 0
Applied rewrites79.0%
Final simplification78.9%
(FPCore (x y z t a)
:precision binary64
(if (<= t -4350000000000.0)
(fma (/ z (- (+ 1.0 t) z)) a x)
(if (<= t 1.1e+144)
(- x (* (- y z) (/ a (- 1.0 z))))
(fma (- a) (/ (- y z) t) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -4350000000000.0) {
tmp = fma((z / ((1.0 + t) - z)), a, x);
} else if (t <= 1.1e+144) {
tmp = x - ((y - z) * (a / (1.0 - z)));
} else {
tmp = fma(-a, ((y - z) / t), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -4350000000000.0) tmp = fma(Float64(z / Float64(Float64(1.0 + t) - z)), a, x); elseif (t <= 1.1e+144) tmp = Float64(x - Float64(Float64(y - z) * Float64(a / Float64(1.0 - z)))); else tmp = fma(Float64(-a), Float64(Float64(y - z) / t), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -4350000000000.0], N[(N[(z / N[(N[(1.0 + t), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision], If[LessEqual[t, 1.1e+144], N[(x - N[(N[(y - z), $MachinePrecision] * N[(a / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-a) * N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4350000000000:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{\left(1 + t\right) - z}, a, x\right)\\
\mathbf{elif}\;t \leq 1.1 \cdot 10^{+144}:\\
\;\;\;\;x - \left(y - z\right) \cdot \frac{a}{1 - z}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-a, \frac{y - z}{t}, x\right)\\
\end{array}
\end{array}
if t < -4.35e12Initial program 94.7%
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
lower-+.f6484.3
Applied rewrites84.3%
if -4.35e12 < t < 1.09999999999999994e144Initial program 97.2%
Taylor expanded in t around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6494.4
Applied rewrites94.4%
if 1.09999999999999994e144 < t Initial program 92.5%
Taylor expanded in t around inf
mul-1-negN/A
+-commutativeN/A
associate-/l*N/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
lower-neg.f64N/A
lower-/.f64N/A
lower--.f6494.8
Applied rewrites94.8%
Final simplification92.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -4.7e+55) (not (<= z 2.8e-34))) (fma (/ z (- (+ 1.0 t) z)) a x) (fma (- a) (/ y (+ 1.0 t)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -4.7e+55) || !(z <= 2.8e-34)) {
tmp = fma((z / ((1.0 + t) - z)), a, x);
} else {
tmp = fma(-a, (y / (1.0 + t)), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -4.7e+55) || !(z <= 2.8e-34)) tmp = fma(Float64(z / Float64(Float64(1.0 + t) - z)), a, x); else tmp = fma(Float64(-a), Float64(y / Float64(1.0 + t)), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -4.7e+55], N[Not[LessEqual[z, 2.8e-34]], $MachinePrecision]], N[(N[(z / N[(N[(1.0 + t), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision], N[((-a) * N[(y / N[(1.0 + t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.7 \cdot 10^{+55} \lor \neg \left(z \leq 2.8 \cdot 10^{-34}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{\left(1 + t\right) - z}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-a, \frac{y}{1 + t}, x\right)\\
\end{array}
\end{array}
if z < -4.7000000000000001e55 or 2.79999999999999997e-34 < z Initial program 92.6%
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
lower-+.f6484.2
Applied rewrites84.2%
if -4.7000000000000001e55 < z < 2.79999999999999997e-34Initial program 99.1%
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6497.1
lift-+.f64N/A
+-commutativeN/A
lower-+.f6497.1
Applied rewrites97.1%
Taylor expanded in z around 0
sub-negN/A
+-commutativeN/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-+.f6492.3
Applied rewrites92.3%
Final simplification88.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -4.7e+55) (not (<= z 2.8e-34))) (fma (/ a (- (+ t 1.0) z)) z x) (fma (- a) (/ y (+ 1.0 t)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -4.7e+55) || !(z <= 2.8e-34)) {
tmp = fma((a / ((t + 1.0) - z)), z, x);
} else {
tmp = fma(-a, (y / (1.0 + t)), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -4.7e+55) || !(z <= 2.8e-34)) tmp = fma(Float64(a / Float64(Float64(t + 1.0) - z)), z, x); else tmp = fma(Float64(-a), Float64(y / Float64(1.0 + t)), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -4.7e+55], N[Not[LessEqual[z, 2.8e-34]], $MachinePrecision]], N[(N[(a / N[(N[(t + 1.0), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] * z + x), $MachinePrecision], N[((-a) * N[(y / N[(1.0 + t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.7 \cdot 10^{+55} \lor \neg \left(z \leq 2.8 \cdot 10^{-34}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{a}{\left(t + 1\right) - z}, z, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-a, \frac{y}{1 + t}, x\right)\\
\end{array}
\end{array}
if z < -4.7000000000000001e55 or 2.79999999999999997e-34 < z Initial program 92.6%
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
lower-+.f6484.2
Applied rewrites84.2%
Applied rewrites78.9%
if -4.7000000000000001e55 < z < 2.79999999999999997e-34Initial program 99.1%
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6497.1
lift-+.f64N/A
+-commutativeN/A
lower-+.f6497.1
Applied rewrites97.1%
Taylor expanded in z around 0
sub-negN/A
+-commutativeN/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-+.f6492.3
Applied rewrites92.3%
Final simplification85.9%
(FPCore (x y z t a)
:precision binary64
(if (<= z -0.00052)
(- x a)
(if (<= z 7.2e-21)
(- x (* (- y z) (fma z a a)))
(if (<= z 2.1e+139) (fma (/ z t) a x) (- x a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -0.00052) {
tmp = x - a;
} else if (z <= 7.2e-21) {
tmp = x - ((y - z) * fma(z, a, a));
} else if (z <= 2.1e+139) {
tmp = fma((z / t), a, x);
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -0.00052) tmp = Float64(x - a); elseif (z <= 7.2e-21) tmp = Float64(x - Float64(Float64(y - z) * fma(z, a, a))); elseif (z <= 2.1e+139) tmp = fma(Float64(z / t), a, x); else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -0.00052], N[(x - a), $MachinePrecision], If[LessEqual[z, 7.2e-21], N[(x - N[(N[(y - z), $MachinePrecision] * N[(z * a + a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.1e+139], N[(N[(z / t), $MachinePrecision] * a + x), $MachinePrecision], N[(x - a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.00052:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 7.2 \cdot 10^{-21}:\\
\;\;\;\;x - \left(y - z\right) \cdot \mathsf{fma}\left(z, a, a\right)\\
\mathbf{elif}\;z \leq 2.1 \cdot 10^{+139}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{t}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -5.19999999999999954e-4 or 2.0999999999999999e139 < z Initial program 92.2%
Taylor expanded in z around inf
lower--.f6476.0
Applied rewrites76.0%
if -5.19999999999999954e-4 < z < 7.19999999999999979e-21Initial program 99.1%
Taylor expanded in t around 0
*-commutativeN/A
associate-/l*N/A
lower-*.f64N/A
lower--.f64N/A
lower-/.f64N/A
lower--.f6481.0
Applied rewrites81.0%
Taylor expanded in z around 0
Applied rewrites81.0%
if 7.19999999999999979e-21 < z < 2.0999999999999999e139Initial program 97.4%
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
lower-+.f6473.1
Applied rewrites73.1%
Taylor expanded in t around inf
Applied rewrites78.0%
Final simplification78.6%
(FPCore (x y z t a)
:precision binary64
(if (<= z -680000.0)
(- x a)
(if (<= z 8e-26)
(- x (* (fma (- y) t y) a))
(if (<= z 2.1e+139) (fma (/ z t) a x) (- x a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -680000.0) {
tmp = x - a;
} else if (z <= 8e-26) {
tmp = x - (fma(-y, t, y) * a);
} else if (z <= 2.1e+139) {
tmp = fma((z / t), a, x);
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -680000.0) tmp = Float64(x - a); elseif (z <= 8e-26) tmp = Float64(x - Float64(fma(Float64(-y), t, y) * a)); elseif (z <= 2.1e+139) tmp = fma(Float64(z / t), a, x); else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -680000.0], N[(x - a), $MachinePrecision], If[LessEqual[z, 8e-26], N[(x - N[(N[((-y) * t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.1e+139], N[(N[(z / t), $MachinePrecision] * a + x), $MachinePrecision], N[(x - a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -680000:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 8 \cdot 10^{-26}:\\
\;\;\;\;x - \mathsf{fma}\left(-y, t, y\right) \cdot a\\
\mathbf{elif}\;z \leq 2.1 \cdot 10^{+139}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{t}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -6.8e5 or 2.0999999999999999e139 < z Initial program 92.0%
Taylor expanded in z around inf
lower--.f6477.4
Applied rewrites77.4%
if -6.8e5 < z < 8.0000000000000003e-26Initial program 99.1%
Taylor expanded in z around 0
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6494.2
Applied rewrites94.2%
Taylor expanded in t around 0
Applied rewrites68.7%
if 8.0000000000000003e-26 < z < 2.0999999999999999e139Initial program 97.4%
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
lower-+.f6473.1
Applied rewrites73.1%
Taylor expanded in t around inf
Applied rewrites78.0%
Final simplification73.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.35e+177) (not (<= z 2.1e+139))) (- x a) (fma (- a) (/ y (+ 1.0 t)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.35e+177) || !(z <= 2.1e+139)) {
tmp = x - a;
} else {
tmp = fma(-a, (y / (1.0 + t)), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.35e+177) || !(z <= 2.1e+139)) tmp = Float64(x - a); else tmp = fma(Float64(-a), Float64(y / Float64(1.0 + t)), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.35e+177], N[Not[LessEqual[z, 2.1e+139]], $MachinePrecision]], N[(x - a), $MachinePrecision], N[((-a) * N[(y / N[(1.0 + t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.35 \cdot 10^{+177} \lor \neg \left(z \leq 2.1 \cdot 10^{+139}\right):\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-a, \frac{y}{1 + t}, x\right)\\
\end{array}
\end{array}
if z < -1.34999999999999995e177 or 2.0999999999999999e139 < z Initial program 89.3%
Taylor expanded in z around inf
lower--.f6482.8
Applied rewrites82.8%
if -1.34999999999999995e177 < z < 2.0999999999999999e139Initial program 99.0%
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6493.1
lift-+.f64N/A
+-commutativeN/A
lower-+.f6493.1
Applied rewrites93.1%
Taylor expanded in z around 0
sub-negN/A
+-commutativeN/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-+.f6486.0
Applied rewrites86.0%
Final simplification85.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -680000.0) (not (<= z 1.5e-19))) (- x a) (- x (* (fma (- y) t y) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -680000.0) || !(z <= 1.5e-19)) {
tmp = x - a;
} else {
tmp = x - (fma(-y, t, y) * a);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -680000.0) || !(z <= 1.5e-19)) tmp = Float64(x - a); else tmp = Float64(x - Float64(fma(Float64(-y), t, y) * a)); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -680000.0], N[Not[LessEqual[z, 1.5e-19]], $MachinePrecision]], N[(x - a), $MachinePrecision], N[(x - N[(N[((-y) * t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -680000 \lor \neg \left(z \leq 1.5 \cdot 10^{-19}\right):\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;x - \mathsf{fma}\left(-y, t, y\right) \cdot a\\
\end{array}
\end{array}
if z < -6.8e5 or 1.49999999999999996e-19 < z Initial program 92.8%
Taylor expanded in z around inf
lower--.f6471.0
Applied rewrites71.0%
if -6.8e5 < z < 1.49999999999999996e-19Initial program 99.1%
Taylor expanded in z around 0
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6494.2
Applied rewrites94.2%
Taylor expanded in t around 0
Applied rewrites68.7%
Final simplification69.8%
(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.0%
Taylor expanded in z around inf
lower--.f6457.2
Applied rewrites57.2%
Final simplification57.2%
(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.0%
Taylor expanded in z around inf
lower--.f6457.2
Applied rewrites57.2%
Taylor expanded in x around 0
Applied rewrites18.3%
Final simplification18.3%
(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 2024318
(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))))