
(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 (/ (- z y) (- (- t z) -1.0)) a x))
double code(double x, double y, double z, double t, double a) {
return fma(((z - y) / ((t - z) - -1.0)), a, x);
}
function code(x, y, z, t, a) return fma(Float64(Float64(z - y) / Float64(Float64(t - z) - -1.0)), a, x) end
code[x_, y_, z_, t_, a_] := N[(N[(N[(z - y), $MachinePrecision] / N[(N[(t - z), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{z - y}{\left(t - z\right) - -1}, a, x\right)
\end{array}
Initial program 96.1%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
distribute-lft-neg-inN/A
distribute-frac-neg2N/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%
Final simplification99.9%
(FPCore (x y z t a)
:precision binary64
(if (<= z -1.0)
(- x a)
(if (<= z 6.6e-35)
(fma (fma (- 1.0 y) z (- y)) a x)
(if (<= z 1.95e+37) (fma (/ y t) (- a) x) (- x a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.0) {
tmp = x - a;
} else if (z <= 6.6e-35) {
tmp = fma(fma((1.0 - y), z, -y), a, x);
} else if (z <= 1.95e+37) {
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.0) tmp = Float64(x - a); elseif (z <= 6.6e-35) tmp = fma(fma(Float64(1.0 - y), z, Float64(-y)), a, x); elseif (z <= 1.95e+37) 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.0], N[(x - a), $MachinePrecision], If[LessEqual[z, 6.6e-35], N[(N[(N[(1.0 - y), $MachinePrecision] * z + (-y)), $MachinePrecision] * a + x), $MachinePrecision], If[LessEqual[z, 1.95e+37], N[(N[(y / t), $MachinePrecision] * (-a) + x), $MachinePrecision], N[(x - a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 6.6 \cdot 10^{-35}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(1 - y, z, -y\right), a, x\right)\\
\mathbf{elif}\;z \leq 1.95 \cdot 10^{+37}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{t}, -a, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -1 or 1.9499999999999999e37 < z Initial program 92.8%
Taylor expanded in z around inf
lower--.f6480.6
Applied rewrites80.6%
if -1 < z < 6.6000000000000001e-35Initial 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--.f6480.6
Applied rewrites80.6%
Taylor expanded in z around 0
Applied rewrites80.1%
if 6.6000000000000001e-35 < z < 1.9499999999999999e37Initial program 88.4%
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.f6469.1
Applied rewrites69.1%
Taylor expanded in z around 0
Applied rewrites69.2%
(FPCore (x y z t a)
:precision binary64
(if (<= z -0.00028)
(fma (/ z (- (- t -1.0) z)) a x)
(if (<= z 0.0023)
(fma (/ (- y z) (- -1.0 t)) a x)
(fma (/ (- y z) (- z 1.0)) a x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -0.00028) {
tmp = fma((z / ((t - -1.0) - z)), a, x);
} else if (z <= 0.0023) {
tmp = fma(((y - z) / (-1.0 - t)), a, x);
} else {
tmp = fma(((y - z) / (z - 1.0)), a, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -0.00028) tmp = fma(Float64(z / Float64(Float64(t - -1.0) - z)), a, x); elseif (z <= 0.0023) tmp = fma(Float64(Float64(y - z) / Float64(-1.0 - t)), a, 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[LessEqual[z, -0.00028], N[(N[(z / N[(N[(t - -1.0), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision], If[LessEqual[z, 0.0023], N[(N[(N[(y - z), $MachinePrecision] / N[(-1.0 - t), $MachinePrecision]), $MachinePrecision] * a + 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}\;z \leq -0.00028:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{\left(t - -1\right) - z}, a, x\right)\\
\mathbf{elif}\;z \leq 0.0023:\\
\;\;\;\;\mathsf{fma}\left(\frac{y - z}{-1 - t}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y - z}{z - 1}, a, x\right)\\
\end{array}
\end{array}
if z < -2.7999999999999998e-4Initial program 95.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
+-commutativeN/A
lower-+.f6487.4
Applied rewrites87.4%
if -2.7999999999999998e-4 < z < 0.0023Initial program 99.4%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
distribute-lft-neg-inN/A
distribute-frac-neg2N/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
distribute-lft-inN/A
metadata-evalN/A
mul-1-negN/A
unsub-negN/A
lower--.f6499.9
Applied rewrites99.9%
if 0.0023 < z Initial program 89.1%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
distribute-lft-neg-inN/A
distribute-frac-neg2N/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--.f6489.8
Applied rewrites89.8%
Final simplification94.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ z (- (- t -1.0) z)) a x)))
(if (<= z -0.00028)
t_1
(if (<= z 6.2e+31) (fma (/ (- y z) (- -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 <= -0.00028) {
tmp = t_1;
} else if (z <= 6.2e+31) {
tmp = fma(((y - z) / (-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 <= -0.00028) tmp = t_1; elseif (z <= 6.2e+31) tmp = fma(Float64(Float64(y - z) / 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, -0.00028], t$95$1, If[LessEqual[z, 6.2e+31], N[(N[(N[(y - z), $MachinePrecision] / 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 -0.00028:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 6.2 \cdot 10^{+31}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y - z}{-1 - t}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.7999999999999998e-4 or 6.2000000000000004e31 < z Initial program 92.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-+.f6487.6
Applied rewrites87.6%
if -2.7999999999999998e-4 < z < 6.2000000000000004e31Initial program 98.8%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
distribute-lft-neg-inN/A
distribute-frac-neg2N/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
distribute-lft-inN/A
metadata-evalN/A
mul-1-negN/A
unsub-negN/A
lower--.f6497.1
Applied rewrites97.1%
Final simplification92.8%
(FPCore (x y z t a) :precision binary64 (if (<= t -9.5e+48) (fma (/ (- y z) t) (- a) x) (if (<= t 1.35e+96) (fma (- y z) (/ a (- z 1.0)) x) (fma (/ y t) (- a) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -9.5e+48) {
tmp = fma(((y - z) / t), -a, x);
} else if (t <= 1.35e+96) {
tmp = fma((y - z), (a / (z - 1.0)), x);
} else {
tmp = fma((y / t), -a, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -9.5e+48) tmp = fma(Float64(Float64(y - z) / t), Float64(-a), x); elseif (t <= 1.35e+96) tmp = fma(Float64(y - z), Float64(a / Float64(z - 1.0)), x); else tmp = fma(Float64(y / t), Float64(-a), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -9.5e+48], N[(N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision] * (-a) + x), $MachinePrecision], If[LessEqual[t, 1.35e+96], N[(N[(y - z), $MachinePrecision] * N[(a / N[(z - 1.0), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(N[(y / t), $MachinePrecision] * (-a) + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9.5 \cdot 10^{+48}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y - z}{t}, -a, x\right)\\
\mathbf{elif}\;t \leq 1.35 \cdot 10^{+96}:\\
\;\;\;\;\mathsf{fma}\left(y - z, \frac{a}{z - 1}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{t}, -a, x\right)\\
\end{array}
\end{array}
if t < -9.4999999999999997e48Initial program 94.9%
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.f6486.2
Applied rewrites86.2%
if -9.4999999999999997e48 < t < 1.35000000000000011e96Initial program 96.1%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
distribute-lft-neg-inN/A
distribute-frac-neg2N/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 t around 0
lower--.f6497.6
Applied rewrites97.6%
lift-fma.f64N/A
lift-/.f64N/A
associate-*l/N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6493.8
Applied rewrites93.8%
if 1.35000000000000011e96 < t Initial program 97.8%
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.f6482.7
Applied rewrites82.7%
Taylor expanded in z around 0
Applied rewrites88.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ z (- (- t -1.0) z)) a x)))
(if (<= z -3.4e-50)
t_1
(if (<= z 2.2e+31) (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 <= -3.4e-50) {
tmp = t_1;
} else if (z <= 2.2e+31) {
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 <= -3.4e-50) tmp = t_1; elseif (z <= 2.2e+31) 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, -3.4e-50], t$95$1, If[LessEqual[z, 2.2e+31], 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 -3.4 \cdot 10^{-50}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{+31}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{-1 - t}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.40000000000000014e-50 or 2.2000000000000001e31 < z Initial program 93.3%
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.6
Applied rewrites87.6%
if -3.40000000000000014e-50 < z < 2.2000000000000001e31Initial program 98.7%
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.9
Applied rewrites91.9%
Final simplification89.8%
(FPCore (x y z t a) :precision binary64 (if (<= z -3.4e-50) (fma z (/ a (- (- t -1.0) z)) x) (if (<= z 1.95e+37) (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 <= -3.4e-50) {
tmp = fma(z, (a / ((t - -1.0) - z)), x);
} else if (z <= 1.95e+37) {
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 <= -3.4e-50) tmp = fma(z, Float64(a / Float64(Float64(t - -1.0) - z)), x); elseif (z <= 1.95e+37) 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, -3.4e-50], N[(z * N[(a / N[(N[(t - -1.0), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 1.95e+37], 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 -3.4 \cdot 10^{-50}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{a}{\left(t - -1\right) - z}, x\right)\\
\mathbf{elif}\;z \leq 1.95 \cdot 10^{+37}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{-1 - t}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -3.40000000000000014e-50Initial 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
+-commutativeN/A
lower-+.f6487.5
Applied rewrites87.5%
Applied rewrites83.9%
if -3.40000000000000014e-50 < z < 1.9499999999999999e37Initial program 98.7%
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.9
Applied rewrites91.9%
if 1.9499999999999999e37 < z Initial program 89.5%
Taylor expanded in z around inf
lower--.f6487.4
Applied rewrites87.4%
Final simplification88.7%
(FPCore (x y z t a) :precision binary64 (if (<= z -0.00076) (fma (/ z (- 1.0 z)) a x) (if (<= z 1.95e+37) (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 <= -0.00076) {
tmp = fma((z / (1.0 - z)), a, x);
} else if (z <= 1.95e+37) {
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 <= -0.00076) tmp = fma(Float64(z / Float64(1.0 - z)), a, x); elseif (z <= 1.95e+37) 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, -0.00076], N[(N[(z / N[(1.0 - z), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision], If[LessEqual[z, 1.95e+37], 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 -0.00076:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{1 - z}, a, x\right)\\
\mathbf{elif}\;z \leq 1.95 \cdot 10^{+37}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{-1 - t}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -7.6000000000000004e-4Initial program 95.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
+-commutativeN/A
lower-+.f6487.4
Applied rewrites87.4%
Taylor expanded in t around 0
Applied rewrites76.6%
if -7.6000000000000004e-4 < z < 1.9499999999999999e37Initial program 98.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--.f6491.0
Applied rewrites91.0%
if 1.9499999999999999e37 < z Initial program 89.5%
Taylor expanded in z around inf
lower--.f6487.4
Applied rewrites87.4%
(FPCore (x y z t a) :precision binary64 (if (<= z -4.5e+33) (- x a) (if (<= z 1.95e+37) (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.5e+33) {
tmp = x - a;
} else if (z <= 1.95e+37) {
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.5e+33) tmp = Float64(x - a); elseif (z <= 1.95e+37) 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.5e+33], N[(x - a), $MachinePrecision], If[LessEqual[z, 1.95e+37], 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.5 \cdot 10^{+33}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 1.95 \cdot 10^{+37}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{-1 - t}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -4.5e33 or 1.9499999999999999e37 < z Initial program 92.6%
Taylor expanded in z around inf
lower--.f6482.2
Applied rewrites82.2%
if -4.5e33 < z < 1.9499999999999999e37Initial program 98.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--.f6489.3
Applied rewrites89.3%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.0) (- x a) (if (<= z 7.5e-35) (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.0) {
tmp = x - a;
} else if (z <= 7.5e-35) {
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.0) tmp = Float64(x - a); elseif (z <= 7.5e-35) 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.0], N[(x - a), $MachinePrecision], If[LessEqual[z, 7.5e-35], 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:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 7.5 \cdot 10^{-35}:\\
\;\;\;\;\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 or 7.5e-35 < z Initial program 92.4%
Taylor expanded in z around inf
lower--.f6476.0
Applied rewrites76.0%
if -1 < z < 7.5e-35Initial 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--.f6480.6
Applied rewrites80.6%
Taylor expanded in z around 0
Applied rewrites80.1%
(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.1%
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.5%
(FPCore (x y z t a) :precision binary64 (if (<= z -0.00076) (- x a) (if (<= z 23000000000000.0) (fma (- y) a x) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -0.00076) {
tmp = x - a;
} else if (z <= 23000000000000.0) {
tmp = fma(-y, a, x);
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -0.00076) tmp = Float64(x - a); elseif (z <= 23000000000000.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, -0.00076], N[(x - a), $MachinePrecision], If[LessEqual[z, 23000000000000.0], N[((-y) * a + x), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.00076:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 23000000000000:\\
\;\;\;\;\mathsf{fma}\left(-y, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -7.6000000000000004e-4 or 2.3e13 < z Initial program 92.4%
Taylor expanded in z around inf
lower--.f6478.2
Applied rewrites78.2%
if -7.6000000000000004e-4 < z < 2.3e13Initial program 99.4%
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--.f6478.9
Applied rewrites78.9%
Taylor expanded in z around 0
Applied rewrites76.1%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.2e-16) (- x a) (if (<= z 26000000000000.0) (* 1.0 x) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.2e-16) {
tmp = x - a;
} else if (z <= 26000000000000.0) {
tmp = 1.0 * x;
} else {
tmp = x - a;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (z <= (-1.2d-16)) then
tmp = x - a
else if (z <= 26000000000000.0d0) then
tmp = 1.0d0 * x
else
tmp = x - a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.2e-16) {
tmp = x - a;
} else if (z <= 26000000000000.0) {
tmp = 1.0 * x;
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.2e-16: tmp = x - a elif z <= 26000000000000.0: tmp = 1.0 * x else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.2e-16) tmp = Float64(x - a); elseif (z <= 26000000000000.0) tmp = Float64(1.0 * x); else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1.2e-16) tmp = x - a; elseif (z <= 26000000000000.0) tmp = 1.0 * x; else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.2e-16], N[(x - a), $MachinePrecision], If[LessEqual[z, 26000000000000.0], N[(1.0 * x), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.2 \cdot 10^{-16}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 26000000000000:\\
\;\;\;\;1 \cdot x\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -1.20000000000000002e-16 or 2.6e13 < z Initial program 92.4%
Taylor expanded in z around inf
lower--.f6478.2
Applied rewrites78.2%
if -1.20000000000000002e-16 < z < 2.6e13Initial program 99.4%
Taylor expanded in z around inf
lower--.f6446.5
Applied rewrites46.5%
Taylor expanded in x around inf
Applied rewrites47.1%
Taylor expanded in a around 0
Applied rewrites60.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.1%
Taylor expanded in z around inf
lower--.f6461.2
Applied rewrites61.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.1%
Taylor expanded in z around inf
lower--.f6461.2
Applied rewrites61.2%
Taylor expanded in a around inf
Applied rewrites18.0%
(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 2024255
(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))))