
(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 10 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 a (/ (- z y) (+ (- t z) 1.0)) x))
double code(double x, double y, double z, double t, double a) {
return fma(a, ((z - y) / ((t - z) + 1.0)), x);
}
function code(x, y, z, t, a) return fma(a, Float64(Float64(z - y) / Float64(Float64(t - z) + 1.0)), x) end
code[x_, y_, z_, t_, a_] := N[(a * N[(N[(z - y), $MachinePrecision] / N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(a, \frac{z - y}{\left(t - z\right) + 1}, x\right)
\end{array}
Initial program 96.1%
sub-neg96.1%
+-commutative96.1%
associate-/r/99.2%
*-commutative99.2%
distribute-rgt-neg-in99.2%
fma-def99.2%
div-sub99.2%
sub-neg99.2%
+-commutative99.2%
distribute-neg-in99.2%
remove-double-neg99.2%
sub-neg99.2%
div-sub99.2%
Simplified99.2%
Final simplification99.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- x (* a y))))
(if (<= z -3e+16)
(- x a)
(if (<= z 5.6e-226)
t_1
(if (<= z 3e-203)
(- x (/ (* a y) t))
(if (<= z 2.3e+21) t_1 (- x a)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x - (a * y);
double tmp;
if (z <= -3e+16) {
tmp = x - a;
} else if (z <= 5.6e-226) {
tmp = t_1;
} else if (z <= 3e-203) {
tmp = x - ((a * y) / t);
} else if (z <= 2.3e+21) {
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) :: tmp
t_1 = x - (a * y)
if (z <= (-3d+16)) then
tmp = x - a
else if (z <= 5.6d-226) then
tmp = t_1
else if (z <= 3d-203) then
tmp = x - ((a * y) / t)
else if (z <= 2.3d+21) 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 - (a * y);
double tmp;
if (z <= -3e+16) {
tmp = x - a;
} else if (z <= 5.6e-226) {
tmp = t_1;
} else if (z <= 3e-203) {
tmp = x - ((a * y) / t);
} else if (z <= 2.3e+21) {
tmp = t_1;
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x - (a * y) tmp = 0 if z <= -3e+16: tmp = x - a elif z <= 5.6e-226: tmp = t_1 elif z <= 3e-203: tmp = x - ((a * y) / t) elif z <= 2.3e+21: tmp = t_1 else: tmp = x - a return tmp
function code(x, y, z, t, a) t_1 = Float64(x - Float64(a * y)) tmp = 0.0 if (z <= -3e+16) tmp = Float64(x - a); elseif (z <= 5.6e-226) tmp = t_1; elseif (z <= 3e-203) tmp = Float64(x - Float64(Float64(a * y) / t)); elseif (z <= 2.3e+21) tmp = t_1; else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x - (a * y); tmp = 0.0; if (z <= -3e+16) tmp = x - a; elseif (z <= 5.6e-226) tmp = t_1; elseif (z <= 3e-203) tmp = x - ((a * y) / t); elseif (z <= 2.3e+21) 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[(a * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3e+16], N[(x - a), $MachinePrecision], If[LessEqual[z, 5.6e-226], t$95$1, If[LessEqual[z, 3e-203], N[(x - N[(N[(a * y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.3e+21], t$95$1, N[(x - a), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - a \cdot y\\
\mathbf{if}\;z \leq -3 \cdot 10^{+16}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 5.6 \cdot 10^{-226}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 3 \cdot 10^{-203}:\\
\;\;\;\;x - \frac{a \cdot y}{t}\\
\mathbf{elif}\;z \leq 2.3 \cdot 10^{+21}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -3e16 or 2.3e21 < z Initial program 92.0%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around inf 82.4%
if -3e16 < z < 5.60000000000000016e-226 or 3.0000000000000001e-203 < z < 2.3e21Initial program 99.8%
associate-/r/99.2%
Simplified99.2%
associate-/r/99.8%
div-inv99.7%
associate-/r*99.0%
+-commutative99.0%
associate-+r-99.0%
Applied egg-rr99.0%
Taylor expanded in z around 0 91.2%
Taylor expanded in t around 0 76.4%
if 5.60000000000000016e-226 < z < 3.0000000000000001e-203Initial program 99.6%
associate-/r/88.5%
Simplified88.5%
Taylor expanded in t around inf 88.5%
Taylor expanded in y around inf 99.8%
Final simplification79.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2.4e+17) (not (<= z 3e+63))) (- x a) (- x (* a (/ y (+ t 1.0))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.4e+17) || !(z <= 3e+63)) {
tmp = x - a;
} else {
tmp = x - (a * (y / (t + 1.0)));
}
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.4d+17)) .or. (.not. (z <= 3d+63))) then
tmp = x - a
else
tmp = x - (a * (y / (t + 1.0d0)))
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.4e+17) || !(z <= 3e+63)) {
tmp = x - a;
} else {
tmp = x - (a * (y / (t + 1.0)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -2.4e+17) or not (z <= 3e+63): tmp = x - a else: tmp = x - (a * (y / (t + 1.0))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2.4e+17) || !(z <= 3e+63)) tmp = Float64(x - a); else tmp = Float64(x - Float64(a * Float64(y / Float64(t + 1.0)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -2.4e+17) || ~((z <= 3e+63))) tmp = x - a; else tmp = x - (a * (y / (t + 1.0))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2.4e+17], N[Not[LessEqual[z, 3e+63]], $MachinePrecision]], N[(x - a), $MachinePrecision], N[(x - N[(a * N[(y / N[(t + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.4 \cdot 10^{+17} \lor \neg \left(z \leq 3 \cdot 10^{+63}\right):\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;x - a \cdot \frac{y}{t + 1}\\
\end{array}
\end{array}
if z < -2.4e17 or 2.99999999999999999e63 < z Initial program 91.1%
associate-/r/100.0%
Simplified100.0%
Taylor expanded in z around inf 85.4%
if -2.4e17 < z < 2.99999999999999999e63Initial program 99.8%
associate-/r/98.7%
Simplified98.7%
Taylor expanded in z around 0 91.3%
Final simplification88.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.65e+18) (not (<= z 1.05e+66))) (- x a) (- x (/ y (/ (+ t 1.0) a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.65e+18) || !(z <= 1.05e+66)) {
tmp = x - a;
} else {
tmp = x - (y / ((t + 1.0) / 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.65d+18)) .or. (.not. (z <= 1.05d+66))) then
tmp = x - a
else
tmp = x - (y / ((t + 1.0d0) / 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.65e+18) || !(z <= 1.05e+66)) {
tmp = x - a;
} else {
tmp = x - (y / ((t + 1.0) / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.65e+18) or not (z <= 1.05e+66): tmp = x - a else: tmp = x - (y / ((t + 1.0) / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.65e+18) || !(z <= 1.05e+66)) tmp = Float64(x - a); else tmp = Float64(x - Float64(y / Float64(Float64(t + 1.0) / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.65e+18) || ~((z <= 1.05e+66))) tmp = x - a; else tmp = x - (y / ((t + 1.0) / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.65e+18], N[Not[LessEqual[z, 1.05e+66]], $MachinePrecision]], N[(x - a), $MachinePrecision], N[(x - N[(y / N[(N[(t + 1.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.65 \cdot 10^{+18} \lor \neg \left(z \leq 1.05 \cdot 10^{+66}\right):\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{\frac{t + 1}{a}}\\
\end{array}
\end{array}
if z < -1.65e18 or 1.05000000000000003e66 < z Initial program 91.1%
associate-/r/100.0%
Simplified100.0%
Taylor expanded in z around inf 85.4%
if -1.65e18 < z < 1.05000000000000003e66Initial program 99.8%
associate-/r/98.7%
Simplified98.7%
associate-/r/99.8%
div-inv99.7%
associate-/r*98.5%
+-commutative98.5%
associate-+r-98.5%
Applied egg-rr98.5%
Taylor expanded in z around 0 88.9%
*-commutative88.9%
associate-/l*92.4%
Simplified92.4%
Final simplification89.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.2e+18) (not (<= z 3.5e+63))) (- (+ x (/ a (/ z y))) a) (- x (/ y (/ (+ t 1.0) a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.2e+18) || !(z <= 3.5e+63)) {
tmp = (x + (a / (z / y))) - a;
} else {
tmp = x - (y / ((t + 1.0) / a));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-1.2d+18)) .or. (.not. (z <= 3.5d+63))) then
tmp = (x + (a / (z / y))) - a
else
tmp = x - (y / ((t + 1.0d0) / a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.2e+18) || !(z <= 3.5e+63)) {
tmp = (x + (a / (z / y))) - a;
} else {
tmp = x - (y / ((t + 1.0) / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.2e+18) or not (z <= 3.5e+63): tmp = (x + (a / (z / y))) - a else: tmp = x - (y / ((t + 1.0) / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.2e+18) || !(z <= 3.5e+63)) tmp = Float64(Float64(x + Float64(a / Float64(z / y))) - a); else tmp = Float64(x - Float64(y / Float64(Float64(t + 1.0) / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.2e+18) || ~((z <= 3.5e+63))) tmp = (x + (a / (z / y))) - a; else tmp = x - (y / ((t + 1.0) / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.2e+18], N[Not[LessEqual[z, 3.5e+63]], $MachinePrecision]], N[(N[(x + N[(a / N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision], N[(x - N[(y / N[(N[(t + 1.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.2 \cdot 10^{+18} \lor \neg \left(z \leq 3.5 \cdot 10^{+63}\right):\\
\;\;\;\;\left(x + \frac{a}{\frac{z}{y}}\right) - a\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{\frac{t + 1}{a}}\\
\end{array}
\end{array}
if z < -1.2e18 or 3.50000000000000029e63 < z Initial program 91.1%
Taylor expanded in z around inf 83.1%
mul-1-neg83.1%
distribute-neg-frac83.1%
Simplified83.1%
Taylor expanded in y around 0 82.3%
+-commutative82.3%
+-commutative82.3%
associate-/l*90.2%
Simplified90.2%
if -1.2e18 < z < 3.50000000000000029e63Initial program 99.8%
associate-/r/98.7%
Simplified98.7%
associate-/r/99.8%
div-inv99.7%
associate-/r*98.5%
+-commutative98.5%
associate-+r-98.5%
Applied egg-rr98.5%
Taylor expanded in z around 0 88.9%
*-commutative88.9%
associate-/l*92.4%
Simplified92.4%
Final simplification91.5%
(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 96.1%
associate-/r/99.2%
Simplified99.2%
Final simplification99.2%
(FPCore (x y z t a) :precision binary64 (if (<= z -6e+16) (- x a) (if (<= z 3e+21) (- x (* a y)) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -6e+16) {
tmp = x - a;
} else if (z <= 3e+21) {
tmp = x - (a * y);
} 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 <= (-6d+16)) then
tmp = x - a
else if (z <= 3d+21) then
tmp = x - (a * y)
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 <= -6e+16) {
tmp = x - a;
} else if (z <= 3e+21) {
tmp = x - (a * y);
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -6e+16: tmp = x - a elif z <= 3e+21: tmp = x - (a * y) else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -6e+16) tmp = Float64(x - a); elseif (z <= 3e+21) tmp = Float64(x - Float64(a * y)); else tmp = Float64(x - a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -6e+16) tmp = x - a; elseif (z <= 3e+21) tmp = x - (a * y); else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -6e+16], N[(x - a), $MachinePrecision], If[LessEqual[z, 3e+21], N[(x - N[(a * y), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6 \cdot 10^{+16}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 3 \cdot 10^{+21}:\\
\;\;\;\;x - a \cdot y\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -6e16 or 3e21 < z Initial program 92.0%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in z around inf 82.4%
if -6e16 < z < 3e21Initial program 99.8%
associate-/r/98.6%
Simplified98.6%
associate-/r/99.8%
div-inv99.7%
associate-/r*98.4%
+-commutative98.4%
associate-+r-98.4%
Applied egg-rr98.4%
Taylor expanded in z around 0 91.7%
Taylor expanded in t around 0 74.8%
Final simplification78.3%
(FPCore (x y z t a) :precision binary64 (if (<= z -5.3e+16) (- x a) (if (<= z 3e+63) x (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -5.3e+16) {
tmp = x - a;
} else if (z <= 3e+63) {
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 <= (-5.3d+16)) then
tmp = x - a
else if (z <= 3d+63) 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 <= -5.3e+16) {
tmp = x - a;
} else if (z <= 3e+63) {
tmp = x;
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -5.3e+16: tmp = x - a elif z <= 3e+63: tmp = x else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -5.3e+16) tmp = Float64(x - a); elseif (z <= 3e+63) 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 <= -5.3e+16) tmp = x - a; elseif (z <= 3e+63) tmp = x; else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -5.3e+16], N[(x - a), $MachinePrecision], If[LessEqual[z, 3e+63], x, N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.3 \cdot 10^{+16}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 3 \cdot 10^{+63}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -5.3e16 or 2.99999999999999999e63 < z Initial program 91.1%
associate-/r/100.0%
Simplified100.0%
Taylor expanded in z around inf 85.4%
if -5.3e16 < z < 2.99999999999999999e63Initial program 99.8%
associate-/r/98.7%
Simplified98.7%
Taylor expanded in x around inf 55.5%
Final simplification68.1%
(FPCore (x y z t a) :precision binary64 (if (<= a -2.15e+117) (- a) (if (<= a 1.62e+184) x (- a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -2.15e+117) {
tmp = -a;
} else if (a <= 1.62e+184) {
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 <= (-2.15d+117)) then
tmp = -a
else if (a <= 1.62d+184) 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 <= -2.15e+117) {
tmp = -a;
} else if (a <= 1.62e+184) {
tmp = x;
} else {
tmp = -a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -2.15e+117: tmp = -a elif a <= 1.62e+184: tmp = x else: tmp = -a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -2.15e+117) tmp = Float64(-a); elseif (a <= 1.62e+184) tmp = x; else tmp = Float64(-a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -2.15e+117) tmp = -a; elseif (a <= 1.62e+184) tmp = x; else tmp = -a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -2.15e+117], (-a), If[LessEqual[a, 1.62e+184], x, (-a)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.15 \cdot 10^{+117}:\\
\;\;\;\;-a\\
\mathbf{elif}\;a \leq 1.62 \cdot 10^{+184}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;-a\\
\end{array}
\end{array}
if a < -2.14999999999999999e117 or 1.61999999999999999e184 < a Initial program 99.8%
sub-neg99.8%
+-commutative99.8%
associate-/r/96.9%
*-commutative96.9%
distribute-rgt-neg-in96.9%
fma-def96.9%
div-sub96.9%
sub-neg96.9%
+-commutative96.9%
distribute-neg-in96.9%
remove-double-neg96.9%
sub-neg96.9%
div-sub96.9%
Simplified96.9%
Taylor expanded in a around -inf 54.1%
associate-/l*96.8%
associate-/r/99.8%
fma-def99.8%
associate--l+99.8%
Simplified99.8%
Taylor expanded in a around -inf 44.5%
Taylor expanded in z around inf 40.4%
mul-1-neg40.4%
Simplified40.4%
if -2.14999999999999999e117 < a < 1.61999999999999999e184Initial program 95.0%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in x around inf 62.1%
Final simplification57.0%
(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 96.1%
associate-/r/99.2%
Simplified99.2%
Taylor expanded in x around inf 51.3%
Final simplification51.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 2023195
(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))))