
(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 10 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 (fma (/ y a) (- t z) x))
double code(double x, double y, double z, double t, double a) {
return fma((y / a), (t - z), x);
}
function code(x, y, z, t, a) return fma(Float64(y / a), Float64(t - z), x) end
code[x_, y_, z_, t_, a_] := N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{y}{a}, t - z, x\right)
\end{array}
Initial program 97.2%
sub-neg97.2%
distribute-frac-neg97.2%
distribute-lft-neg-out97.2%
+-commutative97.2%
distribute-lft-neg-out97.2%
distribute-rgt-neg-in97.2%
associate-*l/98.2%
fma-def98.3%
sub-neg98.3%
distribute-neg-in98.3%
remove-double-neg98.3%
+-commutative98.3%
sub-neg98.3%
Simplified98.3%
Final simplification98.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (/ z a) (- y))) (t_2 (* (/ y a) t)))
(if (<= a -1.16e+36)
x
(if (<= a -3.8e-147)
t_2
(if (<= a -4e-207)
t_1
(if (<= a -9e-307) t_2 (if (<= a 1e-49) t_1 x)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z / a) * -y;
double t_2 = (y / a) * t;
double tmp;
if (a <= -1.16e+36) {
tmp = x;
} else if (a <= -3.8e-147) {
tmp = t_2;
} else if (a <= -4e-207) {
tmp = t_1;
} else if (a <= -9e-307) {
tmp = t_2;
} else if (a <= 1e-49) {
tmp = t_1;
} 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (z / a) * -y
t_2 = (y / a) * t
if (a <= (-1.16d+36)) then
tmp = x
else if (a <= (-3.8d-147)) then
tmp = t_2
else if (a <= (-4d-207)) then
tmp = t_1
else if (a <= (-9d-307)) then
tmp = t_2
else if (a <= 1d-49) then
tmp = t_1
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (z / a) * -y;
double t_2 = (y / a) * t;
double tmp;
if (a <= -1.16e+36) {
tmp = x;
} else if (a <= -3.8e-147) {
tmp = t_2;
} else if (a <= -4e-207) {
tmp = t_1;
} else if (a <= -9e-307) {
tmp = t_2;
} else if (a <= 1e-49) {
tmp = t_1;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (z / a) * -y t_2 = (y / a) * t tmp = 0 if a <= -1.16e+36: tmp = x elif a <= -3.8e-147: tmp = t_2 elif a <= -4e-207: tmp = t_1 elif a <= -9e-307: tmp = t_2 elif a <= 1e-49: tmp = t_1 else: tmp = x return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(z / a) * Float64(-y)) t_2 = Float64(Float64(y / a) * t) tmp = 0.0 if (a <= -1.16e+36) tmp = x; elseif (a <= -3.8e-147) tmp = t_2; elseif (a <= -4e-207) tmp = t_1; elseif (a <= -9e-307) tmp = t_2; elseif (a <= 1e-49) tmp = t_1; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (z / a) * -y; t_2 = (y / a) * t; tmp = 0.0; if (a <= -1.16e+36) tmp = x; elseif (a <= -3.8e-147) tmp = t_2; elseif (a <= -4e-207) tmp = t_1; elseif (a <= -9e-307) tmp = t_2; elseif (a <= 1e-49) tmp = t_1; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z / a), $MachinePrecision] * (-y)), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[a, -1.16e+36], x, If[LessEqual[a, -3.8e-147], t$95$2, If[LessEqual[a, -4e-207], t$95$1, If[LessEqual[a, -9e-307], t$95$2, If[LessEqual[a, 1e-49], t$95$1, x]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z}{a} \cdot \left(-y\right)\\
t_2 := \frac{y}{a} \cdot t\\
\mathbf{if}\;a \leq -1.16 \cdot 10^{+36}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq -3.8 \cdot 10^{-147}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;a \leq -4 \cdot 10^{-207}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \leq -9 \cdot 10^{-307}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;a \leq 10^{-49}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -1.15999999999999998e36 or 9.99999999999999936e-50 < a Initial program 94.5%
associate-*l/98.8%
Simplified98.8%
Taylor expanded in x around inf 63.4%
if -1.15999999999999998e36 < a < -3.80000000000000028e-147 or -3.9999999999999997e-207 < a < -8.99999999999999978e-307Initial program 99.8%
associate-*l/99.8%
Simplified99.8%
Taylor expanded in t around inf 56.8%
associate-*r/58.2%
Simplified58.2%
if -3.80000000000000028e-147 < a < -3.9999999999999997e-207 or -8.99999999999999978e-307 < a < 9.99999999999999936e-50Initial program 99.4%
associate-/l*87.2%
Simplified87.2%
clear-num86.6%
associate-/r/87.2%
Applied egg-rr87.2%
Taylor expanded in z around inf 64.6%
associate-*r/60.2%
neg-mul-160.2%
distribute-rgt-neg-in60.2%
distribute-neg-frac60.2%
Simplified60.2%
Final simplification61.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* z (/ y (- a)))) (t_2 (* (/ y a) t)))
(if (<= a -7.6e+35)
x
(if (<= a -2.4e-132)
t_2
(if (<= a -1.1e-230)
t_1
(if (<= a -5e-307) t_2 (if (<= a 1.05e-49) t_1 x)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = z * (y / -a);
double t_2 = (y / a) * t;
double tmp;
if (a <= -7.6e+35) {
tmp = x;
} else if (a <= -2.4e-132) {
tmp = t_2;
} else if (a <= -1.1e-230) {
tmp = t_1;
} else if (a <= -5e-307) {
tmp = t_2;
} else if (a <= 1.05e-49) {
tmp = t_1;
} 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = z * (y / -a)
t_2 = (y / a) * t
if (a <= (-7.6d+35)) then
tmp = x
else if (a <= (-2.4d-132)) then
tmp = t_2
else if (a <= (-1.1d-230)) then
tmp = t_1
else if (a <= (-5d-307)) then
tmp = t_2
else if (a <= 1.05d-49) then
tmp = t_1
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = z * (y / -a);
double t_2 = (y / a) * t;
double tmp;
if (a <= -7.6e+35) {
tmp = x;
} else if (a <= -2.4e-132) {
tmp = t_2;
} else if (a <= -1.1e-230) {
tmp = t_1;
} else if (a <= -5e-307) {
tmp = t_2;
} else if (a <= 1.05e-49) {
tmp = t_1;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = z * (y / -a) t_2 = (y / a) * t tmp = 0 if a <= -7.6e+35: tmp = x elif a <= -2.4e-132: tmp = t_2 elif a <= -1.1e-230: tmp = t_1 elif a <= -5e-307: tmp = t_2 elif a <= 1.05e-49: tmp = t_1 else: tmp = x return tmp
function code(x, y, z, t, a) t_1 = Float64(z * Float64(y / Float64(-a))) t_2 = Float64(Float64(y / a) * t) tmp = 0.0 if (a <= -7.6e+35) tmp = x; elseif (a <= -2.4e-132) tmp = t_2; elseif (a <= -1.1e-230) tmp = t_1; elseif (a <= -5e-307) tmp = t_2; elseif (a <= 1.05e-49) tmp = t_1; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = z * (y / -a); t_2 = (y / a) * t; tmp = 0.0; if (a <= -7.6e+35) tmp = x; elseif (a <= -2.4e-132) tmp = t_2; elseif (a <= -1.1e-230) tmp = t_1; elseif (a <= -5e-307) tmp = t_2; elseif (a <= 1.05e-49) tmp = t_1; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(z * N[(y / (-a)), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[a, -7.6e+35], x, If[LessEqual[a, -2.4e-132], t$95$2, If[LessEqual[a, -1.1e-230], t$95$1, If[LessEqual[a, -5e-307], t$95$2, If[LessEqual[a, 1.05e-49], t$95$1, x]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \frac{y}{-a}\\
t_2 := \frac{y}{a} \cdot t\\
\mathbf{if}\;a \leq -7.6 \cdot 10^{+35}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq -2.4 \cdot 10^{-132}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;a \leq -1.1 \cdot 10^{-230}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \leq -5 \cdot 10^{-307}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;a \leq 1.05 \cdot 10^{-49}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -7.5999999999999999e35 or 1.0499999999999999e-49 < a Initial program 94.5%
associate-*l/98.8%
Simplified98.8%
Taylor expanded in x around inf 63.4%
if -7.5999999999999999e35 < a < -2.40000000000000015e-132 or -1.0999999999999999e-230 < a < -5.00000000000000014e-307Initial program 99.8%
associate-*l/99.8%
Simplified99.8%
Taylor expanded in t around inf 61.8%
associate-*r/63.4%
Simplified63.4%
if -2.40000000000000015e-132 < a < -1.0999999999999999e-230 or -5.00000000000000014e-307 < a < 1.0499999999999999e-49Initial program 99.5%
associate-*l/96.0%
Simplified96.0%
Taylor expanded in z around inf 62.2%
mul-1-neg62.2%
associate-*l/62.5%
*-commutative62.5%
distribute-rgt-neg-in62.5%
*-lft-identity62.5%
associate-*l/62.5%
remove-double-neg62.5%
neg-mul-162.5%
associate-*r*62.5%
*-commutative62.5%
neg-mul-162.5%
*-commutative62.5%
distribute-neg-frac62.5%
metadata-eval62.5%
metadata-eval62.5%
associate-/r*62.5%
neg-mul-162.5%
associate-*r/62.5%
*-rgt-identity62.5%
distribute-frac-neg62.5%
remove-double-neg62.5%
Simplified62.5%
Final simplification63.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1e+140) (not (<= z 5.6e+102))) (* z (/ y (- a))) (+ x (* y (/ t a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1e+140) || !(z <= 5.6e+102)) {
tmp = z * (y / -a);
} else {
tmp = x + (y * (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 ((z <= (-1d+140)) .or. (.not. (z <= 5.6d+102))) then
tmp = z * (y / -a)
else
tmp = x + (y * (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 ((z <= -1e+140) || !(z <= 5.6e+102)) {
tmp = z * (y / -a);
} else {
tmp = x + (y * (t / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1e+140) or not (z <= 5.6e+102): tmp = z * (y / -a) else: tmp = x + (y * (t / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1e+140) || !(z <= 5.6e+102)) tmp = Float64(z * Float64(y / Float64(-a))); else tmp = Float64(x + Float64(y * Float64(t / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1e+140) || ~((z <= 5.6e+102))) tmp = z * (y / -a); else tmp = x + (y * (t / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1e+140], N[Not[LessEqual[z, 5.6e+102]], $MachinePrecision]], N[(z * N[(y / (-a)), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{+140} \lor \neg \left(z \leq 5.6 \cdot 10^{+102}\right):\\
\;\;\;\;z \cdot \frac{y}{-a}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\end{array}
\end{array}
if z < -1.00000000000000006e140 or 5.60000000000000037e102 < z Initial program 94.3%
associate-*l/99.3%
Simplified99.3%
Taylor expanded in z around inf 66.8%
mul-1-neg66.8%
associate-*l/70.7%
*-commutative70.7%
distribute-rgt-neg-in70.7%
*-lft-identity70.7%
associate-*l/70.7%
remove-double-neg70.7%
neg-mul-170.7%
associate-*r*70.7%
*-commutative70.7%
neg-mul-170.7%
*-commutative70.7%
distribute-neg-frac70.7%
metadata-eval70.7%
metadata-eval70.7%
associate-/r*70.7%
neg-mul-170.7%
associate-*r/70.7%
*-rgt-identity70.7%
distribute-frac-neg70.7%
remove-double-neg70.7%
Simplified70.7%
if -1.00000000000000006e140 < z < 5.60000000000000037e102Initial program 98.6%
sub-neg98.6%
distribute-frac-neg98.6%
distribute-lft-neg-out98.6%
+-commutative98.6%
distribute-lft-neg-out98.6%
distribute-rgt-neg-in98.6%
associate-*l/97.7%
fma-def97.7%
sub-neg97.7%
distribute-neg-in97.7%
remove-double-neg97.7%
+-commutative97.7%
sub-neg97.7%
Simplified97.7%
Taylor expanded in z around 0 87.1%
associate-/l*87.9%
associate-/r/82.9%
Applied egg-rr82.9%
Final simplification78.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -3.3e+143) (not (<= z 1.7e+102))) (* z (/ y (- a))) (+ x (/ (* y t) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -3.3e+143) || !(z <= 1.7e+102)) {
tmp = z * (y / -a);
} else {
tmp = x + ((y * 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 ((z <= (-3.3d+143)) .or. (.not. (z <= 1.7d+102))) then
tmp = z * (y / -a)
else
tmp = x + ((y * 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 ((z <= -3.3e+143) || !(z <= 1.7e+102)) {
tmp = z * (y / -a);
} else {
tmp = x + ((y * t) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -3.3e+143) or not (z <= 1.7e+102): tmp = z * (y / -a) else: tmp = x + ((y * t) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -3.3e+143) || !(z <= 1.7e+102)) tmp = Float64(z * Float64(y / Float64(-a))); else tmp = Float64(x + Float64(Float64(y * t) / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -3.3e+143) || ~((z <= 1.7e+102))) tmp = z * (y / -a); else tmp = x + ((y * t) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -3.3e+143], N[Not[LessEqual[z, 1.7e+102]], $MachinePrecision]], N[(z * N[(y / (-a)), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.3 \cdot 10^{+143} \lor \neg \left(z \leq 1.7 \cdot 10^{+102}\right):\\
\;\;\;\;z \cdot \frac{y}{-a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot t}{a}\\
\end{array}
\end{array}
if z < -3.3e143 or 1.7e102 < z Initial program 94.3%
associate-*l/99.3%
Simplified99.3%
Taylor expanded in z around inf 66.8%
mul-1-neg66.8%
associate-*l/70.7%
*-commutative70.7%
distribute-rgt-neg-in70.7%
*-lft-identity70.7%
associate-*l/70.7%
remove-double-neg70.7%
neg-mul-170.7%
associate-*r*70.7%
*-commutative70.7%
neg-mul-170.7%
*-commutative70.7%
distribute-neg-frac70.7%
metadata-eval70.7%
metadata-eval70.7%
associate-/r*70.7%
neg-mul-170.7%
associate-*r/70.7%
*-rgt-identity70.7%
distribute-frac-neg70.7%
remove-double-neg70.7%
Simplified70.7%
if -3.3e143 < z < 1.7e102Initial program 98.6%
sub-neg98.6%
distribute-frac-neg98.6%
distribute-lft-neg-out98.6%
+-commutative98.6%
distribute-lft-neg-out98.6%
distribute-rgt-neg-in98.6%
associate-*l/97.7%
fma-def97.7%
sub-neg97.7%
distribute-neg-in97.7%
remove-double-neg97.7%
+-commutative97.7%
sub-neg97.7%
Simplified97.7%
Taylor expanded in z around 0 87.1%
Final simplification81.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -5.5e+136) (not (<= z 1.1e+37))) (- x (* (/ y a) z)) (+ x (/ (* y t) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -5.5e+136) || !(z <= 1.1e+37)) {
tmp = x - ((y / a) * z);
} else {
tmp = x + ((y * 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 ((z <= (-5.5d+136)) .or. (.not. (z <= 1.1d+37))) then
tmp = x - ((y / a) * z)
else
tmp = x + ((y * 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 ((z <= -5.5e+136) || !(z <= 1.1e+37)) {
tmp = x - ((y / a) * z);
} else {
tmp = x + ((y * t) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -5.5e+136) or not (z <= 1.1e+37): tmp = x - ((y / a) * z) else: tmp = x + ((y * t) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -5.5e+136) || !(z <= 1.1e+37)) tmp = Float64(x - Float64(Float64(y / a) * z)); else tmp = Float64(x + Float64(Float64(y * t) / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -5.5e+136) || ~((z <= 1.1e+37))) tmp = x - ((y / a) * z); else tmp = x + ((y * t) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -5.5e+136], N[Not[LessEqual[z, 1.1e+37]], $MachinePrecision]], N[(x - N[(N[(y / a), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.5 \cdot 10^{+136} \lor \neg \left(z \leq 1.1 \cdot 10^{+37}\right):\\
\;\;\;\;x - \frac{y}{a} \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot t}{a}\\
\end{array}
\end{array}
if z < -5.50000000000000039e136 or 1.1e37 < z Initial program 94.7%
associate-*l/99.3%
Simplified99.3%
Taylor expanded in z around inf 89.1%
associate-*l/92.8%
*-commutative92.8%
Simplified92.8%
if -5.50000000000000039e136 < z < 1.1e37Initial program 98.5%
sub-neg98.5%
distribute-frac-neg98.5%
distribute-lft-neg-out98.5%
+-commutative98.5%
distribute-lft-neg-out98.5%
distribute-rgt-neg-in98.5%
associate-*l/97.6%
fma-def97.6%
sub-neg97.6%
distribute-neg-in97.6%
remove-double-neg97.6%
+-commutative97.6%
sub-neg97.6%
Simplified97.6%
Taylor expanded in z around 0 87.9%
Final simplification89.7%
(FPCore (x y z t a) :precision binary64 (if (<= a -1.6e+65) x (if (<= a 1.75) (* y (/ (- t z) a)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.6e+65) {
tmp = x;
} else if (a <= 1.75) {
tmp = y * ((t - z) / a);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (a <= (-1.6d+65)) then
tmp = x
else if (a <= 1.75d0) then
tmp = y * ((t - z) / a)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.6e+65) {
tmp = x;
} else if (a <= 1.75) {
tmp = y * ((t - z) / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -1.6e+65: tmp = x elif a <= 1.75: tmp = y * ((t - z) / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.6e+65) tmp = x; elseif (a <= 1.75) tmp = Float64(y * Float64(Float64(t - z) / a)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -1.6e+65) tmp = x; elseif (a <= 1.75) tmp = y * ((t - z) / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.6e+65], x, If[LessEqual[a, 1.75], N[(y * N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.6 \cdot 10^{+65}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 1.75:\\
\;\;\;\;y \cdot \frac{t - z}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -1.60000000000000003e65 or 1.75 < a Initial program 94.0%
associate-*l/98.9%
Simplified98.9%
Taylor expanded in x around inf 66.3%
if -1.60000000000000003e65 < a < 1.75Initial program 99.6%
associate-*l/97.7%
Simplified97.7%
Taylor expanded in x around 0 78.8%
mul-1-neg78.8%
associate-*r/67.3%
distribute-rgt-neg-out67.3%
*-rgt-identity67.3%
*-rgt-identity67.3%
distribute-neg-frac67.3%
neg-sub067.3%
associate--r-67.3%
neg-sub067.3%
+-commutative67.3%
sub-neg67.3%
Simplified67.3%
Final simplification66.9%
(FPCore (x y z t a) :precision binary64 (if (<= a -3.1e+36) x (if (<= a 5.5e-49) (* (/ y a) t) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -3.1e+36) {
tmp = x;
} else if (a <= 5.5e-49) {
tmp = (y / a) * t;
} 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 <= (-3.1d+36)) then
tmp = x
else if (a <= 5.5d-49) then
tmp = (y / a) * t
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 <= -3.1e+36) {
tmp = x;
} else if (a <= 5.5e-49) {
tmp = (y / a) * t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -3.1e+36: tmp = x elif a <= 5.5e-49: tmp = (y / a) * t else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -3.1e+36) tmp = x; elseif (a <= 5.5e-49) tmp = Float64(Float64(y / a) * t); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -3.1e+36) tmp = x; elseif (a <= 5.5e-49) tmp = (y / a) * t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -3.1e+36], x, If[LessEqual[a, 5.5e-49], N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.1 \cdot 10^{+36}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 5.5 \cdot 10^{-49}:\\
\;\;\;\;\frac{y}{a} \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -3.0999999999999999e36 or 5.50000000000000031e-49 < a Initial program 94.5%
associate-*l/98.8%
Simplified98.8%
Taylor expanded in x around inf 63.4%
if -3.0999999999999999e36 < a < 5.50000000000000031e-49Initial program 99.6%
associate-*l/97.7%
Simplified97.7%
Taylor expanded in t around inf 48.0%
associate-*r/51.1%
Simplified51.1%
Final simplification57.0%
(FPCore (x y z t a) :precision binary64 (+ x (* (/ y a) (- t z))))
double code(double x, double y, double z, double t, double a) {
return x + ((y / a) * (t - z));
}
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 / a) * (t - z))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y / a) * (t - z));
}
def code(x, y, z, t, a): return x + ((y / a) * (t - z))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y / a) * Float64(t - z))) end
function tmp = code(x, y, z, t, a) tmp = x + ((y / a) * (t - z)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{a} \cdot \left(t - z\right)
\end{array}
Initial program 97.2%
associate-*l/98.2%
Simplified98.2%
Final simplification98.2%
(FPCore (x y z t a) :precision binary64 x)
double code(double x, double y, double z, double t, double a) {
return x;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x
end function
public static double code(double x, double y, double z, double t, double a) {
return x;
}
def code(x, y, z, t, a): return x
function code(x, y, z, t, a) return x end
function tmp = code(x, y, z, t, a) tmp = x; end
code[x_, y_, z_, t_, a_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 97.2%
associate-*l/98.2%
Simplified98.2%
Taylor expanded in x around inf 40.8%
Final simplification40.8%
(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 2024017
(FPCore (x y z t a)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, F"
: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)))