
(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 16 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 (/ (- y z) (- -1.0 (- t z))) a x))
double code(double x, double y, double z, double t, double a) {
return fma(((y - z) / (-1.0 - (t - z))), a, x);
}
function code(x, y, z, t, a) return fma(Float64(Float64(y - z) / Float64(-1.0 - Float64(t - z))), a, x) end
code[x_, y_, z_, t_, a_] := N[(N[(N[(y - z), $MachinePrecision] / N[(-1.0 - N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{y - z}{-1 - \left(t - z\right)}, a, x\right)
\end{array}
Initial program 96.6%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
frac-2negN/A
associate-/r/N/A
distribute-rgt-neg-inN/A
remove-double-negN/A
lower-fma.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
distribute-neg-inN/A
metadata-evalN/A
unsub-negN/A
lower--.f6499.9
Applied rewrites99.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- x (* (/ y t) a))))
(if (<= t -5.4e+143)
t_1
(if (<= t 4.2e-200)
(fma (/ z (- 1.0 z)) a x)
(if (<= t 1.0) (- x (* a y)) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x - ((y / t) * a);
double tmp;
if (t <= -5.4e+143) {
tmp = t_1;
} else if (t <= 4.2e-200) {
tmp = fma((z / (1.0 - z)), a, x);
} else if (t <= 1.0) {
tmp = x - (a * y);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(x - Float64(Float64(y / t) * a)) tmp = 0.0 if (t <= -5.4e+143) tmp = t_1; elseif (t <= 4.2e-200) tmp = fma(Float64(z / Float64(1.0 - z)), a, x); elseif (t <= 1.0) tmp = Float64(x - Float64(a * y)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x - N[(N[(y / t), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -5.4e+143], t$95$1, If[LessEqual[t, 4.2e-200], N[(N[(z / N[(1.0 - z), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision], If[LessEqual[t, 1.0], N[(x - N[(a * y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - \frac{y}{t} \cdot a\\
\mathbf{if}\;t \leq -5.4 \cdot 10^{+143}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 4.2 \cdot 10^{-200}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{1 - z}, a, x\right)\\
\mathbf{elif}\;t \leq 1:\\
\;\;\;\;x - a \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -5.4000000000000003e143 or 1 < t Initial program 94.7%
Taylor expanded in z around 0
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6484.2
Applied rewrites84.2%
Taylor expanded in t around inf
Applied rewrites84.2%
if -5.4000000000000003e143 < t < 4.1999999999999998e-200Initial program 98.1%
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-+.f6481.0
Applied rewrites81.0%
Taylor expanded in t around 0
Applied rewrites76.8%
if 4.1999999999999998e-200 < t < 1Initial program 97.7%
Taylor expanded in z around 0
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6480.7
Applied rewrites80.7%
Taylor expanded in t around 0
Applied rewrites80.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -3.2e+67) (not (<= t 9.5e+69))) (fma (- a) (/ (- y z) t) x) (fma (/ (- y z) (- z 1.0)) a x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -3.2e+67) || !(t <= 9.5e+69)) {
tmp = fma(-a, ((y - z) / t), x);
} else {
tmp = fma(((y - z) / (z - 1.0)), a, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -3.2e+67) || !(t <= 9.5e+69)) tmp = fma(Float64(-a), Float64(Float64(y - z) / t), x); else tmp = fma(Float64(Float64(y - z) / Float64(z - 1.0)), a, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -3.2e+67], N[Not[LessEqual[t, 9.5e+69]], $MachinePrecision]], N[((-a) * N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision] + x), $MachinePrecision], N[(N[(N[(y - z), $MachinePrecision] / N[(z - 1.0), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.2 \cdot 10^{+67} \lor \neg \left(t \leq 9.5 \cdot 10^{+69}\right):\\
\;\;\;\;\mathsf{fma}\left(-a, \frac{y - z}{t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y - z}{z - 1}, a, x\right)\\
\end{array}
\end{array}
if t < -3.19999999999999983e67 or 9.4999999999999995e69 < t Initial program 94.1%
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--.f6489.4
Applied rewrites89.4%
if -3.19999999999999983e67 < t < 9.4999999999999995e69Initial program 98.6%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
frac-2negN/A
associate-/r/N/A
distribute-rgt-neg-inN/A
remove-double-negN/A
lower-fma.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
distribute-neg-inN/A
metadata-evalN/A
unsub-negN/A
lower--.f64100.0
Applied rewrites100.0%
Taylor expanded in t around 0
lower--.f6497.5
Applied rewrites97.5%
Final simplification93.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -7e+66) (not (<= t 9.5e+69))) (fma (- a) (/ (- y z) t) x) (fma (- y z) (/ a (- z 1.0)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -7e+66) || !(t <= 9.5e+69)) {
tmp = fma(-a, ((y - z) / t), x);
} else {
tmp = fma((y - z), (a / (z - 1.0)), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -7e+66) || !(t <= 9.5e+69)) tmp = fma(Float64(-a), Float64(Float64(y - z) / t), x); else tmp = fma(Float64(y - z), Float64(a / Float64(z - 1.0)), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -7e+66], N[Not[LessEqual[t, 9.5e+69]], $MachinePrecision]], N[((-a) * N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision] + x), $MachinePrecision], N[(N[(y - z), $MachinePrecision] * N[(a / N[(z - 1.0), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7 \cdot 10^{+66} \lor \neg \left(t \leq 9.5 \cdot 10^{+69}\right):\\
\;\;\;\;\mathsf{fma}\left(-a, \frac{y - z}{t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y - z, \frac{a}{z - 1}, x\right)\\
\end{array}
\end{array}
if t < -6.9999999999999994e66 or 9.4999999999999995e69 < t Initial program 94.1%
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--.f6489.4
Applied rewrites89.4%
if -6.9999999999999994e66 < t < 9.4999999999999995e69Initial program 98.6%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
frac-2negN/A
associate-/r/N/A
distribute-rgt-neg-inN/A
remove-double-negN/A
lower-fma.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
distribute-neg-inN/A
metadata-evalN/A
unsub-negN/A
lower--.f64100.0
Applied rewrites100.0%
Taylor expanded in t around 0
lower--.f6497.5
Applied rewrites97.5%
lift-fma.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6496.1
Applied rewrites96.1%
Final simplification93.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.65e+45) (not (<= z 6e-161))) (fma (/ z (- (+ 1.0 t) z)) a x) (fma (/ y (- -1.0 t)) a x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.65e+45) || !(z <= 6e-161)) {
tmp = fma((z / ((1.0 + t) - z)), a, x);
} else {
tmp = fma((y / (-1.0 - t)), a, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.65e+45) || !(z <= 6e-161)) tmp = fma(Float64(z / Float64(Float64(1.0 + t) - z)), a, x); else tmp = fma(Float64(y / Float64(-1.0 - t)), a, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.65e+45], N[Not[LessEqual[z, 6e-161]], $MachinePrecision]], N[(N[(z / N[(N[(1.0 + t), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision], N[(N[(y / N[(-1.0 - t), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.65 \cdot 10^{+45} \lor \neg \left(z \leq 6 \cdot 10^{-161}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{\left(1 + t\right) - z}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{-1 - t}, a, x\right)\\
\end{array}
\end{array}
if z < -1.65e45 or 5.99999999999999977e-161 < z Initial program 96.0%
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-+.f6486.4
Applied rewrites86.4%
if -1.65e45 < z < 5.99999999999999977e-161Initial program 97.3%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
frac-2negN/A
associate-/r/N/A
distribute-rgt-neg-inN/A
remove-double-negN/A
lower-fma.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
distribute-neg-inN/A
metadata-evalN/A
unsub-negN/A
lower--.f64100.0
Applied rewrites100.0%
Taylor expanded in z around 0
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
distribute-lft-inN/A
metadata-evalN/A
mul-1-negN/A
unsub-negN/A
lower--.f6493.0
Applied rewrites93.0%
Final simplification89.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.65e+45) (not (<= z 6e-161))) (fma z (/ a (- (+ 1.0 t) z)) x) (fma (/ y (- -1.0 t)) a x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.65e+45) || !(z <= 6e-161)) {
tmp = fma(z, (a / ((1.0 + t) - z)), x);
} else {
tmp = fma((y / (-1.0 - t)), a, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.65e+45) || !(z <= 6e-161)) tmp = fma(z, Float64(a / Float64(Float64(1.0 + t) - z)), x); else tmp = fma(Float64(y / Float64(-1.0 - t)), a, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.65e+45], N[Not[LessEqual[z, 6e-161]], $MachinePrecision]], N[(z * N[(a / N[(N[(1.0 + t), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(N[(y / N[(-1.0 - t), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.65 \cdot 10^{+45} \lor \neg \left(z \leq 6 \cdot 10^{-161}\right):\\
\;\;\;\;\mathsf{fma}\left(z, \frac{a}{\left(1 + t\right) - z}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{-1 - t}, a, x\right)\\
\end{array}
\end{array}
if z < -1.65e45 or 5.99999999999999977e-161 < z Initial program 96.0%
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-+.f6486.4
Applied rewrites86.4%
Applied rewrites83.7%
if -1.65e45 < z < 5.99999999999999977e-161Initial program 97.3%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
frac-2negN/A
associate-/r/N/A
distribute-rgt-neg-inN/A
remove-double-negN/A
lower-fma.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
distribute-neg-inN/A
metadata-evalN/A
unsub-negN/A
lower--.f64100.0
Applied rewrites100.0%
Taylor expanded in z around 0
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
distribute-lft-inN/A
metadata-evalN/A
mul-1-negN/A
unsub-negN/A
lower--.f6493.0
Applied rewrites93.0%
Final simplification87.6%
(FPCore (x y z t a)
:precision binary64
(if (<= z -1.8e-33)
(- x a)
(if (<= z 5.5e-162)
(fma (- a) (fma (- y 1.0) z y) x)
(if (<= z 6.2e+61) (fma (/ z t) a x) (- x a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.8e-33) {
tmp = x - a;
} else if (z <= 5.5e-162) {
tmp = fma(-a, fma((y - 1.0), z, y), x);
} else if (z <= 6.2e+61) {
tmp = fma((z / t), a, x);
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.8e-33) tmp = Float64(x - a); elseif (z <= 5.5e-162) tmp = fma(Float64(-a), fma(Float64(y - 1.0), z, y), x); elseif (z <= 6.2e+61) 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, -1.8e-33], N[(x - a), $MachinePrecision], If[LessEqual[z, 5.5e-162], N[((-a) * N[(N[(y - 1.0), $MachinePrecision] * z + y), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 6.2e+61], N[(N[(z / t), $MachinePrecision] * a + x), $MachinePrecision], N[(x - a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.8 \cdot 10^{-33}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 5.5 \cdot 10^{-162}:\\
\;\;\;\;\mathsf{fma}\left(-a, \mathsf{fma}\left(y - 1, z, y\right), x\right)\\
\mathbf{elif}\;z \leq 6.2 \cdot 10^{+61}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{t}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -1.80000000000000017e-33 or 6.1999999999999998e61 < z Initial program 96.0%
Taylor expanded in z around inf
lower--.f6479.2
Applied rewrites79.2%
if -1.80000000000000017e-33 < z < 5.50000000000000006e-162Initial program 96.8%
Taylor expanded in t around 0
sub-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--.f64N/A
lower--.f6470.2
Applied rewrites70.2%
Taylor expanded in z around 0
Applied rewrites70.2%
if 5.50000000000000006e-162 < z < 6.1999999999999998e61Initial program 97.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.8
Applied rewrites84.8%
Taylor expanded in t around inf
Applied rewrites73.3%
(FPCore (x y z t a)
:precision binary64
(if (<= z -170000.0)
(- x a)
(if (<= z 4.5e-162)
(- x (* a y))
(if (<= z 6.2e+61) (fma (/ z t) a x) (- x a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -170000.0) {
tmp = x - a;
} else if (z <= 4.5e-162) {
tmp = x - (a * y);
} else if (z <= 6.2e+61) {
tmp = fma((z / t), a, x);
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -170000.0) tmp = Float64(x - a); elseif (z <= 4.5e-162) tmp = Float64(x - Float64(a * y)); elseif (z <= 6.2e+61) 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, -170000.0], N[(x - a), $MachinePrecision], If[LessEqual[z, 4.5e-162], N[(x - N[(a * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.2e+61], N[(N[(z / t), $MachinePrecision] * a + x), $MachinePrecision], N[(x - a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -170000:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 4.5 \cdot 10^{-162}:\\
\;\;\;\;x - a \cdot y\\
\mathbf{elif}\;z \leq 6.2 \cdot 10^{+61}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{t}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -1.7e5 or 6.1999999999999998e61 < z Initial program 95.6%
Taylor expanded in z around inf
lower--.f6479.5
Applied rewrites79.5%
if -1.7e5 < z < 4.50000000000000023e-162Initial program 97.1%
Taylor expanded in z around 0
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6494.3
Applied rewrites94.3%
Taylor expanded in t around 0
Applied rewrites68.9%
if 4.50000000000000023e-162 < z < 6.1999999999999998e61Initial program 97.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.8
Applied rewrites84.8%
Taylor expanded in t around inf
Applied rewrites73.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -1.65e+26) (not (<= t 8.2e+69))) (fma (- a) (/ (- y z) t) x) (fma (- a) (/ y (- 1.0 z)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -1.65e+26) || !(t <= 8.2e+69)) {
tmp = fma(-a, ((y - z) / t), x);
} else {
tmp = fma(-a, (y / (1.0 - z)), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -1.65e+26) || !(t <= 8.2e+69)) tmp = fma(Float64(-a), Float64(Float64(y - z) / t), x); else tmp = fma(Float64(-a), Float64(y / Float64(1.0 - z)), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -1.65e+26], N[Not[LessEqual[t, 8.2e+69]], $MachinePrecision]], N[((-a) * N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision] + x), $MachinePrecision], N[((-a) * N[(y / N[(1.0 - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.65 \cdot 10^{+26} \lor \neg \left(t \leq 8.2 \cdot 10^{+69}\right):\\
\;\;\;\;\mathsf{fma}\left(-a, \frac{y - z}{t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-a, \frac{y}{1 - z}, x\right)\\
\end{array}
\end{array}
if t < -1.64999999999999997e26 or 8.1999999999999998e69 < t Initial program 94.4%
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--.f6488.8
Applied rewrites88.8%
if -1.64999999999999997e26 < t < 8.1999999999999998e69Initial program 98.5%
Taylor expanded in t around 0
sub-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--.f64N/A
lower--.f6498.4
Applied rewrites98.4%
Taylor expanded in y around inf
Applied rewrites82.6%
Final simplification85.6%
(FPCore (x y z t a)
:precision binary64
(if (<= z -170000.0)
(- x a)
(if (<= z 4.5e-162)
(- x (* a y))
(if (<= z 8e-5) (fma (- a) (fma z y (- z)) x) (- x a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -170000.0) {
tmp = x - a;
} else if (z <= 4.5e-162) {
tmp = x - (a * y);
} else if (z <= 8e-5) {
tmp = fma(-a, fma(z, y, -z), x);
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -170000.0) tmp = Float64(x - a); elseif (z <= 4.5e-162) tmp = Float64(x - Float64(a * y)); elseif (z <= 8e-5) tmp = fma(Float64(-a), fma(z, y, Float64(-z)), x); else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -170000.0], N[(x - a), $MachinePrecision], If[LessEqual[z, 4.5e-162], N[(x - N[(a * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8e-5], N[((-a) * N[(z * y + (-z)), $MachinePrecision] + x), $MachinePrecision], N[(x - a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -170000:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 4.5 \cdot 10^{-162}:\\
\;\;\;\;x - a \cdot y\\
\mathbf{elif}\;z \leq 8 \cdot 10^{-5}:\\
\;\;\;\;\mathsf{fma}\left(-a, \mathsf{fma}\left(z, y, -z\right), x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -1.7e5 or 8.00000000000000065e-5 < z Initial program 95.4%
Taylor expanded in z around inf
lower--.f6475.9
Applied rewrites75.9%
if -1.7e5 < z < 4.50000000000000023e-162Initial program 97.1%
Taylor expanded in z around 0
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6494.3
Applied rewrites94.3%
Taylor expanded in t around 0
Applied rewrites68.9%
if 4.50000000000000023e-162 < z < 8.00000000000000065e-5Initial program 99.9%
Taylor expanded in t around 0
sub-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--.f64N/A
lower--.f6471.1
Applied rewrites71.1%
Taylor expanded in z around 0
Applied rewrites70.6%
Taylor expanded in z around inf
Applied rewrites81.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -740.0) (not (<= t 0.84))) (- x (* (/ y t) a)) (- x (* (fma (- t) y y) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -740.0) || !(t <= 0.84)) {
tmp = x - ((y / t) * a);
} else {
tmp = x - (fma(-t, y, y) * a);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -740.0) || !(t <= 0.84)) tmp = Float64(x - Float64(Float64(y / t) * a)); else tmp = Float64(x - Float64(fma(Float64(-t), y, y) * a)); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -740.0], N[Not[LessEqual[t, 0.84]], $MachinePrecision]], N[(x - N[(N[(y / t), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[((-t) * y + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -740 \lor \neg \left(t \leq 0.84\right):\\
\;\;\;\;x - \frac{y}{t} \cdot a\\
\mathbf{else}:\\
\;\;\;\;x - \mathsf{fma}\left(-t, y, y\right) \cdot a\\
\end{array}
\end{array}
if t < -740 or 0.839999999999999969 < t Initial program 95.0%
Taylor expanded in z around 0
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6481.9
Applied rewrites81.9%
Taylor expanded in t around inf
Applied rewrites81.9%
if -740 < t < 0.839999999999999969Initial program 98.3%
Taylor expanded in z around 0
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6473.4
Applied rewrites73.4%
Taylor expanded in t around 0
Applied rewrites73.0%
Final simplification77.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -740.0) (not (<= t 0.84))) (- x (* y (/ a t))) (- x (* (fma (- t) y y) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -740.0) || !(t <= 0.84)) {
tmp = x - (y * (a / t));
} else {
tmp = x - (fma(-t, y, y) * a);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -740.0) || !(t <= 0.84)) tmp = Float64(x - Float64(y * Float64(a / t))); else tmp = Float64(x - Float64(fma(Float64(-t), y, y) * a)); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -740.0], N[Not[LessEqual[t, 0.84]], $MachinePrecision]], N[(x - N[(y * N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[((-t) * y + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -740 \lor \neg \left(t \leq 0.84\right):\\
\;\;\;\;x - y \cdot \frac{a}{t}\\
\mathbf{else}:\\
\;\;\;\;x - \mathsf{fma}\left(-t, y, y\right) \cdot a\\
\end{array}
\end{array}
if t < -740 or 0.839999999999999969 < t Initial program 95.0%
Taylor expanded in z around 0
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6481.9
Applied rewrites81.9%
Taylor expanded in t around inf
Applied rewrites76.3%
Applied rewrites79.1%
if -740 < t < 0.839999999999999969Initial program 98.3%
Taylor expanded in z around 0
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6473.4
Applied rewrites73.4%
Taylor expanded in t around 0
Applied rewrites73.0%
Final simplification76.2%
(FPCore (x y z t a) :precision binary64 (if (<= z 1.5e+62) (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.5e+62) {
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.5e+62) 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.5e+62], 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.5 \cdot 10^{+62}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{-1 - t}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < 1.5e62Initial program 98.0%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
frac-2negN/A
associate-/r/N/A
distribute-rgt-neg-inN/A
remove-double-negN/A
lower-fma.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
distribute-neg-inN/A
metadata-evalN/A
unsub-negN/A
lower--.f6499.9
Applied rewrites99.9%
Taylor expanded in z around 0
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
lower-/.f64N/A
distribute-lft-inN/A
metadata-evalN/A
mul-1-negN/A
unsub-negN/A
lower--.f6483.5
Applied rewrites83.5%
if 1.5e62 < z Initial program 91.9%
Taylor expanded in z around inf
lower--.f6485.6
Applied rewrites85.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -170000.0) (not (<= z 8.5e-106))) (- x a) (- x (* a y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -170000.0) || !(z <= 8.5e-106)) {
tmp = x - a;
} else {
tmp = x - (a * y);
}
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 <= (-170000.0d0)) .or. (.not. (z <= 8.5d-106))) then
tmp = x - a
else
tmp = x - (a * y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -170000.0) || !(z <= 8.5e-106)) {
tmp = x - a;
} else {
tmp = x - (a * y);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -170000.0) or not (z <= 8.5e-106): tmp = x - a else: tmp = x - (a * y) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -170000.0) || !(z <= 8.5e-106)) tmp = Float64(x - a); else tmp = Float64(x - Float64(a * y)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -170000.0) || ~((z <= 8.5e-106))) tmp = x - a; else tmp = x - (a * y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -170000.0], N[Not[LessEqual[z, 8.5e-106]], $MachinePrecision]], N[(x - a), $MachinePrecision], N[(x - N[(a * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -170000 \lor \neg \left(z \leq 8.5 \cdot 10^{-106}\right):\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;x - a \cdot y\\
\end{array}
\end{array}
if z < -1.7e5 or 8.4999999999999998e-106 < z Initial program 95.9%
Taylor expanded in z around inf
lower--.f6473.4
Applied rewrites73.4%
if -1.7e5 < z < 8.4999999999999998e-106Initial program 97.4%
Taylor expanded in z around 0
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f6494.0
Applied rewrites94.0%
Taylor expanded in t around 0
Applied rewrites69.8%
Final simplification71.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.6%
Taylor expanded in z around inf
lower--.f6462.0
Applied rewrites62.0%
(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.6%
Taylor expanded in z around inf
lower--.f6462.0
Applied rewrites62.0%
Taylor expanded in x around 0
Applied rewrites12.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 2024313
(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))))