
(FPCore (x y z t a) :precision binary64 (+ x (/ (* y (- z t)) a)))
double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / 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)) / a)
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / a);
}
def code(x, y, z, t, a): return x + ((y * (z - t)) / a)
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y * Float64(z - t)) / a)) end
function tmp = code(x, y, z, t, a) tmp = x + ((y * (z - t)) / a); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - t\right)}{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)) a)))
double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / 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)) / a)
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / a);
}
def code(x, y, z, t, a): return x + ((y * (z - t)) / a)
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y * Float64(z - t)) / a)) end
function tmp = code(x, y, z, t, a) tmp = x + ((y * (z - t)) / a); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - t\right)}{a}
\end{array}
(FPCore (x y z t a) :precision binary64 (if (<= y -8.2e-83) (+ x (/ y (/ a (- z t)))) (+ x (/ (- z t) (/ a y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -8.2e-83) {
tmp = x + (y / (a / (z - t)));
} else {
tmp = x + ((z - t) / (a / 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 (y <= (-8.2d-83)) then
tmp = x + (y / (a / (z - t)))
else
tmp = x + ((z - t) / (a / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -8.2e-83) {
tmp = x + (y / (a / (z - t)));
} else {
tmp = x + ((z - t) / (a / y));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -8.2e-83: tmp = x + (y / (a / (z - t))) else: tmp = x + ((z - t) / (a / y)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -8.2e-83) tmp = Float64(x + Float64(y / Float64(a / Float64(z - t)))); else tmp = Float64(x + Float64(Float64(z - t) / Float64(a / y))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -8.2e-83) tmp = x + (y / (a / (z - t))); else tmp = x + ((z - t) / (a / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -8.2e-83], N[(x + N[(y / N[(a / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(z - t), $MachinePrecision] / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.2 \cdot 10^{-83}:\\
\;\;\;\;x + \frac{y}{\frac{a}{z - t}}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z - t}{\frac{a}{y}}\\
\end{array}
\end{array}
if y < -8.1999999999999999e-83Initial program 85.1%
associate-*l/93.2%
Simplified93.2%
associate-/r/99.8%
Applied egg-rr99.8%
if -8.1999999999999999e-83 < y Initial program 95.5%
associate-*l/97.3%
Simplified97.3%
*-commutative97.3%
clear-num97.3%
un-div-inv97.4%
Applied egg-rr97.4%
Final simplification98.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -1.56e+188) (not (<= t 8.5e+244))) (* t (/ (- y) a)) (+ x (/ (* y z) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -1.56e+188) || !(t <= 8.5e+244)) {
tmp = t * (-y / a);
} else {
tmp = x + ((y * 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 ((t <= (-1.56d+188)) .or. (.not. (t <= 8.5d+244))) then
tmp = t * (-y / a)
else
tmp = x + ((y * 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 ((t <= -1.56e+188) || !(t <= 8.5e+244)) {
tmp = t * (-y / a);
} else {
tmp = x + ((y * z) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -1.56e+188) or not (t <= 8.5e+244): tmp = t * (-y / a) else: tmp = x + ((y * z) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -1.56e+188) || !(t <= 8.5e+244)) tmp = Float64(t * Float64(Float64(-y) / a)); else tmp = Float64(x + Float64(Float64(y * z) / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -1.56e+188) || ~((t <= 8.5e+244))) tmp = t * (-y / a); else tmp = x + ((y * z) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -1.56e+188], N[Not[LessEqual[t, 8.5e+244]], $MachinePrecision]], N[(t * N[((-y) / a), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.56 \cdot 10^{+188} \lor \neg \left(t \leq 8.5 \cdot 10^{+244}\right):\\
\;\;\;\;t \cdot \frac{-y}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot z}{a}\\
\end{array}
\end{array}
if t < -1.55999999999999992e188 or 8.49999999999999995e244 < t Initial program 92.3%
associate-*l/97.2%
Simplified97.2%
Taylor expanded in z around 0 89.1%
mul-1-neg89.1%
unsub-neg89.1%
associate-*r/93.9%
Simplified93.9%
clear-num93.9%
div-inv94.0%
clear-num94.0%
Applied egg-rr94.0%
Taylor expanded in x around 0 74.8%
mul-1-neg74.8%
associate-*r/80.8%
distribute-rgt-neg-in80.8%
distribute-neg-frac80.8%
Simplified80.8%
if -1.55999999999999992e188 < t < 8.49999999999999995e244Initial program 92.1%
associate-*l/95.8%
Simplified95.8%
Taylor expanded in z around inf 78.7%
Final simplification79.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -6.9e+186) (not (<= t 8.5e+244))) (* t (/ (- y) a)) (+ x (* z (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -6.9e+186) || !(t <= 8.5e+244)) {
tmp = t * (-y / a);
} else {
tmp = x + (z * (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 ((t <= (-6.9d+186)) .or. (.not. (t <= 8.5d+244))) then
tmp = t * (-y / a)
else
tmp = x + (z * (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 ((t <= -6.9e+186) || !(t <= 8.5e+244)) {
tmp = t * (-y / a);
} else {
tmp = x + (z * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -6.9e+186) or not (t <= 8.5e+244): tmp = t * (-y / a) else: tmp = x + (z * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -6.9e+186) || !(t <= 8.5e+244)) tmp = Float64(t * Float64(Float64(-y) / a)); else tmp = Float64(x + Float64(z * Float64(y / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -6.9e+186) || ~((t <= 8.5e+244))) tmp = t * (-y / a); else tmp = x + (z * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -6.9e+186], N[Not[LessEqual[t, 8.5e+244]], $MachinePrecision]], N[(t * N[((-y) / a), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.9 \cdot 10^{+186} \lor \neg \left(t \leq 8.5 \cdot 10^{+244}\right):\\
\;\;\;\;t \cdot \frac{-y}{a}\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{a}\\
\end{array}
\end{array}
if t < -6.89999999999999992e186 or 8.49999999999999995e244 < t Initial program 92.3%
associate-*l/97.2%
Simplified97.2%
Taylor expanded in z around 0 89.1%
mul-1-neg89.1%
unsub-neg89.1%
associate-*r/93.9%
Simplified93.9%
clear-num93.9%
div-inv94.0%
clear-num94.0%
Applied egg-rr94.0%
Taylor expanded in x around 0 74.8%
mul-1-neg74.8%
associate-*r/80.8%
distribute-rgt-neg-in80.8%
distribute-neg-frac80.8%
Simplified80.8%
if -6.89999999999999992e186 < t < 8.49999999999999995e244Initial program 92.1%
associate-*l/95.8%
Simplified95.8%
Taylor expanded in t around 0 78.7%
+-commutative78.7%
associate-*l/79.8%
*-commutative79.8%
Simplified79.8%
Final simplification80.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -2.65e+185) (not (<= t 8.5e+244))) (* t (/ (- y) a)) (+ x (/ z (/ a y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -2.65e+185) || !(t <= 8.5e+244)) {
tmp = t * (-y / a);
} else {
tmp = x + (z / (a / 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 <= (-2.65d+185)) .or. (.not. (t <= 8.5d+244))) then
tmp = t * (-y / a)
else
tmp = x + (z / (a / 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 <= -2.65e+185) || !(t <= 8.5e+244)) {
tmp = t * (-y / a);
} else {
tmp = x + (z / (a / y));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -2.65e+185) or not (t <= 8.5e+244): tmp = t * (-y / a) else: tmp = x + (z / (a / y)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -2.65e+185) || !(t <= 8.5e+244)) tmp = Float64(t * Float64(Float64(-y) / a)); else tmp = Float64(x + Float64(z / Float64(a / y))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -2.65e+185) || ~((t <= 8.5e+244))) tmp = t * (-y / a); else tmp = x + (z / (a / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -2.65e+185], N[Not[LessEqual[t, 8.5e+244]], $MachinePrecision]], N[(t * N[((-y) / a), $MachinePrecision]), $MachinePrecision], N[(x + N[(z / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.65 \cdot 10^{+185} \lor \neg \left(t \leq 8.5 \cdot 10^{+244}\right):\\
\;\;\;\;t \cdot \frac{-y}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z}{\frac{a}{y}}\\
\end{array}
\end{array}
if t < -2.65000000000000004e185 or 8.49999999999999995e244 < t Initial program 92.3%
associate-*l/97.2%
Simplified97.2%
Taylor expanded in z around 0 89.1%
mul-1-neg89.1%
unsub-neg89.1%
associate-*r/93.9%
Simplified93.9%
clear-num93.9%
div-inv94.0%
clear-num94.0%
Applied egg-rr94.0%
Taylor expanded in x around 0 74.8%
mul-1-neg74.8%
associate-*r/80.8%
distribute-rgt-neg-in80.8%
distribute-neg-frac80.8%
Simplified80.8%
if -2.65000000000000004e185 < t < 8.49999999999999995e244Initial program 92.1%
associate-*l/95.8%
Simplified95.8%
Taylor expanded in t around 0 78.7%
+-commutative78.7%
associate-*l/79.8%
*-commutative79.8%
Simplified79.8%
clear-num79.8%
div-inv80.2%
Applied egg-rr80.2%
Final simplification80.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -3.7e+52) (not (<= z 7.2e-28))) (+ x (/ z (/ a y))) (- x (* t (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -3.7e+52) || !(z <= 7.2e-28)) {
tmp = x + (z / (a / y));
} else {
tmp = x - (t * (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 <= (-3.7d+52)) .or. (.not. (z <= 7.2d-28))) then
tmp = x + (z / (a / y))
else
tmp = x - (t * (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 <= -3.7e+52) || !(z <= 7.2e-28)) {
tmp = x + (z / (a / y));
} else {
tmp = x - (t * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -3.7e+52) or not (z <= 7.2e-28): tmp = x + (z / (a / y)) else: tmp = x - (t * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -3.7e+52) || !(z <= 7.2e-28)) tmp = Float64(x + Float64(z / Float64(a / y))); else tmp = Float64(x - Float64(t * Float64(y / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -3.7e+52) || ~((z <= 7.2e-28))) tmp = x + (z / (a / y)); else tmp = x - (t * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -3.7e+52], N[Not[LessEqual[z, 7.2e-28]], $MachinePrecision]], N[(x + N[(z / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.7 \cdot 10^{+52} \lor \neg \left(z \leq 7.2 \cdot 10^{-28}\right):\\
\;\;\;\;x + \frac{z}{\frac{a}{y}}\\
\mathbf{else}:\\
\;\;\;\;x - t \cdot \frac{y}{a}\\
\end{array}
\end{array}
if z < -3.7e52 or 7.1999999999999997e-28 < z Initial program 90.1%
associate-*l/97.6%
Simplified97.6%
Taylor expanded in t around 0 82.2%
+-commutative82.2%
associate-*l/87.5%
*-commutative87.5%
Simplified87.5%
clear-num87.5%
div-inv87.6%
Applied egg-rr87.6%
if -3.7e52 < z < 7.1999999999999997e-28Initial program 94.4%
associate-*l/94.3%
Simplified94.3%
Taylor expanded in z around 0 84.5%
mul-1-neg84.5%
unsub-neg84.5%
associate-*r/87.6%
Simplified87.6%
Final simplification87.6%
(FPCore (x y z t a) :precision binary64 (if (<= y -4.5e-95) (+ x (/ y (/ a (- z t)))) (+ x (* (- z t) (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -4.5e-95) {
tmp = x + (y / (a / (z - t)));
} else {
tmp = x + ((z - t) * (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 (y <= (-4.5d-95)) then
tmp = x + (y / (a / (z - t)))
else
tmp = x + ((z - t) * (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 (y <= -4.5e-95) {
tmp = x + (y / (a / (z - t)));
} else {
tmp = x + ((z - t) * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -4.5e-95: tmp = x + (y / (a / (z - t))) else: tmp = x + ((z - t) * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -4.5e-95) tmp = Float64(x + Float64(y / Float64(a / Float64(z - t)))); else tmp = Float64(x + Float64(Float64(z - t) * Float64(y / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -4.5e-95) tmp = x + (y / (a / (z - t))); else tmp = x + ((z - t) * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -4.5e-95], N[(x + N[(y / N[(a / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(z - t), $MachinePrecision] * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.5 \cdot 10^{-95}:\\
\;\;\;\;x + \frac{y}{\frac{a}{z - t}}\\
\mathbf{else}:\\
\;\;\;\;x + \left(z - t\right) \cdot \frac{y}{a}\\
\end{array}
\end{array}
if y < -4.5e-95Initial program 85.9%
associate-*l/93.6%
Simplified93.6%
associate-/r/99.9%
Applied egg-rr99.9%
if -4.5e-95 < y Initial program 95.4%
associate-*l/97.3%
Simplified97.3%
Final simplification98.1%
(FPCore (x y z t a) :precision binary64 (if (<= a -9.2e-97) x (if (<= a 10500000.0) (* t (/ (- y) a)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -9.2e-97) {
tmp = x;
} else if (a <= 10500000.0) {
tmp = t * (-y / 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 <= (-9.2d-97)) then
tmp = x
else if (a <= 10500000.0d0) then
tmp = t * (-y / 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 <= -9.2e-97) {
tmp = x;
} else if (a <= 10500000.0) {
tmp = t * (-y / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -9.2e-97: tmp = x elif a <= 10500000.0: tmp = t * (-y / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -9.2e-97) tmp = x; elseif (a <= 10500000.0) tmp = Float64(t * Float64(Float64(-y) / a)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -9.2e-97) tmp = x; elseif (a <= 10500000.0) tmp = t * (-y / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -9.2e-97], x, If[LessEqual[a, 10500000.0], N[(t * N[((-y) / a), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -9.2 \cdot 10^{-97}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 10500000:\\
\;\;\;\;t \cdot \frac{-y}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -9.19999999999999976e-97 or 1.05e7 < a Initial program 86.7%
associate-*l/97.0%
Simplified97.0%
Taylor expanded in x around inf 56.9%
if -9.19999999999999976e-97 < a < 1.05e7Initial program 99.1%
associate-*l/94.7%
Simplified94.7%
Taylor expanded in z around 0 55.6%
mul-1-neg55.6%
unsub-neg55.6%
associate-*r/55.5%
Simplified55.5%
clear-num55.5%
div-inv55.5%
clear-num55.5%
Applied egg-rr55.5%
Taylor expanded in x around 0 40.8%
mul-1-neg40.8%
associate-*r/43.3%
distribute-rgt-neg-in43.3%
distribute-neg-frac43.3%
Simplified43.3%
Final simplification50.9%
(FPCore (x y z t a) :precision binary64 (+ x (* (- z t) (/ y a))))
double code(double x, double y, double z, double t, double a) {
return x + ((z - t) * (y / 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 + ((z - t) * (y / a))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((z - t) * (y / a));
}
def code(x, y, z, t, a): return x + ((z - t) * (y / a))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(z - t) * Float64(y / a))) end
function tmp = code(x, y, z, t, a) tmp = x + ((z - t) * (y / a)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(z - t), $MachinePrecision] * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(z - t\right) \cdot \frac{y}{a}
\end{array}
Initial program 92.2%
associate-*l/96.0%
Simplified96.0%
Final simplification96.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 92.2%
associate-*l/96.0%
Simplified96.0%
Taylor expanded in x around inf 39.4%
Final simplification39.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ a (- z t))))
(if (< y -1.0761266216389975e-10)
(+ x (/ 1.0 (/ t_1 y)))
(if (< y 2.894426862792089e-49)
(+ x (/ (* y (- z t)) a))
(+ x (/ y t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = a / (z - t);
double tmp;
if (y < -1.0761266216389975e-10) {
tmp = x + (1.0 / (t_1 / y));
} else if (y < 2.894426862792089e-49) {
tmp = x + ((y * (z - t)) / a);
} else {
tmp = x + (y / t_1);
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = a / (z - t)
if (y < (-1.0761266216389975d-10)) then
tmp = x + (1.0d0 / (t_1 / y))
else if (y < 2.894426862792089d-49) then
tmp = x + ((y * (z - t)) / a)
else
tmp = x + (y / t_1)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = a / (z - t);
double tmp;
if (y < -1.0761266216389975e-10) {
tmp = x + (1.0 / (t_1 / y));
} else if (y < 2.894426862792089e-49) {
tmp = x + ((y * (z - t)) / a);
} else {
tmp = x + (y / t_1);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = a / (z - t) tmp = 0 if y < -1.0761266216389975e-10: tmp = x + (1.0 / (t_1 / y)) elif y < 2.894426862792089e-49: tmp = x + ((y * (z - t)) / a) else: tmp = x + (y / t_1) return tmp
function code(x, y, z, t, a) t_1 = Float64(a / Float64(z - t)) tmp = 0.0 if (y < -1.0761266216389975e-10) tmp = Float64(x + Float64(1.0 / Float64(t_1 / y))); elseif (y < 2.894426862792089e-49) tmp = Float64(x + Float64(Float64(y * Float64(z - t)) / a)); else tmp = Float64(x + Float64(y / t_1)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = a / (z - t); tmp = 0.0; if (y < -1.0761266216389975e-10) tmp = x + (1.0 / (t_1 / y)); elseif (y < 2.894426862792089e-49) tmp = x + ((y * (z - t)) / a); else tmp = x + (y / t_1); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(a / N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[Less[y, -1.0761266216389975e-10], N[(x + N[(1.0 / N[(t$95$1 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Less[y, 2.894426862792089e-49], N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{a}{z - t}\\
\mathbf{if}\;y < -1.0761266216389975 \cdot 10^{-10}:\\
\;\;\;\;x + \frac{1}{\frac{t_1}{y}}\\
\mathbf{elif}\;y < 2.894426862792089 \cdot 10^{-49}:\\
\;\;\;\;x + \frac{y \cdot \left(z - t\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{t_1}\\
\end{array}
\end{array}
herbie shell --seed 2023271
(FPCore (x y z t a)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, E"
:precision binary64
:herbie-target
(if (< y -1.0761266216389975e-10) (+ x (/ 1.0 (/ (/ a (- z t)) y))) (if (< y 2.894426862792089e-49) (+ x (/ (* y (- z t)) a)) (+ x (/ y (/ a (- z t))))))
(+ x (/ (* y (- z t)) a)))