
(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 11 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 98.3%
sub-neg98.3%
+-commutative98.3%
associate-/r/99.9%
distribute-lft-neg-in99.9%
fma-def99.9%
distribute-neg-frac99.9%
sub-neg99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
+-commutative99.9%
sub-neg99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- x (* y a))) (t_2 (- x (/ a (/ t y)))))
(if (<= z -3.4e+72)
(- x a)
(if (<= z -5.6e-46)
t_2
(if (<= z -2.75e-148)
(+ x (* z a))
(if (<= z -1.8e-202)
t_1
(if (<= z -9.8e-235) t_2 (if (<= z 0.000102) t_1 (- x a)))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x - (y * a);
double t_2 = x - (a / (t / y));
double tmp;
if (z <= -3.4e+72) {
tmp = x - a;
} else if (z <= -5.6e-46) {
tmp = t_2;
} else if (z <= -2.75e-148) {
tmp = x + (z * a);
} else if (z <= -1.8e-202) {
tmp = t_1;
} else if (z <= -9.8e-235) {
tmp = t_2;
} else if (z <= 0.000102) {
tmp = t_1;
} 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = x - (y * a)
t_2 = x - (a / (t / y))
if (z <= (-3.4d+72)) then
tmp = x - a
else if (z <= (-5.6d-46)) then
tmp = t_2
else if (z <= (-2.75d-148)) then
tmp = x + (z * a)
else if (z <= (-1.8d-202)) then
tmp = t_1
else if (z <= (-9.8d-235)) then
tmp = t_2
else if (z <= 0.000102d0) then
tmp = t_1
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 t_1 = x - (y * a);
double t_2 = x - (a / (t / y));
double tmp;
if (z <= -3.4e+72) {
tmp = x - a;
} else if (z <= -5.6e-46) {
tmp = t_2;
} else if (z <= -2.75e-148) {
tmp = x + (z * a);
} else if (z <= -1.8e-202) {
tmp = t_1;
} else if (z <= -9.8e-235) {
tmp = t_2;
} else if (z <= 0.000102) {
tmp = t_1;
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x - (y * a) t_2 = x - (a / (t / y)) tmp = 0 if z <= -3.4e+72: tmp = x - a elif z <= -5.6e-46: tmp = t_2 elif z <= -2.75e-148: tmp = x + (z * a) elif z <= -1.8e-202: tmp = t_1 elif z <= -9.8e-235: tmp = t_2 elif z <= 0.000102: tmp = t_1 else: tmp = x - a return tmp
function code(x, y, z, t, a) t_1 = Float64(x - Float64(y * a)) t_2 = Float64(x - Float64(a / Float64(t / y))) tmp = 0.0 if (z <= -3.4e+72) tmp = Float64(x - a); elseif (z <= -5.6e-46) tmp = t_2; elseif (z <= -2.75e-148) tmp = Float64(x + Float64(z * a)); elseif (z <= -1.8e-202) tmp = t_1; elseif (z <= -9.8e-235) tmp = t_2; elseif (z <= 0.000102) tmp = t_1; else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x - (y * a); t_2 = x - (a / (t / y)); tmp = 0.0; if (z <= -3.4e+72) tmp = x - a; elseif (z <= -5.6e-46) tmp = t_2; elseif (z <= -2.75e-148) tmp = x + (z * a); elseif (z <= -1.8e-202) tmp = t_1; elseif (z <= -9.8e-235) tmp = t_2; elseif (z <= 0.000102) tmp = t_1; else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x - N[(y * a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x - N[(a / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.4e+72], N[(x - a), $MachinePrecision], If[LessEqual[z, -5.6e-46], t$95$2, If[LessEqual[z, -2.75e-148], N[(x + N[(z * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1.8e-202], t$95$1, If[LessEqual[z, -9.8e-235], t$95$2, If[LessEqual[z, 0.000102], t$95$1, N[(x - a), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - y \cdot a\\
t_2 := x - \frac{a}{\frac{t}{y}}\\
\mathbf{if}\;z \leq -3.4 \cdot 10^{+72}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq -5.6 \cdot 10^{-46}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq -2.75 \cdot 10^{-148}:\\
\;\;\;\;x + z \cdot a\\
\mathbf{elif}\;z \leq -1.8 \cdot 10^{-202}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -9.8 \cdot 10^{-235}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq 0.000102:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -3.3999999999999998e72 or 1.01999999999999999e-4 < z Initial program 96.0%
associate-/r/99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around inf 82.3%
if -3.3999999999999998e72 < z < -5.5999999999999997e-46 or -1.8000000000000001e-202 < z < -9.79999999999999931e-235Initial program 99.8%
associate-/r/99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in t around inf 72.4%
associate-/l*82.3%
Simplified82.3%
Taylor expanded in y around inf 82.1%
if -5.5999999999999997e-46 < z < -2.7500000000000001e-148Initial program 99.7%
sub-neg99.7%
+-commutative99.7%
associate-/r/99.9%
distribute-lft-neg-in99.9%
fma-def100.0%
distribute-neg-frac100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in t around 0 84.4%
Taylor expanded in y around 0 74.8%
Taylor expanded in z around 0 74.7%
if -2.7500000000000001e-148 < z < -1.8000000000000001e-202 or -9.79999999999999931e-235 < z < 1.01999999999999999e-4Initial program 99.8%
sub-neg99.8%
+-commutative99.8%
associate-/r/99.9%
distribute-lft-neg-in99.9%
fma-def99.9%
distribute-neg-frac99.9%
sub-neg99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
+-commutative99.9%
sub-neg99.9%
Simplified99.9%
Taylor expanded in t around 0 82.2%
Taylor expanded in z around 0 78.7%
mul-1-neg78.7%
unsub-neg78.7%
Simplified78.7%
Final simplification80.4%
(FPCore (x y z t a) :precision binary64 (if (<= t -6e+18) (- x (/ a (/ t (- y z)))) (if (<= t 3.7e+27) (- x (/ a (/ (- 1.0 z) (- y z)))) (- x (/ a (/ t y))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -6e+18) {
tmp = x - (a / (t / (y - z)));
} else if (t <= 3.7e+27) {
tmp = x - (a / ((1.0 - z) / (y - z)));
} else {
tmp = x - (a / (t / 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 (t <= (-6d+18)) then
tmp = x - (a / (t / (y - z)))
else if (t <= 3.7d+27) then
tmp = x - (a / ((1.0d0 - z) / (y - z)))
else
tmp = x - (a / (t / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -6e+18) {
tmp = x - (a / (t / (y - z)));
} else if (t <= 3.7e+27) {
tmp = x - (a / ((1.0 - z) / (y - z)));
} else {
tmp = x - (a / (t / y));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -6e+18: tmp = x - (a / (t / (y - z))) elif t <= 3.7e+27: tmp = x - (a / ((1.0 - z) / (y - z))) else: tmp = x - (a / (t / y)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -6e+18) tmp = Float64(x - Float64(a / Float64(t / Float64(y - z)))); elseif (t <= 3.7e+27) tmp = Float64(x - Float64(a / Float64(Float64(1.0 - z) / Float64(y - z)))); else tmp = Float64(x - Float64(a / Float64(t / y))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -6e+18) tmp = x - (a / (t / (y - z))); elseif (t <= 3.7e+27) tmp = x - (a / ((1.0 - z) / (y - z))); else tmp = x - (a / (t / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -6e+18], N[(x - N[(a / N[(t / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.7e+27], N[(x - N[(a / N[(N[(1.0 - z), $MachinePrecision] / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(a / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6 \cdot 10^{+18}:\\
\;\;\;\;x - \frac{a}{\frac{t}{y - z}}\\
\mathbf{elif}\;t \leq 3.7 \cdot 10^{+27}:\\
\;\;\;\;x - \frac{a}{\frac{1 - z}{y - z}}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{a}{\frac{t}{y}}\\
\end{array}
\end{array}
if t < -6e18Initial program 99.9%
associate-/r/99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in t around inf 80.1%
associate-/l*92.4%
Simplified92.4%
if -6e18 < t < 3.70000000000000002e27Initial program 98.3%
associate-/r/99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in t around 0 87.9%
associate-/l*98.6%
Simplified98.6%
if 3.70000000000000002e27 < t Initial program 96.5%
associate-/r/99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in t around inf 74.6%
associate-/l*88.0%
Simplified88.0%
Taylor expanded in y around inf 88.1%
Final simplification95.0%
(FPCore (x y z t a) :precision binary64 (if (<= z -5.2e+73) (- x a) (if (<= z 0.000102) (- x (* a (/ y (+ t 1.0)))) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -5.2e+73) {
tmp = x - a;
} else if (z <= 0.000102) {
tmp = x - (a * (y / (t + 1.0)));
} 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 <= (-5.2d+73)) then
tmp = x - a
else if (z <= 0.000102d0) then
tmp = x - (a * (y / (t + 1.0d0)))
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 <= -5.2e+73) {
tmp = x - a;
} else if (z <= 0.000102) {
tmp = x - (a * (y / (t + 1.0)));
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -5.2e+73: tmp = x - a elif z <= 0.000102: tmp = x - (a * (y / (t + 1.0))) else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -5.2e+73) tmp = Float64(x - a); elseif (z <= 0.000102) tmp = Float64(x - Float64(a * Float64(y / Float64(t + 1.0)))); else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -5.2e+73) tmp = x - a; elseif (z <= 0.000102) tmp = x - (a * (y / (t + 1.0))); else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -5.2e+73], N[(x - a), $MachinePrecision], If[LessEqual[z, 0.000102], N[(x - N[(a * N[(y / N[(t + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.2 \cdot 10^{+73}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 0.000102:\\
\;\;\;\;x - a \cdot \frac{y}{t + 1}\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -5.2000000000000001e73 or 1.01999999999999999e-4 < z Initial program 96.0%
associate-/r/99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around inf 82.3%
if -5.2000000000000001e73 < z < 1.01999999999999999e-4Initial program 99.8%
associate-/r/99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around 0 91.2%
Final simplification87.5%
(FPCore (x y z t a) :precision binary64 (if (<= z -26000000000.0) (+ x (/ (- z y) (/ (- z) a))) (if (<= z 0.000102) (- x (* a (/ y (+ t 1.0)))) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -26000000000.0) {
tmp = x + ((z - y) / (-z / a));
} else if (z <= 0.000102) {
tmp = x - (a * (y / (t + 1.0)));
} 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 <= (-26000000000.0d0)) then
tmp = x + ((z - y) / (-z / a))
else if (z <= 0.000102d0) then
tmp = x - (a * (y / (t + 1.0d0)))
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 <= -26000000000.0) {
tmp = x + ((z - y) / (-z / a));
} else if (z <= 0.000102) {
tmp = x - (a * (y / (t + 1.0)));
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -26000000000.0: tmp = x + ((z - y) / (-z / a)) elif z <= 0.000102: tmp = x - (a * (y / (t + 1.0))) else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -26000000000.0) tmp = Float64(x + Float64(Float64(z - y) / Float64(Float64(-z) / a))); elseif (z <= 0.000102) tmp = Float64(x - Float64(a * Float64(y / Float64(t + 1.0)))); else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -26000000000.0) tmp = x + ((z - y) / (-z / a)); elseif (z <= 0.000102) tmp = x - (a * (y / (t + 1.0))); else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -26000000000.0], N[(x + N[(N[(z - y), $MachinePrecision] / N[((-z) / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.000102], N[(x - N[(a * N[(y / N[(t + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -26000000000:\\
\;\;\;\;x + \frac{z - y}{\frac{-z}{a}}\\
\mathbf{elif}\;z \leq 0.000102:\\
\;\;\;\;x - a \cdot \frac{y}{t + 1}\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -2.6e10Initial program 98.0%
Taylor expanded in z around inf 88.9%
mul-1-neg88.9%
distribute-neg-frac88.9%
Simplified88.9%
if -2.6e10 < z < 1.01999999999999999e-4Initial program 99.8%
associate-/r/99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around 0 93.1%
if 1.01999999999999999e-4 < z Initial program 94.2%
associate-/r/100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in z around inf 83.4%
Final simplification90.1%
(FPCore (x y z t a) :precision binary64 (+ x (* a (/ (- z y) (+ (- t z) 1.0)))))
double code(double x, double y, double z, double t, double a) {
return x + (a * ((z - y) / ((t - z) + 1.0)));
}
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 - y) / ((t - z) + 1.0d0)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (a * ((z - y) / ((t - z) + 1.0)));
}
def code(x, y, z, t, a): return x + (a * ((z - y) / ((t - z) + 1.0)))
function code(x, y, z, t, a) return Float64(x + Float64(a * Float64(Float64(z - y) / Float64(Float64(t - z) + 1.0)))) end
function tmp = code(x, y, z, t, a) tmp = x + (a * ((z - y) / ((t - z) + 1.0))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(a * N[(N[(z - y), $MachinePrecision] / N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + a \cdot \frac{z - y}{\left(t - z\right) + 1}
\end{array}
Initial program 98.3%
associate-/r/99.9%
*-commutative99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z t a) :precision binary64 (if (<= z -3.25e-9) (- x a) (if (<= z 1.9e-52) (+ x (* z a)) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.25e-9) {
tmp = x - a;
} else if (z <= 1.9e-52) {
tmp = x + (z * a);
} 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 <= (-3.25d-9)) then
tmp = x - a
else if (z <= 1.9d-52) then
tmp = x + (z * a)
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 <= -3.25e-9) {
tmp = x - a;
} else if (z <= 1.9e-52) {
tmp = x + (z * a);
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -3.25e-9: tmp = x - a elif z <= 1.9e-52: tmp = x + (z * a) else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.25e-9) tmp = Float64(x - a); elseif (z <= 1.9e-52) tmp = Float64(x + Float64(z * a)); else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -3.25e-9) tmp = x - a; elseif (z <= 1.9e-52) tmp = x + (z * a); else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.25e-9], N[(x - a), $MachinePrecision], If[LessEqual[z, 1.9e-52], N[(x + N[(z * a), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.25 \cdot 10^{-9}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 1.9 \cdot 10^{-52}:\\
\;\;\;\;x + z \cdot a\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -3.2500000000000002e-9 or 1.9000000000000002e-52 < z Initial program 96.7%
associate-/r/99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around inf 78.2%
if -3.2500000000000002e-9 < z < 1.9000000000000002e-52Initial program 99.8%
sub-neg99.8%
+-commutative99.8%
associate-/r/99.9%
distribute-lft-neg-in99.9%
fma-def99.9%
distribute-neg-frac99.9%
sub-neg99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
+-commutative99.9%
sub-neg99.9%
Simplified99.9%
Taylor expanded in t around 0 77.0%
Taylor expanded in y around 0 59.9%
Taylor expanded in z around 0 59.9%
Final simplification69.2%
(FPCore (x y z t a) :precision binary64 (if (<= z -3.6e+50) (- x a) (if (<= z 0.0001) (- x (* y a)) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.6e+50) {
tmp = x - a;
} else if (z <= 0.0001) {
tmp = x - (y * a);
} 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 <= (-3.6d+50)) then
tmp = x - a
else if (z <= 0.0001d0) then
tmp = x - (y * a)
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 <= -3.6e+50) {
tmp = x - a;
} else if (z <= 0.0001) {
tmp = x - (y * a);
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -3.6e+50: tmp = x - a elif z <= 0.0001: tmp = x - (y * a) else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.6e+50) tmp = Float64(x - a); elseif (z <= 0.0001) tmp = Float64(x - Float64(y * a)); else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -3.6e+50) tmp = x - a; elseif (z <= 0.0001) tmp = x - (y * a); else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.6e+50], N[(x - a), $MachinePrecision], If[LessEqual[z, 0.0001], N[(x - N[(y * a), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.6 \cdot 10^{+50}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 0.0001:\\
\;\;\;\;x - y \cdot a\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -3.59999999999999986e50 or 1.00000000000000005e-4 < z Initial program 96.1%
associate-/r/99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around inf 81.8%
if -3.59999999999999986e50 < z < 1.00000000000000005e-4Initial program 99.8%
sub-neg99.8%
+-commutative99.8%
associate-/r/99.9%
distribute-lft-neg-in99.9%
fma-def99.9%
distribute-neg-frac99.9%
sub-neg99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
+-commutative99.9%
sub-neg99.9%
Simplified99.9%
Taylor expanded in t around 0 78.0%
Taylor expanded in z around 0 72.4%
mul-1-neg72.4%
unsub-neg72.4%
Simplified72.4%
Final simplification76.3%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.8e-9) (- x a) (if (<= z 620000000.0) x (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.8e-9) {
tmp = x - a;
} else if (z <= 620000000.0) {
tmp = 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.8d-9)) then
tmp = x - a
else if (z <= 620000000.0d0) then
tmp = 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.8e-9) {
tmp = x - a;
} else if (z <= 620000000.0) {
tmp = x;
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.8e-9: tmp = x - a elif z <= 620000000.0: tmp = x else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.8e-9) tmp = Float64(x - a); elseif (z <= 620000000.0) tmp = 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.8e-9) tmp = x - a; elseif (z <= 620000000.0) tmp = x; else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.8e-9], N[(x - a), $MachinePrecision], If[LessEqual[z, 620000000.0], x, N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.8 \cdot 10^{-9}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 620000000:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -1.8e-9 or 6.2e8 < z Initial program 96.4%
associate-/r/99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around inf 78.9%
if -1.8e-9 < z < 6.2e8Initial program 99.8%
associate-/r/99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in x around inf 60.0%
Final simplification68.6%
(FPCore (x y z t a) :precision binary64 (if (<= a -1.2e+135) (- a) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.2e+135) {
tmp = -a;
} else {
tmp = x;
}
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 (a <= (-1.2d+135)) then
tmp = -a
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.2e+135) {
tmp = -a;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -1.2e+135: tmp = -a else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.2e+135) tmp = Float64(-a); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -1.2e+135) tmp = -a; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.2e+135], (-a), x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.2 \cdot 10^{+135}:\\
\;\;\;\;-a\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -1.19999999999999999e135Initial program 99.8%
associate-/r/99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in a around inf 89.7%
associate--l+89.7%
+-commutative89.7%
associate--l+89.7%
+-commutative89.7%
div-sub89.7%
+-commutative89.7%
Simplified89.7%
Taylor expanded in z around inf 36.4%
neg-mul-136.4%
Simplified36.4%
if -1.19999999999999999e135 < a Initial program 98.0%
associate-/r/99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in x around inf 67.1%
Final simplification62.2%
(FPCore (x y z t a) :precision binary64 x)
double code(double x, double y, double z, double t, double a) {
return x;
}
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
end function
public static double code(double x, double y, double z, double t, double a) {
return x;
}
def code(x, y, z, t, a): return x
function code(x, y, z, t, a) return x end
function tmp = code(x, y, z, t, a) tmp = x; end
code[x_, y_, z_, t_, a_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 98.3%
associate-/r/99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in x around inf 58.3%
Final simplification58.3%
(FPCore (x y z t a) :precision binary64 (- x (* (/ (- y z) (+ (- t z) 1.0)) a)))
double code(double x, double y, double z, double t, double a) {
return x - (((y - z) / ((t - z) + 1.0)) * a);
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x - (((y - z) / ((t - z) + 1.0d0)) * a)
end function
public static double code(double x, double y, double z, double t, double a) {
return x - (((y - z) / ((t - z) + 1.0)) * a);
}
def code(x, y, z, t, a): return x - (((y - z) / ((t - z) + 1.0)) * a)
function code(x, y, z, t, a) return Float64(x - Float64(Float64(Float64(y - z) / Float64(Float64(t - z) + 1.0)) * a)) end
function tmp = code(x, y, z, t, a) tmp = x - (((y - z) / ((t - z) + 1.0)) * a); end
code[x_, y_, z_, t_, a_] := N[(x - N[(N[(N[(y - z), $MachinePrecision] / N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y - z}{\left(t - z\right) + 1} \cdot a
\end{array}
herbie shell --seed 2023279
(FPCore (x y z t a)
:name "Graphics.Rendering.Chart.SparkLine:renderSparkLine from Chart-1.5.3"
:precision binary64
:herbie-target
(- x (* (/ (- y z) (+ (- t z) 1.0)) a))
(- x (/ (- y z) (/ (+ (- t z) 1.0) a))))