
(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 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (- x (/ (- y z) (/ (+ (- t z) 1.0) a))))
double code(double x, double y, double z, double t, double a) {
return x - ((y - z) / (((t - z) + 1.0) / a));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x - ((y - z) / (((t - z) + 1.0d0) / a))
end function
public static double code(double x, double y, double z, double t, double a) {
return x - ((y - z) / (((t - z) + 1.0) / a));
}
def code(x, y, z, t, a): return x - ((y - z) / (((t - z) + 1.0) / a))
function code(x, y, z, t, a) return Float64(x - Float64(Float64(y - z) / Float64(Float64(Float64(t - z) + 1.0) / a))) end
function tmp = code(x, y, z, t, a) tmp = x - ((y - z) / (((t - z) + 1.0) / a)); end
code[x_, y_, z_, t_, a_] := N[(x - N[(N[(y - z), $MachinePrecision] / N[(N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y - z}{\frac{\left(t - z\right) + 1}{a}}
\end{array}
(FPCore (x y z t a) :precision binary64 (+ x (* a (/ (- z 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 94.2%
associate-/r/99.9%
*-commutative99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* (- y z) (/ a z)))))
(if (<= z -3.6e+25)
t_1
(if (<= z 5.4e+35)
(- x (* a (/ y (+ t 1.0))))
(if (<= z 5.2e+203) t_1 (- x a))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + ((y - z) * (a / z));
double tmp;
if (z <= -3.6e+25) {
tmp = t_1;
} else if (z <= 5.4e+35) {
tmp = x - (a * (y / (t + 1.0)));
} else if (z <= 5.2e+203) {
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 + ((y - z) * (a / z))
if (z <= (-3.6d+25)) then
tmp = t_1
else if (z <= 5.4d+35) then
tmp = x - (a * (y / (t + 1.0d0)))
else if (z <= 5.2d+203) 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 - z) * (a / z));
double tmp;
if (z <= -3.6e+25) {
tmp = t_1;
} else if (z <= 5.4e+35) {
tmp = x - (a * (y / (t + 1.0)));
} else if (z <= 5.2e+203) {
tmp = t_1;
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + ((y - z) * (a / z)) tmp = 0 if z <= -3.6e+25: tmp = t_1 elif z <= 5.4e+35: tmp = x - (a * (y / (t + 1.0))) elif z <= 5.2e+203: tmp = t_1 else: tmp = x - a return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(y - z) * Float64(a / z))) tmp = 0.0 if (z <= -3.6e+25) tmp = t_1; elseif (z <= 5.4e+35) tmp = Float64(x - Float64(a * Float64(y / Float64(t + 1.0)))); elseif (z <= 5.2e+203) 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 - z) * (a / z)); tmp = 0.0; if (z <= -3.6e+25) tmp = t_1; elseif (z <= 5.4e+35) tmp = x - (a * (y / (t + 1.0))); elseif (z <= 5.2e+203) 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[(N[(y - z), $MachinePrecision] * N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.6e+25], t$95$1, If[LessEqual[z, 5.4e+35], N[(x - N[(a * N[(y / N[(t + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.2e+203], t$95$1, N[(x - a), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \left(y - z\right) \cdot \frac{a}{z}\\
\mathbf{if}\;z \leq -3.6 \cdot 10^{+25}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 5.4 \cdot 10^{+35}:\\
\;\;\;\;x - a \cdot \frac{y}{t + 1}\\
\mathbf{elif}\;z \leq 5.2 \cdot 10^{+203}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -3.60000000000000015e25 or 5.40000000000000005e35 < z < 5.1999999999999997e203Initial program 91.4%
clear-num91.3%
associate-/r/91.4%
clear-num94.4%
Applied egg-rr94.4%
Taylor expanded in z around inf 83.1%
associate-*r/83.1%
mul-1-neg83.1%
Simplified83.1%
if -3.60000000000000015e25 < z < 5.40000000000000005e35Initial program 99.2%
associate-/r/99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in z around 0 94.2%
if 5.1999999999999997e203 < z Initial program 75.3%
associate-/r/99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around inf 96.1%
Final simplification90.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.18e+70) (not (<= z 5e-27))) (+ x (/ a (/ (+ (- t z) 1.0) z))) (- x (* a (/ y (+ t 1.0))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.18e+70) || !(z <= 5e-27)) {
tmp = x + (a / (((t - z) + 1.0) / z));
} 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 <= (-1.18d+70)) .or. (.not. (z <= 5d-27))) then
tmp = x + (a / (((t - z) + 1.0d0) / z))
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 <= -1.18e+70) || !(z <= 5e-27)) {
tmp = x + (a / (((t - z) + 1.0) / z));
} else {
tmp = x - (a * (y / (t + 1.0)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.18e+70) or not (z <= 5e-27): tmp = x + (a / (((t - z) + 1.0) / z)) else: tmp = x - (a * (y / (t + 1.0))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.18e+70) || !(z <= 5e-27)) tmp = Float64(x + Float64(a / Float64(Float64(Float64(t - z) + 1.0) / z))); 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 <= -1.18e+70) || ~((z <= 5e-27))) tmp = x + (a / (((t - z) + 1.0) / z)); else tmp = x - (a * (y / (t + 1.0))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.18e+70], N[Not[LessEqual[z, 5e-27]], $MachinePrecision]], N[(x + N[(a / N[(N[(N[(t - z), $MachinePrecision] + 1.0), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $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 -1.18 \cdot 10^{+70} \lor \neg \left(z \leq 5 \cdot 10^{-27}\right):\\
\;\;\;\;x + \frac{a}{\frac{\left(t - z\right) + 1}{z}}\\
\mathbf{else}:\\
\;\;\;\;x - a \cdot \frac{y}{t + 1}\\
\end{array}
\end{array}
if z < -1.18000000000000001e70 or 5.0000000000000002e-27 < z Initial program 88.7%
associate-/r/99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in y around 0 66.3%
mul-1-neg66.3%
*-commutative66.3%
associate--l+66.3%
+-commutative66.3%
associate-*l/87.9%
distribute-lft-neg-in87.9%
distribute-neg-frac87.9%
+-commutative87.9%
Simplified87.9%
Taylor expanded in x around 0 66.3%
+-commutative66.3%
associate-/l*87.8%
associate--l+87.8%
Simplified87.8%
if -1.18000000000000001e70 < z < 5.0000000000000002e-27Initial program 99.1%
associate-/r/99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in z around 0 95.6%
Final simplification91.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -1.22e+95) (not (<= t 5.6e+125))) (- x (* a (/ (- y z) t))) (- x (* a (/ (- y z) (- 1.0 z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -1.22e+95) || !(t <= 5.6e+125)) {
tmp = x - (a * ((y - z) / t));
} else {
tmp = x - (a * ((y - z) / (1.0 - z)));
}
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.22d+95)) .or. (.not. (t <= 5.6d+125))) then
tmp = x - (a * ((y - z) / t))
else
tmp = x - (a * ((y - z) / (1.0d0 - z)))
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.22e+95) || !(t <= 5.6e+125)) {
tmp = x - (a * ((y - z) / t));
} else {
tmp = x - (a * ((y - z) / (1.0 - z)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -1.22e+95) or not (t <= 5.6e+125): tmp = x - (a * ((y - z) / t)) else: tmp = x - (a * ((y - z) / (1.0 - z))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -1.22e+95) || !(t <= 5.6e+125)) tmp = Float64(x - Float64(a * Float64(Float64(y - z) / t))); else tmp = Float64(x - Float64(a * Float64(Float64(y - z) / Float64(1.0 - z)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -1.22e+95) || ~((t <= 5.6e+125))) tmp = x - (a * ((y - z) / t)); else tmp = x - (a * ((y - z) / (1.0 - z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -1.22e+95], N[Not[LessEqual[t, 5.6e+125]], $MachinePrecision]], N[(x - N[(a * N[(N[(y - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(a * N[(N[(y - z), $MachinePrecision] / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.22 \cdot 10^{+95} \lor \neg \left(t \leq 5.6 \cdot 10^{+125}\right):\\
\;\;\;\;x - a \cdot \frac{y - z}{t}\\
\mathbf{else}:\\
\;\;\;\;x - a \cdot \frac{y - z}{1 - z}\\
\end{array}
\end{array}
if t < -1.22000000000000007e95 or 5.6000000000000002e125 < t Initial program 93.0%
associate-/r/99.6%
*-commutative99.6%
Simplified99.6%
Taylor expanded in t around inf 92.3%
if -1.22000000000000007e95 < t < 5.6000000000000002e125Initial program 94.7%
associate-/r/100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in t around 0 96.5%
Final simplification95.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.15e+109) (not (<= z 2.4))) (- x a) (- x (* a (/ y (+ t 1.0))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.15e+109) || !(z <= 2.4)) {
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 <= (-1.15d+109)) .or. (.not. (z <= 2.4d0))) 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 <= -1.15e+109) || !(z <= 2.4)) {
tmp = x - a;
} else {
tmp = x - (a * (y / (t + 1.0)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.15e+109) or not (z <= 2.4): 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 <= -1.15e+109) || !(z <= 2.4)) 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 <= -1.15e+109) || ~((z <= 2.4))) 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, -1.15e+109], N[Not[LessEqual[z, 2.4]], $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 -1.15 \cdot 10^{+109} \lor \neg \left(z \leq 2.4\right):\\
\;\;\;\;x - a\\
\mathbf{else}:\\
\;\;\;\;x - a \cdot \frac{y}{t + 1}\\
\end{array}
\end{array}
if z < -1.15000000000000005e109 or 2.39999999999999991 < z Initial program 88.1%
associate-/r/99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around inf 79.6%
if -1.15000000000000005e109 < z < 2.39999999999999991Initial program 98.6%
associate-/r/99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in z around 0 92.8%
Final simplification87.2%
(FPCore (x y z t a) :precision binary64 (if (<= z -4.4e-40) (- x a) (if (<= z 9.8e-24) (- x (* a y)) (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -4.4e-40) {
tmp = x - a;
} else if (z <= 9.8e-24) {
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 <= (-4.4d-40)) then
tmp = x - a
else if (z <= 9.8d-24) 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 <= -4.4e-40) {
tmp = x - a;
} else if (z <= 9.8e-24) {
tmp = x - (a * y);
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -4.4e-40: tmp = x - a elif z <= 9.8e-24: tmp = x - (a * y) else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -4.4e-40) tmp = Float64(x - a); elseif (z <= 9.8e-24) 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 <= -4.4e-40) tmp = x - a; elseif (z <= 9.8e-24) tmp = x - (a * y); else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -4.4e-40], N[(x - a), $MachinePrecision], If[LessEqual[z, 9.8e-24], N[(x - N[(a * y), $MachinePrecision]), $MachinePrecision], N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.4 \cdot 10^{-40}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 9.8 \cdot 10^{-24}:\\
\;\;\;\;x - a \cdot y\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -4.40000000000000018e-40 or 9.8000000000000002e-24 < z Initial program 89.5%
associate-/r/99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in z around inf 75.0%
if -4.40000000000000018e-40 < z < 9.8000000000000002e-24Initial program 99.9%
associate-/r/100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in z around 0 95.0%
associate-/l*98.2%
Simplified98.2%
Taylor expanded in t around 0 83.2%
Final simplification78.7%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.85e-6) (- x a) (if (<= z 9.8e-48) x (- x a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.85e-6) {
tmp = x - a;
} else if (z <= 9.8e-48) {
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.85d-6)) then
tmp = x - a
else if (z <= 9.8d-48) 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.85e-6) {
tmp = x - a;
} else if (z <= 9.8e-48) {
tmp = x;
} else {
tmp = x - a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.85e-6: tmp = x - a elif z <= 9.8e-48: tmp = x else: tmp = x - a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.85e-6) tmp = Float64(x - a); elseif (z <= 9.8e-48) 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.85e-6) tmp = x - a; elseif (z <= 9.8e-48) tmp = x; else tmp = x - a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.85e-6], N[(x - a), $MachinePrecision], If[LessEqual[z, 9.8e-48], x, N[(x - a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.85 \cdot 10^{-6}:\\
\;\;\;\;x - a\\
\mathbf{elif}\;z \leq 9.8 \cdot 10^{-48}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x - a\\
\end{array}
\end{array}
if z < -1.8500000000000001e-6 or 9.8000000000000005e-48 < z Initial program 89.5%
associate-/r/99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around inf 73.8%
if -1.8500000000000001e-6 < z < 9.8000000000000005e-48Initial program 99.9%
associate-/r/99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in z around 0 95.9%
associate-/l*98.2%
Simplified98.2%
Taylor expanded in x around inf 64.2%
Final simplification69.5%
(FPCore (x y z t a) :precision binary64 (if (<= x -3.6e-198) x (if (<= x 8e-182) (- a) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -3.6e-198) {
tmp = x;
} else if (x <= 8e-182) {
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 (x <= (-3.6d-198)) then
tmp = x
else if (x <= 8d-182) 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 (x <= -3.6e-198) {
tmp = x;
} else if (x <= 8e-182) {
tmp = -a;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -3.6e-198: tmp = x elif x <= 8e-182: tmp = -a else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -3.6e-198) tmp = x; elseif (x <= 8e-182) tmp = Float64(-a); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -3.6e-198) tmp = x; elseif (x <= 8e-182) tmp = -a; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -3.6e-198], x, If[LessEqual[x, 8e-182], (-a), x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.6 \cdot 10^{-198}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 8 \cdot 10^{-182}:\\
\;\;\;\;-a\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -3.59999999999999998e-198 or 8.0000000000000004e-182 < x Initial program 98.4%
associate-/r/99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around 0 69.8%
associate-/l*71.6%
Simplified71.6%
Taylor expanded in x around inf 63.4%
if -3.59999999999999998e-198 < x < 8.0000000000000004e-182Initial program 75.6%
associate-/r/99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in y around 0 48.4%
mul-1-neg48.4%
*-commutative48.4%
associate--l+48.4%
+-commutative48.4%
associate-*l/54.4%
distribute-lft-neg-in54.4%
distribute-neg-frac54.4%
+-commutative54.4%
Simplified54.4%
Taylor expanded in x around 0 37.8%
Taylor expanded in z around inf 40.3%
mul-1-neg40.3%
Simplified40.3%
Final simplification59.1%
(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 94.2%
associate-/r/99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around 0 65.9%
associate-/l*67.4%
Simplified67.4%
Taylor expanded in x around inf 54.2%
Final simplification54.2%
(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 2023293
(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))))