
(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 (/ (- y z) (+ -1.0 (- z t))) a x))
double code(double x, double y, double z, double t, double a) {
return fma(((y - z) / (-1.0 + (z - t))), a, x);
}
function code(x, y, z, t, a) return fma(Float64(Float64(y - z) / Float64(-1.0 + Float64(z - t))), a, x) end
code[x_, y_, z_, t_, a_] := N[(N[(N[(y - z), $MachinePrecision] / N[(-1.0 + N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * a + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{y - z}{-1 + \left(z - t\right)}, a, x\right)
\end{array}
Initial program 97.6%
sub-neg97.6%
+-commutative97.6%
associate-/r/99.2%
distribute-lft-neg-in99.2%
fma-define99.2%
distribute-neg-frac299.2%
distribute-neg-in99.2%
sub-neg99.2%
distribute-neg-in99.2%
remove-double-neg99.2%
+-commutative99.2%
sub-neg99.2%
metadata-eval99.2%
Simplified99.2%
Final simplification99.2%
(FPCore (x y z t a)
:precision binary64
(if (<= t -1.2e+38)
(+ x (* a (/ z (- (+ t 1.0) z))))
(if (<= t 6.5e+54)
(+ x (* a (/ (- y z) (+ z -1.0))))
(- x (/ (- y z) (/ t a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.2e+38) {
tmp = x + (a * (z / ((t + 1.0) - z)));
} else if (t <= 6.5e+54) {
tmp = x + (a * ((y - z) / (z + -1.0)));
} else {
tmp = x - ((y - z) / (t / 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 (t <= (-1.2d+38)) then
tmp = x + (a * (z / ((t + 1.0d0) - z)))
else if (t <= 6.5d+54) then
tmp = x + (a * ((y - z) / (z + (-1.0d0))))
else
tmp = x - ((y - z) / (t / a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.2e+38) {
tmp = x + (a * (z / ((t + 1.0) - z)));
} else if (t <= 6.5e+54) {
tmp = x + (a * ((y - z) / (z + -1.0)));
} else {
tmp = x - ((y - z) / (t / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -1.2e+38: tmp = x + (a * (z / ((t + 1.0) - z))) elif t <= 6.5e+54: tmp = x + (a * ((y - z) / (z + -1.0))) else: tmp = x - ((y - z) / (t / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.2e+38) tmp = Float64(x + Float64(a * Float64(z / Float64(Float64(t + 1.0) - z)))); elseif (t <= 6.5e+54) tmp = Float64(x + Float64(a * Float64(Float64(y - z) / Float64(z + -1.0)))); else tmp = Float64(x - Float64(Float64(y - z) / Float64(t / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -1.2e+38) tmp = x + (a * (z / ((t + 1.0) - z))); elseif (t <= 6.5e+54) tmp = x + (a * ((y - z) / (z + -1.0))); else tmp = x - ((y - z) / (t / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.2e+38], N[(x + N[(a * N[(z / N[(N[(t + 1.0), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 6.5e+54], N[(x + N[(a * N[(N[(y - z), $MachinePrecision] / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(y - z), $MachinePrecision] / N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.2 \cdot 10^{+38}:\\
\;\;\;\;x + a \cdot \frac{z}{\left(t + 1\right) - z}\\
\mathbf{elif}\;t \leq 6.5 \cdot 10^{+54}:\\
\;\;\;\;x + a \cdot \frac{y - z}{z + -1}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y - z}{\frac{t}{a}}\\
\end{array}
\end{array}
if t < -1.20000000000000009e38Initial program 97.8%
sub-neg97.8%
+-commutative97.8%
associate-/r/99.9%
distribute-lft-neg-in99.9%
fma-define99.9%
distribute-neg-frac299.9%
distribute-neg-in99.9%
sub-neg99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
+-commutative99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around 0 79.2%
mul-1-neg79.2%
unsub-neg79.2%
associate-/l*89.2%
sub-neg89.2%
mul-1-neg89.2%
distribute-lft-in89.2%
metadata-eval89.2%
mul-1-neg89.2%
unsub-neg89.2%
Simplified89.2%
if -1.20000000000000009e38 < t < 6.5e54Initial program 97.3%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in t around 0 98.7%
if 6.5e54 < t Initial program 98.3%
Taylor expanded in t around inf 90.0%
Final simplification94.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2.8e+17) (not (<= z 8.2e+48))) (+ x (/ (- y z) (/ z a))) (+ x (* a (/ y (- -1.0 t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.8e+17) || !(z <= 8.2e+48)) {
tmp = x + ((y - z) / (z / a));
} else {
tmp = x + (a * (y / (-1.0 - t)));
}
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 <= (-2.8d+17)) .or. (.not. (z <= 8.2d+48))) then
tmp = x + ((y - z) / (z / a))
else
tmp = x + (a * (y / ((-1.0d0) - t)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.8e+17) || !(z <= 8.2e+48)) {
tmp = x + ((y - z) / (z / a));
} else {
tmp = x + (a * (y / (-1.0 - t)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -2.8e+17) or not (z <= 8.2e+48): tmp = x + ((y - z) / (z / a)) else: tmp = x + (a * (y / (-1.0 - t))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2.8e+17) || !(z <= 8.2e+48)) tmp = Float64(x + Float64(Float64(y - z) / Float64(z / a))); else tmp = Float64(x + Float64(a * Float64(y / Float64(-1.0 - t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -2.8e+17) || ~((z <= 8.2e+48))) tmp = x + ((y - z) / (z / a)); else tmp = x + (a * (y / (-1.0 - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2.8e+17], N[Not[LessEqual[z, 8.2e+48]], $MachinePrecision]], N[(x + N[(N[(y - z), $MachinePrecision] / N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(a * N[(y / N[(-1.0 - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.8 \cdot 10^{+17} \lor \neg \left(z \leq 8.2 \cdot 10^{+48}\right):\\
\;\;\;\;x + \frac{y - z}{\frac{z}{a}}\\
\mathbf{else}:\\
\;\;\;\;x + a \cdot \frac{y}{-1 - t}\\
\end{array}
\end{array}
if z < -2.8e17 or 8.2000000000000005e48 < z Initial program 94.8%
Taylor expanded in z around inf 87.5%
associate-*r/87.5%
neg-mul-187.5%
Simplified87.5%
if -2.8e17 < z < 8.2000000000000005e48Initial program 99.8%
associate-/r/98.6%
Simplified98.6%
Taylor expanded in z around 0 89.2%
Final simplification88.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -3.2e+18) (not (<= z 3.4e+39))) (- x a) (+ x (* a (/ y (- -1.0 t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -3.2e+18) || !(z <= 3.4e+39)) {
tmp = x - a;
} else {
tmp = x + (a * (y / (-1.0 - t)));
}
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.2d+18)) .or. (.not. (z <= 3.4d+39))) then
tmp = x - a
else
tmp = x + (a * (y / ((-1.0d0) - t)))
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.2e+18) || !(z <= 3.4e+39)) {
tmp = x - a;
} else {
tmp = x + (a * (y / (-1.0 - t)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -3.2e+18) or not (z <= 3.4e+39): tmp = x - a else: tmp = x + (a * (y / (-1.0 - t))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -3.2e+18) || !(z <= 3.4e+39)) tmp = Float64(x - a); else tmp = Float64(x + Float64(a * Float64(y / Float64(-1.0 - t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -3.2e+18) || ~((z <= 3.4e+39))) tmp = x - a; else tmp = x + (a * (y / (-1.0 - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -3.2e+18], N[Not[LessEqual[z, 3.4e+39]], $MachinePrecision]], N[(x - a), $MachinePrecision], N[(x + N[(a * N[(y / N[(-1.0 - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.2 \cdot 10^{+18} \lor \neg \left(z \leq 3.4 \cdot 10^{+39}\right):\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;x + a \cdot \frac{y}{-1 - t}\\
\end{array}
\end{array}
if z < -3.2e18 or 3.3999999999999999e39 < z Initial program 94.9%
associate-/r/100.0%
Simplified100.0%
Taylor expanded in z around inf 82.7%
if -3.2e18 < z < 3.3999999999999999e39Initial program 99.8%
associate-/r/98.6%
Simplified98.6%
Taylor expanded in z around 0 89.0%
Final simplification86.2%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.2e-36) (+ x (* a (/ z (- (+ t 1.0) z)))) (if (<= z 8.2e+48) (+ x (* a (/ y (- -1.0 t)))) (+ x (/ (- y z) (/ z a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.2e-36) {
tmp = x + (a * (z / ((t + 1.0) - z)));
} else if (z <= 8.2e+48) {
tmp = x + (a * (y / (-1.0 - t)));
} else {
tmp = x + ((y - z) / (z / 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 <= (-2.2d-36)) then
tmp = x + (a * (z / ((t + 1.0d0) - z)))
else if (z <= 8.2d+48) then
tmp = x + (a * (y / ((-1.0d0) - t)))
else
tmp = x + ((y - z) / (z / 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 <= -2.2e-36) {
tmp = x + (a * (z / ((t + 1.0) - z)));
} else if (z <= 8.2e+48) {
tmp = x + (a * (y / (-1.0 - t)));
} else {
tmp = x + ((y - z) / (z / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.2e-36: tmp = x + (a * (z / ((t + 1.0) - z))) elif z <= 8.2e+48: tmp = x + (a * (y / (-1.0 - t))) else: tmp = x + ((y - z) / (z / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.2e-36) tmp = Float64(x + Float64(a * Float64(z / Float64(Float64(t + 1.0) - z)))); elseif (z <= 8.2e+48) tmp = Float64(x + Float64(a * Float64(y / Float64(-1.0 - t)))); else tmp = Float64(x + Float64(Float64(y - z) / Float64(z / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -2.2e-36) tmp = x + (a * (z / ((t + 1.0) - z))); elseif (z <= 8.2e+48) tmp = x + (a * (y / (-1.0 - t))); else tmp = x + ((y - z) / (z / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.2e-36], N[(x + N[(a * N[(z / N[(N[(t + 1.0), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8.2e+48], N[(x + N[(a * N[(y / N[(-1.0 - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y - z), $MachinePrecision] / N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.2 \cdot 10^{-36}:\\
\;\;\;\;x + a \cdot \frac{z}{\left(t + 1\right) - z}\\
\mathbf{elif}\;z \leq 8.2 \cdot 10^{+48}:\\
\;\;\;\;x + a \cdot \frac{y}{-1 - t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y - z}{\frac{z}{a}}\\
\end{array}
\end{array}
if z < -2.1999999999999999e-36Initial program 98.4%
sub-neg98.4%
+-commutative98.4%
associate-/r/99.9%
distribute-lft-neg-in99.9%
fma-define99.9%
distribute-neg-frac299.9%
distribute-neg-in99.9%
sub-neg99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
+-commutative99.9%
sub-neg99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around 0 70.5%
mul-1-neg70.5%
unsub-neg70.5%
associate-/l*91.1%
sub-neg91.1%
mul-1-neg91.1%
distribute-lft-in91.1%
metadata-eval91.1%
mul-1-neg91.1%
unsub-neg91.1%
Simplified91.1%
if -2.1999999999999999e-36 < z < 8.2000000000000005e48Initial program 99.8%
associate-/r/98.5%
Simplified98.5%
Taylor expanded in z around 0 91.6%
if 8.2000000000000005e48 < z Initial program 91.4%
Taylor expanded in z around inf 89.4%
associate-*r/89.4%
neg-mul-189.4%
Simplified89.4%
Final simplification91.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1e+19) (not (<= z 0.0085))) (- x a) (- x (* y a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1e+19) || !(z <= 0.0085)) {
tmp = x - a;
} else {
tmp = x - (y * 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 <= (-1d+19)) .or. (.not. (z <= 0.0085d0))) then
tmp = x - a
else
tmp = x - (y * 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 <= -1e+19) || !(z <= 0.0085)) {
tmp = x - a;
} else {
tmp = x - (y * a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1e+19) or not (z <= 0.0085): tmp = x - a else: tmp = x - (y * a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1e+19) || !(z <= 0.0085)) tmp = Float64(x - a); else tmp = Float64(x - Float64(y * a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1e+19) || ~((z <= 0.0085))) tmp = x - a; else tmp = x - (y * a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1e+19], N[Not[LessEqual[z, 0.0085]], $MachinePrecision]], N[(x - a), $MachinePrecision], N[(x - N[(y * a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{+19} \lor \neg \left(z \leq 0.0085\right):\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;x - y \cdot a\\
\end{array}
\end{array}
if z < -1e19 or 0.0085000000000000006 < z Initial program 95.4%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around inf 80.3%
if -1e19 < z < 0.0085000000000000006Initial program 99.9%
associate-/r/98.5%
Simplified98.5%
Taylor expanded in t around 0 82.3%
Taylor expanded in z around 0 77.5%
Final simplification78.9%
(FPCore (x y z t a) :precision binary64 (if (<= z -3.7e-115) (+ x (* a (/ z (- 1.0 z)))) (if (<= z 0.000105) (- x (* y a)) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.7e-115) {
tmp = x + (a * (z / (1.0 - z)));
} else if (z <= 0.000105) {
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.7d-115)) then
tmp = x + (a * (z / (1.0d0 - z)))
else if (z <= 0.000105d0) 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.7e-115) {
tmp = x + (a * (z / (1.0 - z)));
} else if (z <= 0.000105) {
tmp = x - (y * a);
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -3.7e-115: tmp = x + (a * (z / (1.0 - z))) elif z <= 0.000105: tmp = x - (y * a) else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.7e-115) tmp = Float64(x + Float64(a * Float64(z / Float64(1.0 - z)))); elseif (z <= 0.000105) 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.7e-115) tmp = x + (a * (z / (1.0 - z))); elseif (z <= 0.000105) tmp = x - (y * a); else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.7e-115], N[(x + N[(a * N[(z / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.000105], N[(x - N[(y * a), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.7 \cdot 10^{-115}:\\
\;\;\;\;x + a \cdot \frac{z}{1 - z}\\
\mathbf{elif}\;z \leq 0.000105:\\
\;\;\;\;x - y \cdot a\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -3.7e-115Initial program 98.6%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in t around 0 84.1%
Taylor expanded in y around 0 64.4%
sub-neg64.4%
mul-1-neg64.4%
remove-double-neg64.4%
associate-/l*78.6%
Simplified78.6%
if -3.7e-115 < z < 1.05e-4Initial program 99.9%
associate-/r/98.1%
Simplified98.1%
Taylor expanded in t around 0 83.5%
Taylor expanded in z around 0 81.0%
if 1.05e-4 < z Initial program 93.3%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around inf 78.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2.1e-12) (not (<= z 8.8e+39))) (- x a) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.1e-12) || !(z <= 8.8e+39)) {
tmp = x - 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 ((z <= (-2.1d-12)) .or. (.not. (z <= 8.8d+39))) then
tmp = x - 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 ((z <= -2.1e-12) || !(z <= 8.8e+39)) {
tmp = x - a;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -2.1e-12) or not (z <= 8.8e+39): tmp = x - a else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2.1e-12) || !(z <= 8.8e+39)) tmp = Float64(x - a); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -2.1e-12) || ~((z <= 8.8e+39))) tmp = x - a; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2.1e-12], N[Not[LessEqual[z, 8.8e+39]], $MachinePrecision]], N[(x - a), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.1 \cdot 10^{-12} \lor \neg \left(z \leq 8.8 \cdot 10^{+39}\right):\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2.09999999999999994e-12 or 8.8000000000000006e39 < z Initial program 95.2%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around inf 80.7%
if -2.09999999999999994e-12 < z < 8.8000000000000006e39Initial program 99.8%
sub-neg99.8%
+-commutative99.8%
associate-/r/98.5%
distribute-lft-neg-in98.5%
fma-define98.5%
distribute-neg-frac298.5%
distribute-neg-in98.5%
sub-neg98.5%
distribute-neg-in98.5%
remove-double-neg98.5%
+-commutative98.5%
sub-neg98.5%
metadata-eval98.5%
Simplified98.5%
Taylor expanded in t around inf 65.3%
Final simplification72.6%
(FPCore (x y z t a) :precision binary64 (+ x (* a (/ (- y z) (+ -1.0 (- z t))))))
double code(double x, double y, double z, double t, double a) {
return x + (a * ((y - z) / (-1.0 + (z - t))));
}
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 * ((y - z) / ((-1.0d0) + (z - t))))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (a * ((y - z) / (-1.0 + (z - t))));
}
def code(x, y, z, t, a): return x + (a * ((y - z) / (-1.0 + (z - t))))
function code(x, y, z, t, a) return Float64(x + Float64(a * Float64(Float64(y - z) / Float64(-1.0 + Float64(z - t))))) end
function tmp = code(x, y, z, t, a) tmp = x + (a * ((y - z) / (-1.0 + (z - t)))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(a * N[(N[(y - z), $MachinePrecision] / N[(-1.0 + N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + a \cdot \frac{y - z}{-1 + \left(z - t\right)}
\end{array}
Initial program 97.6%
associate-/r/99.2%
Simplified99.2%
Final simplification99.2%
(FPCore (x y z t a) :precision binary64 (if (<= a 8e+211) x (- a)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= 8e+211) {
tmp = x;
} else {
tmp = -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 (a <= 8d+211) then
tmp = x
else
tmp = -a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= 8e+211) {
tmp = x;
} else {
tmp = -a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= 8e+211: tmp = x else: tmp = -a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= 8e+211) tmp = x; else tmp = Float64(-a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= 8e+211) tmp = x; else tmp = -a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, 8e+211], x, (-a)]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 8 \cdot 10^{+211}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;-a\\
\end{array}
\end{array}
if a < 7.9999999999999997e211Initial program 97.5%
sub-neg97.5%
+-commutative97.5%
associate-/r/99.5%
distribute-lft-neg-in99.5%
fma-define99.5%
distribute-neg-frac299.5%
distribute-neg-in99.5%
sub-neg99.5%
distribute-neg-in99.5%
remove-double-neg99.5%
+-commutative99.5%
sub-neg99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in t around inf 64.8%
if 7.9999999999999997e211 < a Initial program 99.7%
associate-/r/94.4%
Simplified94.4%
Taylor expanded in z around inf 47.2%
Taylor expanded in x around 0 41.7%
neg-mul-141.7%
Simplified41.7%
(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 97.6%
sub-neg97.6%
+-commutative97.6%
associate-/r/99.2%
distribute-lft-neg-in99.2%
fma-define99.2%
distribute-neg-frac299.2%
distribute-neg-in99.2%
sub-neg99.2%
distribute-neg-in99.2%
remove-double-neg99.2%
+-commutative99.2%
sub-neg99.2%
metadata-eval99.2%
Simplified99.2%
Taylor expanded in t around inf 61.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 2024129
(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))))