
(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 (- x (/ a (/ (- (- z t) 1.0) (- z y)))))
double code(double x, double y, double z, double t, double a) {
return x - (a / (((z - t) - 1.0) / (z - y)));
}
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 / (((z - t) - 1.0d0) / (z - y)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x - (a / (((z - t) - 1.0) / (z - y)));
}
def code(x, y, z, t, a): return x - (a / (((z - t) - 1.0) / (z - y)))
function code(x, y, z, t, a) return Float64(x - Float64(a / Float64(Float64(Float64(z - t) - 1.0) / Float64(z - y)))) end
function tmp = code(x, y, z, t, a) tmp = x - (a / (((z - t) - 1.0) / (z - y))); end
code[x_, y_, z_, t_, a_] := N[(x - N[(a / N[(N[(N[(z - t), $MachinePrecision] - 1.0), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{a}{\frac{\left(z - t\right) - 1}{z - y}}
\end{array}
Initial program 96.9%
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
*-commutativeN/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6499.1
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.1
Applied rewrites99.1%
Final simplification99.1%
(FPCore (x y z t a)
:precision binary64
(if (<= z -9.5e+41)
(- x a)
(if (<= z 3.4e-11)
(fma y (/ a (- -1.0 t)) x)
(if (<= z 1.12e+40) (fma (/ (- y) (- 1.0 z)) a x) (- x a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -9.5e+41) {
tmp = x - a;
} else if (z <= 3.4e-11) {
tmp = fma(y, (a / (-1.0 - t)), x);
} else if (z <= 1.12e+40) {
tmp = fma((-y / (1.0 - z)), a, x);
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -9.5e+41) tmp = Float64(x - a); elseif (z <= 3.4e-11) tmp = fma(y, Float64(a / Float64(-1.0 - t)), x); elseif (z <= 1.12e+40) tmp = fma(Float64(Float64(-y) / Float64(1.0 - z)), a, x); else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -9.5e+41], N[(x - a), $MachinePrecision], If[LessEqual[z, 3.4e-11], N[(y * N[(a / N[(-1.0 - t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 1.12e+40], N[(N[((-y) / N[(1.0 - z), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision], N[(x - a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.5 \cdot 10^{+41}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 3.4 \cdot 10^{-11}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{a}{-1 - t}, x\right)\\
\mathbf{elif}\;z \leq 1.12 \cdot 10^{+40}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-y}{1 - z}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -9.4999999999999996e41 or 1.12000000000000001e40 < z Initial program 93.1%
Taylor expanded in z around inf
lower--.f6479.1
Applied rewrites79.1%
if -9.4999999999999996e41 < z < 3.3999999999999999e-11Initial program 99.4%
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--.f6488.0
Applied rewrites88.0%
Applied rewrites88.9%
if 3.3999999999999999e-11 < z < 1.12000000000000001e40Initial program 99.5%
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--.f6477.4
Applied rewrites77.4%
Taylor expanded in z around 0
Applied rewrites70.8%
(FPCore (x y z t a)
:precision binary64
(if (<= z -9.5e+41)
(- x a)
(if (<= z 0.00325)
(fma y (/ a (- -1.0 t)) x)
(if (<= z 2.7e+61) (/ (* (- y z) a) (+ -1.0 z)) (- x a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -9.5e+41) {
tmp = x - a;
} else if (z <= 0.00325) {
tmp = fma(y, (a / (-1.0 - t)), x);
} else if (z <= 2.7e+61) {
tmp = ((y - z) * a) / (-1.0 + z);
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -9.5e+41) tmp = Float64(x - a); elseif (z <= 0.00325) tmp = fma(y, Float64(a / Float64(-1.0 - t)), x); elseif (z <= 2.7e+61) tmp = Float64(Float64(Float64(y - z) * a) / Float64(-1.0 + z)); else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -9.5e+41], N[(x - a), $MachinePrecision], If[LessEqual[z, 0.00325], N[(y * N[(a / N[(-1.0 - t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 2.7e+61], N[(N[(N[(y - z), $MachinePrecision] * a), $MachinePrecision] / N[(-1.0 + z), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.5 \cdot 10^{+41}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 0.00325:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{a}{-1 - t}, x\right)\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{+61}:\\
\;\;\;\;\frac{\left(y - z\right) \cdot a}{-1 + z}\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -9.4999999999999996e41 or 2.7000000000000002e61 < z Initial program 93.3%
Taylor expanded in z around inf
lower--.f6480.6
Applied rewrites80.6%
if -9.4999999999999996e41 < z < 0.00324999999999999985Initial program 99.4%
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--.f6487.8
Applied rewrites87.8%
Applied rewrites88.8%
if 0.00324999999999999985 < z < 2.7000000000000002e61Initial program 96.0%
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--.f6472.4
Applied rewrites72.4%
Taylor expanded in z around 0
Applied rewrites2.9%
Taylor expanded in y around 0
Applied rewrites15.6%
Taylor expanded in a around inf
Applied rewrites61.7%
Final simplification83.8%
(FPCore (x y z t a)
:precision binary64
(if (<= z -9.5e+41)
(- x a)
(if (<= z 0.00325)
(fma y (/ a (- -1.0 t)) x)
(if (<= z 2.2e+83) (* (/ a (+ -1.0 z)) (- y z)) (- x a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -9.5e+41) {
tmp = x - a;
} else if (z <= 0.00325) {
tmp = fma(y, (a / (-1.0 - t)), x);
} else if (z <= 2.2e+83) {
tmp = (a / (-1.0 + z)) * (y - z);
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -9.5e+41) tmp = Float64(x - a); elseif (z <= 0.00325) tmp = fma(y, Float64(a / Float64(-1.0 - t)), x); elseif (z <= 2.2e+83) tmp = Float64(Float64(a / Float64(-1.0 + z)) * Float64(y - z)); else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -9.5e+41], N[(x - a), $MachinePrecision], If[LessEqual[z, 0.00325], N[(y * N[(a / N[(-1.0 - t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[z, 2.2e+83], N[(N[(a / N[(-1.0 + z), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.5 \cdot 10^{+41}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 0.00325:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{a}{-1 - t}, x\right)\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{+83}:\\
\;\;\;\;\frac{a}{-1 + z} \cdot \left(y - z\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -9.4999999999999996e41 or 2.19999999999999999e83 < z Initial program 92.9%
Taylor expanded in z around inf
lower--.f6483.5
Applied rewrites83.5%
if -9.4999999999999996e41 < z < 0.00324999999999999985Initial program 99.4%
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--.f6487.8
Applied rewrites87.8%
Applied rewrites88.8%
if 0.00324999999999999985 < z < 2.19999999999999999e83Initial program 96.8%
Taylor expanded in t around 0
sub-negN/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
distribute-neg-fracN/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower--.f6471.1
Applied rewrites71.1%
Taylor expanded in a around inf
Applied rewrites54.6%
Final simplification83.8%
(FPCore (x y z t a)
:precision binary64
(if (<= z -105.0)
(- x a)
(if (<= z 8.8e-30)
(fma (fma (- 1.0 y) z (- y)) a x)
(if (<= z 7.8e+38) (fma (/ y (- t)) a x) (- x a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -105.0) {
tmp = x - a;
} else if (z <= 8.8e-30) {
tmp = fma(fma((1.0 - y), z, -y), a, x);
} else if (z <= 7.8e+38) {
tmp = fma((y / -t), a, x);
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -105.0) tmp = Float64(x - a); elseif (z <= 8.8e-30) tmp = fma(fma(Float64(1.0 - y), z, Float64(-y)), a, x); elseif (z <= 7.8e+38) tmp = fma(Float64(y / Float64(-t)), a, x); else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -105.0], N[(x - a), $MachinePrecision], If[LessEqual[z, 8.8e-30], N[(N[(N[(1.0 - y), $MachinePrecision] * z + (-y)), $MachinePrecision] * a + x), $MachinePrecision], If[LessEqual[z, 7.8e+38], N[(N[(y / (-t)), $MachinePrecision] * a + x), $MachinePrecision], N[(x - a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -105:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 8.8 \cdot 10^{-30}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(1 - y, z, -y\right), a, x\right)\\
\mathbf{elif}\;z \leq 7.8 \cdot 10^{+38}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{-t}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -105 or 7.80000000000000047e38 < z Initial program 93.7%
Taylor expanded in z around inf
lower--.f6476.2
Applied rewrites76.2%
if -105 < z < 8.79999999999999933e-30Initial 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--.f6479.3
Applied rewrites79.3%
Taylor expanded in z around 0
Applied rewrites79.3%
if 8.79999999999999933e-30 < z < 7.80000000000000047e38Initial program 99.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--.f6453.5
Applied rewrites53.5%
Taylor expanded in t around inf
Applied rewrites58.8%
(FPCore (x y z t a)
:precision binary64
(if (<= t -4.05e+136)
(fma (/ (- y z) t) (- a) x)
(if (<= t 2e+33)
(fma (/ (- z y) (- 1.0 z)) a x)
(- x (* (/ a t) (- y z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -4.05e+136) {
tmp = fma(((y - z) / t), -a, x);
} else if (t <= 2e+33) {
tmp = fma(((z - y) / (1.0 - z)), a, x);
} else {
tmp = x - ((a / t) * (y - z));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -4.05e+136) tmp = fma(Float64(Float64(y - z) / t), Float64(-a), x); elseif (t <= 2e+33) tmp = fma(Float64(Float64(z - y) / Float64(1.0 - z)), a, x); else tmp = Float64(x - Float64(Float64(a / t) * Float64(y - z))); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -4.05e+136], N[(N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision] * (-a) + x), $MachinePrecision], If[LessEqual[t, 2e+33], N[(N[(N[(z - y), $MachinePrecision] / N[(1.0 - z), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision], N[(x - N[(N[(a / t), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.05 \cdot 10^{+136}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y - z}{t}, -a, x\right)\\
\mathbf{elif}\;t \leq 2 \cdot 10^{+33}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - y}{1 - z}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - \frac{a}{t} \cdot \left(y - z\right)\\
\end{array}
\end{array}
if t < -4.0500000000000003e136Initial program 98.2%
Taylor expanded in t around inf
mul-1-negN/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
lower-neg.f6497.2
Applied rewrites97.2%
if -4.0500000000000003e136 < t < 1.9999999999999999e33Initial program 95.6%
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--.f6497.3
Applied rewrites97.3%
Taylor expanded in z around 0
Applied rewrites97.3%
if 1.9999999999999999e33 < t Initial program 99.9%
Taylor expanded in t around inf
lower-/.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower--.f6476.9
Applied rewrites76.9%
Applied rewrites94.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ z (- (- t -1.0) z)) a x)))
(if (<= z -54000000000.0)
t_1
(if (<= z 6.8e-6) (fma y (/ a (- -1.0 t)) 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 <= -54000000000.0) {
tmp = t_1;
} else if (z <= 6.8e-6) {
tmp = fma(y, (a / (-1.0 - t)), 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 <= -54000000000.0) tmp = t_1; elseif (z <= 6.8e-6) tmp = fma(y, Float64(a / Float64(-1.0 - t)), 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, -54000000000.0], t$95$1, If[LessEqual[z, 6.8e-6], N[(y * N[(a / N[(-1.0 - t), $MachinePrecision]), $MachinePrecision] + 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 -54000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 6.8 \cdot 10^{-6}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{a}{-1 - t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -5.4e10 or 6.80000000000000012e-6 < z Initial program 94.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
+-commutativeN/A
lower-+.f6483.8
Applied rewrites83.8%
if -5.4e10 < z < 6.80000000000000012e-6Initial program 99.4%
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.2
Applied rewrites89.2%
Applied rewrites90.2%
Final simplification87.1%
(FPCore (x y z t a) :precision binary64 (if (<= z -9.5e+41) (- x a) (if (<= z 0.00325) (fma y (/ a (- -1.0 t)) x) (fma (/ z (- 1.0 z)) a x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -9.5e+41) {
tmp = x - a;
} else if (z <= 0.00325) {
tmp = fma(y, (a / (-1.0 - t)), x);
} else {
tmp = fma((z / (1.0 - z)), a, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -9.5e+41) tmp = Float64(x - a); elseif (z <= 0.00325) tmp = fma(y, Float64(a / Float64(-1.0 - t)), x); else tmp = fma(Float64(z / Float64(1.0 - z)), a, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -9.5e+41], N[(x - a), $MachinePrecision], If[LessEqual[z, 0.00325], N[(y * N[(a / N[(-1.0 - t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(N[(z / N[(1.0 - z), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.5 \cdot 10^{+41}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 0.00325:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{a}{-1 - t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z}{1 - z}, a, x\right)\\
\end{array}
\end{array}
if z < -9.4999999999999996e41Initial program 92.2%
Taylor expanded in z around inf
lower--.f6476.8
Applied rewrites76.8%
if -9.4999999999999996e41 < z < 0.00324999999999999985Initial program 99.4%
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--.f6487.8
Applied rewrites87.8%
Applied rewrites88.8%
if 0.00324999999999999985 < z Initial program 94.8%
Taylor expanded in t around 0
sub-negN/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
distribute-neg-fracN/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower--.f6487.1
Applied rewrites87.1%
Taylor expanded in y around 0
Applied rewrites72.4%
(FPCore (x y z t a) :precision binary64 (if (<= z -9.5e+41) (- x a) (if (<= z 7.4e+38) (fma y (/ a (- -1.0 t)) x) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -9.5e+41) {
tmp = x - a;
} else if (z <= 7.4e+38) {
tmp = fma(y, (a / (-1.0 - t)), x);
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -9.5e+41) tmp = Float64(x - a); elseif (z <= 7.4e+38) tmp = fma(y, Float64(a / Float64(-1.0 - t)), x); else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -9.5e+41], N[(x - a), $MachinePrecision], If[LessEqual[z, 7.4e+38], N[(y * N[(a / N[(-1.0 - t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.5 \cdot 10^{+41}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 7.4 \cdot 10^{+38}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{a}{-1 - t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -9.4999999999999996e41 or 7.4000000000000002e38 < z Initial program 93.1%
Taylor expanded in z around inf
lower--.f6479.1
Applied rewrites79.1%
if -9.4999999999999996e41 < z < 7.4000000000000002e38Initial program 99.4%
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--.f6483.5
Applied rewrites83.5%
Applied rewrites84.3%
(FPCore (x y z t a) :precision binary64 (if (<= z -105.0) (- x a) (if (<= z 3.9e-31) (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 <= -105.0) {
tmp = x - a;
} else if (z <= 3.9e-31) {
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 <= -105.0) tmp = Float64(x - a); elseif (z <= 3.9e-31) 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, -105.0], N[(x - a), $MachinePrecision], If[LessEqual[z, 3.9e-31], 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 -105:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 3.9 \cdot 10^{-31}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(1 - y, z, -y\right), a, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -105 or 3.9000000000000001e-31 < z Initial program 94.5%
Taylor expanded in z around inf
lower--.f6469.8
Applied rewrites69.8%
if -105 < z < 3.9000000000000001e-31Initial 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--.f6479.1
Applied rewrites79.1%
Taylor expanded in z around 0
Applied rewrites79.1%
(FPCore (x y z t a) :precision binary64 (fma (/ a (- (- z t) 1.0)) (- y z) x))
double code(double x, double y, double z, double t, double a) {
return fma((a / ((z - t) - 1.0)), (y - z), x);
}
function code(x, y, z, t, a) return fma(Float64(a / Float64(Float64(z - t) - 1.0)), Float64(y - z), x) end
code[x_, y_, z_, t_, a_] := N[(N[(a / N[(N[(z - t), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision] * N[(y - z), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{a}{\left(z - t\right) - 1}, y - z, x\right)
\end{array}
Initial program 96.9%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-/.f64N/A
clear-numN/A
associate-/r/N/A
lift-/.f64N/A
clear-numN/A
distribute-lft-neg-inN/A
clear-numN/A
lift-/.f64N/A
distribute-frac-neg2N/A
lower-fma.f64N/A
Applied rewrites97.2%
Final simplification97.2%
(FPCore (x y z t a) :precision binary64 (if (<= z -170000000000.0) (- x a) (if (<= z 3.9e-31) (fma (- y) a x) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -170000000000.0) {
tmp = x - a;
} else if (z <= 3.9e-31) {
tmp = fma(-y, a, x);
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -170000000000.0) tmp = Float64(x - a); elseif (z <= 3.9e-31) tmp = fma(Float64(-y), a, x); else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -170000000000.0], N[(x - a), $MachinePrecision], If[LessEqual[z, 3.9e-31], N[((-y) * a + x), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -170000000000:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 3.9 \cdot 10^{-31}:\\
\;\;\;\;\mathsf{fma}\left(-y, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -1.7e11 or 3.9000000000000001e-31 < z Initial program 94.4%
Taylor expanded in z around inf
lower--.f6470.1
Applied rewrites70.1%
if -1.7e11 < z < 3.9000000000000001e-31Initial 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--.f6479.4
Applied rewrites79.4%
Taylor expanded in z around 0
Applied rewrites73.3%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.0) (- x a) (if (<= z 0.92) (fma z 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 <= 0.92) {
tmp = fma(z, 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 <= 0.92) tmp = fma(z, 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, 0.92], N[(z * a + x), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 0.92:\\
\;\;\;\;\mathsf{fma}\left(z, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -1 or 0.92000000000000004 < z Initial program 94.1%
Taylor expanded in z around inf
lower--.f6471.1
Applied rewrites71.1%
if -1 < z < 0.92000000000000004Initial 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--.f6477.5
Applied rewrites77.5%
Taylor expanded in z around 0
Applied rewrites72.1%
Taylor expanded in y around 0
Applied rewrites59.4%
(FPCore (x y z t a) :precision binary64 (- x a))
double code(double x, double y, double z, double t, double a) {
return x - a;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x - a
end function
public static double code(double x, double y, double z, double t, double a) {
return x - a;
}
def code(x, y, z, t, a): return x - a
function code(x, y, z, t, a) return Float64(x - a) end
function tmp = code(x, y, z, t, a) tmp = x - a; end
code[x_, y_, z_, t_, a_] := N[(x - a), $MachinePrecision]
\begin{array}{l}
\\
x - a
\end{array}
Initial program 96.9%
Taylor expanded in z around inf
lower--.f6457.2
Applied rewrites57.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.9%
Taylor expanded in z around inf
lower--.f6457.2
Applied rewrites57.2%
Taylor expanded in a around inf
Applied rewrites18.7%
(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 2024266
(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))))