
(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 14 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 (/ (- -1.0 (- t z)) (- z y)))))
double code(double x, double y, double z, double t, double a) {
return x - (a / ((-1.0 - (t - z)) / (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 / (((-1.0d0) - (t - z)) / (z - y)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x - (a / ((-1.0 - (t - z)) / (z - y)));
}
def code(x, y, z, t, a): return x - (a / ((-1.0 - (t - z)) / (z - y)))
function code(x, y, z, t, a) return Float64(x - Float64(a / Float64(Float64(-1.0 - Float64(t - z)) / Float64(z - y)))) end
function tmp = code(x, y, z, t, a) tmp = x - (a / ((-1.0 - (t - z)) / (z - y))); end
code[x_, y_, z_, t_, a_] := N[(x - N[(a / N[(N[(-1.0 - N[(t - z), $MachinePrecision]), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{a}{\frac{-1 - \left(t - z\right)}{z - y}}
\end{array}
Initial program 95.7%
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
*-commutativeN/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6499.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
Applied rewrites99.9%
Final simplification99.9%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (* (- a) y)) (t_2 (/ (- z y) (/ (- -1.0 (- t z)) a)))) (if (<= t_2 -2e+276) t_1 (if (<= t_2 1e+267) (- x a) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = -a * y;
double t_2 = (z - y) / ((-1.0 - (t - z)) / a);
double tmp;
if (t_2 <= -2e+276) {
tmp = t_1;
} else if (t_2 <= 1e+267) {
tmp = x - a;
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = -a * y
t_2 = (z - y) / (((-1.0d0) - (t - z)) / a)
if (t_2 <= (-2d+276)) then
tmp = t_1
else if (t_2 <= 1d+267) then
tmp = x - a
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = -a * y;
double t_2 = (z - y) / ((-1.0 - (t - z)) / a);
double tmp;
if (t_2 <= -2e+276) {
tmp = t_1;
} else if (t_2 <= 1e+267) {
tmp = x - a;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = -a * y t_2 = (z - y) / ((-1.0 - (t - z)) / a) tmp = 0 if t_2 <= -2e+276: tmp = t_1 elif t_2 <= 1e+267: tmp = x - a else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(-a) * y) t_2 = Float64(Float64(z - y) / Float64(Float64(-1.0 - Float64(t - z)) / a)) tmp = 0.0 if (t_2 <= -2e+276) tmp = t_1; elseif (t_2 <= 1e+267) tmp = Float64(x - a); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = -a * y; t_2 = (z - y) / ((-1.0 - (t - z)) / a); tmp = 0.0; if (t_2 <= -2e+276) tmp = t_1; elseif (t_2 <= 1e+267) tmp = x - a; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[((-a) * y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(z - y), $MachinePrecision] / N[(N[(-1.0 - N[(t - z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+276], t$95$1, If[LessEqual[t$95$2, 1e+267], N[(x - a), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-a\right) \cdot y\\
t_2 := \frac{z - y}{\frac{-1 - \left(t - z\right)}{a}}\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+276}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10^{+267}:\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (-.f64 y z) (/.f64 (+.f64 (-.f64 t z) #s(literal 1 binary64)) a)) < -2.0000000000000001e276 or 9.9999999999999997e266 < (/.f64 (-.f64 y z) (/.f64 (+.f64 (-.f64 t z) #s(literal 1 binary64)) a)) Initial program 99.8%
Taylor expanded in t around 0
sub-negN/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
distribute-neg-fracN/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower--.f6476.5
Applied rewrites76.5%
Taylor expanded in a around inf
Applied rewrites62.1%
Taylor expanded in z around 0
Applied rewrites54.7%
if -2.0000000000000001e276 < (/.f64 (-.f64 y z) (/.f64 (+.f64 (-.f64 t z) #s(literal 1 binary64)) a)) < 9.9999999999999997e266Initial program 95.2%
Taylor expanded in z around inf
lower--.f6460.9
Applied rewrites60.9%
Final simplification60.2%
(FPCore (x y z t a)
:precision binary64
(if (<= z -1.0)
(- x a)
(if (<= z 3.2e-195)
(fma (fma (- 1.0 y) z (- y)) a x)
(if (<= z 3.3e-80)
(fma (/ y t) (- a) x)
(if (<= z 8.5e+68) (fma z (/ a (- t -1.0)) 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 <= 3.2e-195) {
tmp = fma(fma((1.0 - y), z, -y), a, x);
} else if (z <= 3.3e-80) {
tmp = fma((y / t), -a, x);
} else if (z <= 8.5e+68) {
tmp = fma(z, (a / (t - -1.0)), 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 <= 3.2e-195) tmp = fma(fma(Float64(1.0 - y), z, Float64(-y)), a, x); elseif (z <= 3.3e-80) tmp = fma(Float64(y / t), Float64(-a), x); elseif (z <= 8.5e+68) tmp = fma(z, Float64(a / Float64(t - -1.0)), 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, 3.2e-195], N[(N[(N[(1.0 - y), $MachinePrecision] * z + (-y)), $MachinePrecision] * a + x), $MachinePrecision], If[LessEqual[z, 3.3e-80], N[(N[(y / t), $MachinePrecision] * (-a) + x), $MachinePrecision], If[LessEqual[z, 8.5e+68], N[(z * N[(a / N[(t - -1.0), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(x - a), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 3.2 \cdot 10^{-195}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(1 - y, z, -y\right), a, x\right)\\
\mathbf{elif}\;z \leq 3.3 \cdot 10^{-80}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{t}, -a, x\right)\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{+68}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{a}{t - -1}, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -1 or 8.49999999999999966e68 < z Initial program 91.2%
Taylor expanded in z around inf
lower--.f6483.8
Applied rewrites83.8%
if -1 < z < 3.2000000000000001e-195Initial program 98.7%
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.7
Applied rewrites78.7%
Taylor expanded in z around 0
Applied rewrites78.2%
if 3.2000000000000001e-195 < z < 3.3e-80Initial program 99.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.f6481.6
Applied rewrites81.6%
Taylor expanded in z around 0
Applied rewrites77.3%
if 3.3e-80 < z < 8.49999999999999966e68Initial program 99.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
lower-+.f6478.9
Applied rewrites78.9%
Taylor expanded in z around 0
Applied rewrites73.2%
Applied rewrites73.1%
Final simplification79.9%
(FPCore (x y z t a)
:precision binary64
(if (<= z -2.5e+161)
(- x (/ a (/ (- z) (- y z))))
(if (<= z 1.45e+73)
(- x (/ (* (- y z) a) (- (- t z) -1.0)))
(fma (/ (- z y) (- 1.0 z)) a x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.5e+161) {
tmp = x - (a / (-z / (y - z)));
} else if (z <= 1.45e+73) {
tmp = x - (((y - z) * a) / ((t - z) - -1.0));
} else {
tmp = fma(((z - y) / (1.0 - z)), a, x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.5e+161) tmp = Float64(x - Float64(a / Float64(Float64(-z) / Float64(y - z)))); elseif (z <= 1.45e+73) tmp = Float64(x - Float64(Float64(Float64(y - z) * a) / Float64(Float64(t - z) - -1.0))); else tmp = fma(Float64(Float64(z - y) / Float64(1.0 - z)), a, x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.5e+161], N[(x - N[(a / N[((-z) / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.45e+73], N[(x - N[(N[(N[(y - z), $MachinePrecision] * a), $MachinePrecision] / N[(N[(t - z), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(z - y), $MachinePrecision] / N[(1.0 - z), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.5 \cdot 10^{+161}:\\
\;\;\;\;x - \frac{a}{\frac{-z}{y - z}}\\
\mathbf{elif}\;z \leq 1.45 \cdot 10^{+73}:\\
\;\;\;\;x - \frac{\left(y - z\right) \cdot a}{\left(t - z\right) - -1}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{z - y}{1 - z}, a, x\right)\\
\end{array}
\end{array}
if z < -2.4999999999999998e161Initial program 87.3%
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
*-commutativeN/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f64100.0
lift-+.f64N/A
+-commutativeN/A
lower-+.f64100.0
Applied rewrites100.0%
Taylor expanded in z around inf
mul-1-negN/A
lower-neg.f6498.6
Applied rewrites98.6%
if -2.4999999999999998e161 < z < 1.4500000000000001e73Initial program 97.6%
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6495.0
lift-+.f64N/A
+-commutativeN/A
lower-+.f6495.0
Applied rewrites95.0%
if 1.4500000000000001e73 < z Initial program 95.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--.f64100.0
Applied rewrites100.0%
Taylor expanded in z around 0
Applied rewrites100.0%
Final simplification96.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ (- z y) (- 1.0 z)) a x)))
(if (<= z -2.5e+161)
t_1
(if (<= z 1.45e+73) (- x (/ (* (- y z) a) (- (- t z) -1.0))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(((z - y) / (1.0 - z)), a, x);
double tmp;
if (z <= -2.5e+161) {
tmp = t_1;
} else if (z <= 1.45e+73) {
tmp = x - (((y - z) * a) / ((t - z) - -1.0));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(Float64(Float64(z - y) / Float64(1.0 - z)), a, x) tmp = 0.0 if (z <= -2.5e+161) tmp = t_1; elseif (z <= 1.45e+73) tmp = Float64(x - Float64(Float64(Float64(y - z) * a) / Float64(Float64(t - z) - -1.0))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(z - y), $MachinePrecision] / N[(1.0 - z), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision]}, If[LessEqual[z, -2.5e+161], t$95$1, If[LessEqual[z, 1.45e+73], N[(x - N[(N[(N[(y - z), $MachinePrecision] * a), $MachinePrecision] / N[(N[(t - z), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{z - y}{1 - z}, a, x\right)\\
\mathbf{if}\;z \leq -2.5 \cdot 10^{+161}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.45 \cdot 10^{+73}:\\
\;\;\;\;x - \frac{\left(y - z\right) \cdot a}{\left(t - z\right) - -1}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.4999999999999998e161 or 1.4500000000000001e73 < z Initial program 91.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--.f6499.4
Applied rewrites99.4%
Taylor expanded in z around 0
Applied rewrites99.4%
if -2.4999999999999998e161 < z < 1.4500000000000001e73Initial program 97.6%
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
associate-*l/N/A
lower-/.f64N/A
lower-*.f6495.0
lift-+.f64N/A
+-commutativeN/A
lower-+.f6495.0
Applied rewrites95.0%
Final simplification96.4%
(FPCore (x y z t a)
:precision binary64
(if (<= z -1.0)
(- x a)
(if (<= z 3.2e-195)
(fma (fma (- 1.0 y) z (- y)) a x)
(if (<= z 1700000000000.0) (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 <= 3.2e-195) {
tmp = fma(fma((1.0 - y), z, -y), a, x);
} else if (z <= 1700000000000.0) {
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 <= 3.2e-195) tmp = fma(fma(Float64(1.0 - y), z, Float64(-y)), a, x); elseif (z <= 1700000000000.0) 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, 3.2e-195], N[(N[(N[(1.0 - y), $MachinePrecision] * z + (-y)), $MachinePrecision] * a + x), $MachinePrecision], If[LessEqual[z, 1700000000000.0], 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 3.2 \cdot 10^{-195}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(1 - y, z, -y\right), a, x\right)\\
\mathbf{elif}\;z \leq 1700000000000:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{t}, -a, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -1 or 1.7e12 < z Initial program 92.0%
Taylor expanded in z around inf
lower--.f6481.1
Applied rewrites81.1%
if -1 < z < 3.2000000000000001e-195Initial program 98.7%
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.7
Applied rewrites78.7%
Taylor expanded in z around 0
Applied rewrites78.2%
if 3.2000000000000001e-195 < z < 1.7e12Initial program 99.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.f6469.3
Applied rewrites69.3%
Taylor expanded in z around 0
Applied rewrites67.1%
(FPCore (x y z t a)
:precision binary64
(if (<= z -1.0)
(- x a)
(if (<= z 4.9e-195)
(fma (fma (- 1.0 y) z (- y)) a x)
(if (<= z 1700000000000.0) (- x (/ (* y a) t)) (- 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 <= 4.9e-195) {
tmp = fma(fma((1.0 - y), z, -y), a, x);
} else if (z <= 1700000000000.0) {
tmp = x - ((y * a) / t);
} 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 <= 4.9e-195) tmp = fma(fma(Float64(1.0 - y), z, Float64(-y)), a, x); elseif (z <= 1700000000000.0) tmp = Float64(x - Float64(Float64(y * a) / t)); 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, 4.9e-195], N[(N[(N[(1.0 - y), $MachinePrecision] * z + (-y)), $MachinePrecision] * a + x), $MachinePrecision], If[LessEqual[z, 1700000000000.0], N[(x - N[(N[(y * a), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 4.9 \cdot 10^{-195}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(1 - y, z, -y\right), a, x\right)\\
\mathbf{elif}\;z \leq 1700000000000:\\
\;\;\;\;x - \frac{y \cdot a}{t}\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -1 or 1.7e12 < z Initial program 92.0%
Taylor expanded in z around inf
lower--.f6481.1
Applied rewrites81.1%
if -1 < z < 4.9000000000000003e-195Initial program 98.7%
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.7
Applied rewrites78.7%
Taylor expanded in z around 0
Applied rewrites78.2%
if 4.9000000000000003e-195 < z < 1.7e12Initial program 99.9%
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.6
Applied rewrites88.6%
Taylor expanded in t around inf
Applied rewrites62.6%
Final simplification77.0%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma (/ (- z y) (- 1.0 z)) a x))) (if (<= z -2.15e+51) t_1 (if (<= z 340.0) (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 - y) / (1.0 - z)), a, x);
double tmp;
if (z <= -2.15e+51) {
tmp = t_1;
} else if (z <= 340.0) {
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(Float64(z - y) / Float64(1.0 - z)), a, x) tmp = 0.0 if (z <= -2.15e+51) tmp = t_1; elseif (z <= 340.0) 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[(N[(z - y), $MachinePrecision] / N[(1.0 - z), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision]}, If[LessEqual[z, -2.15e+51], t$95$1, If[LessEqual[z, 340.0], 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 - y}{1 - z}, a, x\right)\\
\mathbf{if}\;z \leq -2.15 \cdot 10^{+51}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 340:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{-1 - t}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.1499999999999999e51 or 340 < z Initial program 91.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--.f6495.3
Applied rewrites95.3%
Taylor expanded in z around 0
Applied rewrites95.3%
if -2.1499999999999999e51 < z < 340Initial program 99.1%
Taylor expanded in z around 0
sub-negN/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
distribute-neg-frac2N/A
lower-/.f64N/A
distribute-neg-inN/A
metadata-evalN/A
unsub-negN/A
lower--.f6489.9
Applied rewrites89.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma (/ z (- (- t -1.0) z)) a x)))
(if (<= z -2.5e+161)
t_1
(if (<= z 4.7e-23) (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 <= -2.5e+161) {
tmp = t_1;
} else if (z <= 4.7e-23) {
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 <= -2.5e+161) tmp = t_1; elseif (z <= 4.7e-23) 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, -2.5e+161], t$95$1, If[LessEqual[z, 4.7e-23], 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 -2.5 \cdot 10^{+161}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 4.7 \cdot 10^{-23}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{-1 - t}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.4999999999999998e161 or 4.7000000000000001e-23 < z Initial program 93.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-+.f6489.9
Applied rewrites89.9%
if -2.4999999999999998e161 < z < 4.7000000000000001e-23Initial program 97.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%
Final simplification89.4%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.5e+161) (- x a) (if (<= z 8.5e+69) (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 <= -2.5e+161) {
tmp = x - a;
} else if (z <= 8.5e+69) {
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 <= -2.5e+161) tmp = Float64(x - a); elseif (z <= 8.5e+69) 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, -2.5e+161], N[(x - a), $MachinePrecision], If[LessEqual[z, 8.5e+69], 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 -2.5 \cdot 10^{+161}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{+69}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{-1 - t}, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -2.4999999999999998e161 or 8.5000000000000002e69 < z Initial program 91.8%
Taylor expanded in z around inf
lower--.f6490.9
Applied rewrites90.9%
if -2.4999999999999998e161 < z < 8.5000000000000002e69Initial program 97.6%
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--.f6486.3
Applied rewrites86.3%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.0) (- x a) (if (<= z 32.0) (fma (fma (- 1.0 y) z (- y)) a x) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.0) {
tmp = x - a;
} else if (z <= 32.0) {
tmp = fma(fma((1.0 - y), z, -y), a, x);
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.0) tmp = Float64(x - a); elseif (z <= 32.0) tmp = fma(fma(Float64(1.0 - y), z, Float64(-y)), a, x); else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.0], N[(x - a), $MachinePrecision], If[LessEqual[z, 32.0], N[(N[(N[(1.0 - y), $MachinePrecision] * z + (-y)), $MachinePrecision] * a + x), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 32:\\
\;\;\;\;\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 32 < z Initial program 92.1%
Taylor expanded in z around inf
lower--.f6480.6
Applied rewrites80.6%
if -1 < z < 32Initial program 99.1%
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--.f6470.3
Applied rewrites70.3%
Taylor expanded in z around 0
Applied rewrites70.0%
(FPCore (x y z t a) :precision binary64 (if (<= z -6e+20) (- x a) (if (<= z 2.4e+48) (fma (- y) a x) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -6e+20) {
tmp = x - a;
} else if (z <= 2.4e+48) {
tmp = fma(-y, a, x);
} else {
tmp = x - a;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (z <= -6e+20) tmp = Float64(x - a); elseif (z <= 2.4e+48) tmp = fma(Float64(-y), a, x); else tmp = Float64(x - a); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -6e+20], N[(x - a), $MachinePrecision], If[LessEqual[z, 2.4e+48], N[((-y) * a + x), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6 \cdot 10^{+20}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 2.4 \cdot 10^{+48}:\\
\;\;\;\;\mathsf{fma}\left(-y, a, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -6e20 or 2.4000000000000001e48 < z Initial program 91.1%
Taylor expanded in z around inf
lower--.f6483.3
Applied rewrites83.3%
if -6e20 < z < 2.4000000000000001e48Initial program 99.2%
Taylor expanded in t around 0
sub-negN/A
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-fma.f64N/A
distribute-neg-fracN/A
mul-1-negN/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower--.f64N/A
lower--.f6471.8
Applied rewrites71.8%
Taylor expanded in z around 0
Applied rewrites67.2%
(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 95.7%
Taylor expanded in z around inf
lower--.f6456.1
Applied rewrites56.1%
(FPCore (x y z t a) :precision binary64 (- a))
double code(double x, double y, double z, double t, double a) {
return -a;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = -a
end function
public static double code(double x, double y, double z, double t, double a) {
return -a;
}
def code(x, y, z, t, a): return -a
function code(x, y, z, t, a) return Float64(-a) end
function tmp = code(x, y, z, t, a) tmp = -a; end
code[x_, y_, z_, t_, a_] := (-a)
\begin{array}{l}
\\
-a
\end{array}
Initial program 95.7%
Taylor expanded in z around inf
lower--.f6456.1
Applied rewrites56.1%
Taylor expanded in a around inf
Applied rewrites16.4%
(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 2024276
(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))))