
(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
(let* ((t_1 (* y (- z t))))
(if (<= t_1 (- INFINITY))
(+ x (/ y (/ a (- z t))))
(if (<= t_1 2e+72) (+ x (/ t_1 a)) (+ x (* y (/ (- z t) a)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y * (z - t);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = x + (y / (a / (z - t)));
} else if (t_1 <= 2e+72) {
tmp = x + (t_1 / a);
} else {
tmp = x + (y * ((z - t) / a));
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = y * (z - t);
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = x + (y / (a / (z - t)));
} else if (t_1 <= 2e+72) {
tmp = x + (t_1 / a);
} else {
tmp = x + (y * ((z - t) / a));
}
return tmp;
}
def code(x, y, z, t, a): t_1 = y * (z - t) tmp = 0 if t_1 <= -math.inf: tmp = x + (y / (a / (z - t))) elif t_1 <= 2e+72: tmp = x + (t_1 / a) else: tmp = x + (y * ((z - t) / a)) return tmp
function code(x, y, z, t, a) t_1 = Float64(y * Float64(z - t)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(x + Float64(y / Float64(a / Float64(z - t)))); elseif (t_1 <= 2e+72) tmp = Float64(x + Float64(t_1 / a)); else tmp = Float64(x + Float64(y * Float64(Float64(z - t) / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = y * (z - t); tmp = 0.0; if (t_1 <= -Inf) tmp = x + (y / (a / (z - t))); elseif (t_1 <= 2e+72) tmp = x + (t_1 / a); else tmp = x + (y * ((z - t) / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(x + N[(y / N[(a / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+72], N[(x + N[(t$95$1 / a), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(z - t\right)\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;x + \frac{y}{\frac{a}{z - t}}\\
\mathbf{elif}\;t_1 \leq 2 \cdot 10^{+72}:\\
\;\;\;\;x + \frac{t_1}{a}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z - t}{a}\\
\end{array}
\end{array}
if (*.f64 y (-.f64 z t)) < -inf.0Initial program 71.4%
associate-/l*99.9%
Simplified99.9%
if -inf.0 < (*.f64 y (-.f64 z t)) < 1.99999999999999989e72Initial program 99.9%
if 1.99999999999999989e72 < (*.f64 y (-.f64 z t)) Initial program 85.2%
+-commutative85.2%
associate-*r/99.9%
fma-udef99.9%
Simplified99.9%
fma-udef99.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (/ z (/ a y)))) (t_2 (* t (- (/ y a)))))
(if (<= t -2.8e+161)
t_2
(if (<= t 4.5e+141)
t_1
(if (<= t 1.02e+226)
(/ (* y t) (- a))
(if (<= t 1.08e+282) t_1 t_2))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (z / (a / y));
double t_2 = t * -(y / a);
double tmp;
if (t <= -2.8e+161) {
tmp = t_2;
} else if (t <= 4.5e+141) {
tmp = t_1;
} else if (t <= 1.02e+226) {
tmp = (y * t) / -a;
} else if (t <= 1.08e+282) {
tmp = t_1;
} else {
tmp = t_2;
}
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 = x + (z / (a / y))
t_2 = t * -(y / a)
if (t <= (-2.8d+161)) then
tmp = t_2
else if (t <= 4.5d+141) then
tmp = t_1
else if (t <= 1.02d+226) then
tmp = (y * t) / -a
else if (t <= 1.08d+282) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x + (z / (a / y));
double t_2 = t * -(y / a);
double tmp;
if (t <= -2.8e+161) {
tmp = t_2;
} else if (t <= 4.5e+141) {
tmp = t_1;
} else if (t <= 1.02e+226) {
tmp = (y * t) / -a;
} else if (t <= 1.08e+282) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (z / (a / y)) t_2 = t * -(y / a) tmp = 0 if t <= -2.8e+161: tmp = t_2 elif t <= 4.5e+141: tmp = t_1 elif t <= 1.02e+226: tmp = (y * t) / -a elif t <= 1.08e+282: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(z / Float64(a / y))) t_2 = Float64(t * Float64(-Float64(y / a))) tmp = 0.0 if (t <= -2.8e+161) tmp = t_2; elseif (t <= 4.5e+141) tmp = t_1; elseif (t <= 1.02e+226) tmp = Float64(Float64(y * t) / Float64(-a)); elseif (t <= 1.08e+282) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (z / (a / y)); t_2 = t * -(y / a); tmp = 0.0; if (t <= -2.8e+161) tmp = t_2; elseif (t <= 4.5e+141) tmp = t_1; elseif (t <= 1.02e+226) tmp = (y * t) / -a; elseif (t <= 1.08e+282) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(z / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t * (-N[(y / a), $MachinePrecision])), $MachinePrecision]}, If[LessEqual[t, -2.8e+161], t$95$2, If[LessEqual[t, 4.5e+141], t$95$1, If[LessEqual[t, 1.02e+226], N[(N[(y * t), $MachinePrecision] / (-a)), $MachinePrecision], If[LessEqual[t, 1.08e+282], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{z}{\frac{a}{y}}\\
t_2 := t \cdot \left(-\frac{y}{a}\right)\\
\mathbf{if}\;t \leq -2.8 \cdot 10^{+161}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t \leq 4.5 \cdot 10^{+141}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 1.02 \cdot 10^{+226}:\\
\;\;\;\;\frac{y \cdot t}{-a}\\
\mathbf{elif}\;t \leq 1.08 \cdot 10^{+282}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if t < -2.80000000000000021e161 or 1.08000000000000004e282 < t Initial program 97.2%
+-commutative97.2%
associate-*r/97.1%
fma-udef97.1%
Simplified97.1%
fma-udef97.1%
Applied egg-rr97.1%
Taylor expanded in z around 0 94.2%
mul-1-neg94.2%
associate-*r/96.2%
sub-neg96.2%
Simplified96.2%
Taylor expanded in x around 0 76.7%
mul-1-neg76.7%
associate-*r/78.8%
distribute-rgt-neg-out78.8%
distribute-neg-frac78.8%
Simplified78.8%
if -2.80000000000000021e161 < t < 4.5000000000000002e141 or 1.02e226 < t < 1.08000000000000004e282Initial program 92.0%
+-commutative92.0%
associate-*r/94.2%
fma-udef94.2%
Simplified94.2%
fma-udef94.2%
Applied egg-rr94.2%
Taylor expanded in z around inf 77.2%
associate-*r/79.1%
Simplified79.1%
associate-*r/77.2%
*-commutative77.2%
associate-/l*81.1%
Applied egg-rr81.1%
if 4.5000000000000002e141 < t < 1.02e226Initial program 95.5%
+-commutative95.5%
associate-*r/95.6%
fma-udef95.6%
Simplified95.6%
fma-udef95.6%
Applied egg-rr95.6%
Taylor expanded in z around 0 90.9%
mul-1-neg90.9%
associate-*r/87.0%
sub-neg87.0%
Simplified87.0%
Taylor expanded in x around 0 66.7%
mul-1-neg66.7%
associate-*r/65.0%
distribute-rgt-neg-out65.0%
distribute-neg-frac65.0%
Simplified65.0%
frac-2neg65.0%
remove-double-neg65.0%
associate-*r/66.7%
Applied egg-rr66.7%
Final simplification79.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* y (- z t))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 2e+229)))
(+ x (/ y (/ a (- z t))))
(+ x (/ t_1 a)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y * (z - t);
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 2e+229)) {
tmp = x + (y / (a / (z - t)));
} else {
tmp = x + (t_1 / a);
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = y * (z - t);
double tmp;
if ((t_1 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 2e+229)) {
tmp = x + (y / (a / (z - t)));
} else {
tmp = x + (t_1 / a);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = y * (z - t) tmp = 0 if (t_1 <= -math.inf) or not (t_1 <= 2e+229): tmp = x + (y / (a / (z - t))) else: tmp = x + (t_1 / a) return tmp
function code(x, y, z, t, a) t_1 = Float64(y * Float64(z - t)) tmp = 0.0 if ((t_1 <= Float64(-Inf)) || !(t_1 <= 2e+229)) tmp = Float64(x + Float64(y / Float64(a / Float64(z - t)))); else tmp = Float64(x + Float64(t_1 / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = y * (z - t); tmp = 0.0; if ((t_1 <= -Inf) || ~((t_1 <= 2e+229))) tmp = x + (y / (a / (z - t))); else tmp = x + (t_1 / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 2e+229]], $MachinePrecision]], N[(x + N[(y / N[(a / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(t$95$1 / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(z - t\right)\\
\mathbf{if}\;t_1 \leq -\infty \lor \neg \left(t_1 \leq 2 \cdot 10^{+229}\right):\\
\;\;\;\;x + \frac{y}{\frac{a}{z - t}}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{t_1}{a}\\
\end{array}
\end{array}
if (*.f64 y (-.f64 z t)) < -inf.0 or 2e229 < (*.f64 y (-.f64 z t)) Initial program 73.5%
associate-/l*100.0%
Simplified100.0%
if -inf.0 < (*.f64 y (-.f64 z t)) < 2e229Initial program 99.9%
Final simplification99.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -2.4e+101) (not (<= t 9.2e+68))) (- x (* t (/ y a))) (+ x (/ y (/ a z)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -2.4e+101) || !(t <= 9.2e+68)) {
tmp = x - (t * (y / a));
} else {
tmp = x + (y / (a / 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 <= (-2.4d+101)) .or. (.not. (t <= 9.2d+68))) then
tmp = x - (t * (y / a))
else
tmp = x + (y / (a / 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 <= -2.4e+101) || !(t <= 9.2e+68)) {
tmp = x - (t * (y / a));
} else {
tmp = x + (y / (a / z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -2.4e+101) or not (t <= 9.2e+68): tmp = x - (t * (y / a)) else: tmp = x + (y / (a / z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -2.4e+101) || !(t <= 9.2e+68)) tmp = Float64(x - Float64(t * Float64(y / a))); else tmp = Float64(x + Float64(y / Float64(a / z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -2.4e+101) || ~((t <= 9.2e+68))) tmp = x - (t * (y / a)); else tmp = x + (y / (a / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -2.4e+101], N[Not[LessEqual[t, 9.2e+68]], $MachinePrecision]], N[(x - N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.4 \cdot 10^{+101} \lor \neg \left(t \leq 9.2 \cdot 10^{+68}\right):\\
\;\;\;\;x - t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{a}{z}}\\
\end{array}
\end{array}
if t < -2.39999999999999988e101 or 9.1999999999999999e68 < t Initial program 93.1%
+-commutative93.1%
associate-*r/89.7%
fma-udef89.7%
Simplified89.7%
fma-udef89.7%
Applied egg-rr89.7%
Taylor expanded in z around 0 82.6%
mul-1-neg82.6%
associate-*r/85.7%
sub-neg85.7%
Simplified85.7%
if -2.39999999999999988e101 < t < 9.1999999999999999e68Initial program 92.9%
associate-/l*98.6%
Simplified98.6%
Taylor expanded in t around 0 81.3%
+-commutative81.3%
associate-/l*86.3%
Simplified86.3%
Final simplification86.1%
(FPCore (x y z t a) :precision binary64 (if (<= t -1e+161) (* t (- (/ y a))) (if (<= t 2.9e+141) (+ x (/ (* y z) a)) (/ (* y t) (- a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1e+161) {
tmp = t * -(y / a);
} else if (t <= 2.9e+141) {
tmp = x + ((y * z) / a);
} else {
tmp = (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 (t <= (-1d+161)) then
tmp = t * -(y / a)
else if (t <= 2.9d+141) then
tmp = x + ((y * z) / a)
else
tmp = (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 (t <= -1e+161) {
tmp = t * -(y / a);
} else if (t <= 2.9e+141) {
tmp = x + ((y * z) / a);
} else {
tmp = (y * t) / -a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -1e+161: tmp = t * -(y / a) elif t <= 2.9e+141: tmp = x + ((y * z) / a) else: tmp = (y * t) / -a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1e+161) tmp = Float64(t * Float64(-Float64(y / a))); elseif (t <= 2.9e+141) tmp = Float64(x + Float64(Float64(y * z) / a)); else tmp = Float64(Float64(y * t) / Float64(-a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -1e+161) tmp = t * -(y / a); elseif (t <= 2.9e+141) tmp = x + ((y * z) / a); else tmp = (y * t) / -a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1e+161], N[(t * (-N[(y / a), $MachinePrecision])), $MachinePrecision], If[LessEqual[t, 2.9e+141], N[(x + N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(N[(y * t), $MachinePrecision] / (-a)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1 \cdot 10^{+161}:\\
\;\;\;\;t \cdot \left(-\frac{y}{a}\right)\\
\mathbf{elif}\;t \leq 2.9 \cdot 10^{+141}:\\
\;\;\;\;x + \frac{y \cdot z}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot t}{-a}\\
\end{array}
\end{array}
if t < -1e161Initial program 96.6%
+-commutative96.6%
associate-*r/96.5%
fma-udef96.5%
Simplified96.5%
fma-udef96.5%
Applied egg-rr96.5%
Taylor expanded in z around 0 92.9%
mul-1-neg92.9%
associate-*r/95.4%
sub-neg95.4%
Simplified95.4%
Taylor expanded in x around 0 71.5%
mul-1-neg71.5%
associate-*r/74.0%
distribute-rgt-neg-out74.0%
distribute-neg-frac74.0%
Simplified74.0%
if -1e161 < t < 2.90000000000000007e141Initial program 91.9%
associate-/l*94.8%
Simplified94.8%
Taylor expanded in z around inf 78.2%
if 2.90000000000000007e141 < t Initial program 95.4%
+-commutative95.4%
associate-*r/97.6%
fma-udef97.6%
Simplified97.6%
fma-udef97.6%
Applied egg-rr97.6%
Taylor expanded in z around 0 88.1%
mul-1-neg88.1%
associate-*r/86.8%
sub-neg86.8%
Simplified86.8%
Taylor expanded in x around 0 61.0%
mul-1-neg61.0%
associate-*r/60.9%
distribute-rgt-neg-out60.9%
distribute-neg-frac60.9%
Simplified60.9%
frac-2neg60.9%
remove-double-neg60.9%
associate-*r/61.0%
Applied egg-rr61.0%
Final simplification75.0%
(FPCore (x y z t a) :precision binary64 (if (<= t -1.7e+103) (* t (- (/ y a))) (if (<= t 2.7e+141) (+ x (* y (/ z a))) (/ (* y t) (- a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.7e+103) {
tmp = t * -(y / a);
} else if (t <= 2.7e+141) {
tmp = x + (y * (z / a));
} else {
tmp = (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 (t <= (-1.7d+103)) then
tmp = t * -(y / a)
else if (t <= 2.7d+141) then
tmp = x + (y * (z / a))
else
tmp = (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 (t <= -1.7e+103) {
tmp = t * -(y / a);
} else if (t <= 2.7e+141) {
tmp = x + (y * (z / a));
} else {
tmp = (y * t) / -a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -1.7e+103: tmp = t * -(y / a) elif t <= 2.7e+141: tmp = x + (y * (z / a)) else: tmp = (y * t) / -a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.7e+103) tmp = Float64(t * Float64(-Float64(y / a))); elseif (t <= 2.7e+141) tmp = Float64(x + Float64(y * Float64(z / a))); else tmp = Float64(Float64(y * t) / Float64(-a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -1.7e+103) tmp = t * -(y / a); elseif (t <= 2.7e+141) tmp = x + (y * (z / a)); else tmp = (y * t) / -a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.7e+103], N[(t * (-N[(y / a), $MachinePrecision])), $MachinePrecision], If[LessEqual[t, 2.7e+141], N[(x + N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * t), $MachinePrecision] / (-a)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.7 \cdot 10^{+103}:\\
\;\;\;\;t \cdot \left(-\frac{y}{a}\right)\\
\mathbf{elif}\;t \leq 2.7 \cdot 10^{+141}:\\
\;\;\;\;x + y \cdot \frac{z}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot t}{-a}\\
\end{array}
\end{array}
if t < -1.6999999999999999e103Initial program 97.2%
+-commutative97.2%
associate-*r/91.0%
fma-udef91.0%
Simplified91.0%
fma-udef91.0%
Applied egg-rr91.0%
Taylor expanded in z around 0 91.3%
mul-1-neg91.3%
associate-*r/93.4%
sub-neg93.4%
Simplified93.4%
Taylor expanded in x around 0 67.8%
mul-1-neg67.8%
associate-*r/69.8%
distribute-rgt-neg-out69.8%
distribute-neg-frac69.8%
Simplified69.8%
if -1.6999999999999999e103 < t < 2.7000000000000001e141Initial program 91.7%
+-commutative91.7%
associate-*r/94.7%
fma-udef94.7%
Simplified94.7%
fma-udef94.7%
Applied egg-rr94.7%
Taylor expanded in z around inf 79.1%
associate-*r/81.7%
Simplified81.7%
if 2.7000000000000001e141 < t Initial program 95.4%
+-commutative95.4%
associate-*r/97.6%
fma-udef97.6%
Simplified97.6%
fma-udef97.6%
Applied egg-rr97.6%
Taylor expanded in z around 0 88.1%
mul-1-neg88.1%
associate-*r/86.8%
sub-neg86.8%
Simplified86.8%
Taylor expanded in x around 0 61.0%
mul-1-neg61.0%
associate-*r/60.9%
distribute-rgt-neg-out60.9%
distribute-neg-frac60.9%
Simplified60.9%
frac-2neg60.9%
remove-double-neg60.9%
associate-*r/61.0%
Applied egg-rr61.0%
Final simplification76.9%
(FPCore (x y z t a) :precision binary64 (if (<= t -5.6e+103) (* t (- (/ y a))) (if (<= t 2.85e+141) (+ x (/ y (/ a z))) (/ (* y t) (- a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -5.6e+103) {
tmp = t * -(y / a);
} else if (t <= 2.85e+141) {
tmp = x + (y / (a / z));
} else {
tmp = (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 (t <= (-5.6d+103)) then
tmp = t * -(y / a)
else if (t <= 2.85d+141) then
tmp = x + (y / (a / z))
else
tmp = (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 (t <= -5.6e+103) {
tmp = t * -(y / a);
} else if (t <= 2.85e+141) {
tmp = x + (y / (a / z));
} else {
tmp = (y * t) / -a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -5.6e+103: tmp = t * -(y / a) elif t <= 2.85e+141: tmp = x + (y / (a / z)) else: tmp = (y * t) / -a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -5.6e+103) tmp = Float64(t * Float64(-Float64(y / a))); elseif (t <= 2.85e+141) tmp = Float64(x + Float64(y / Float64(a / z))); else tmp = Float64(Float64(y * t) / Float64(-a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -5.6e+103) tmp = t * -(y / a); elseif (t <= 2.85e+141) tmp = x + (y / (a / z)); else tmp = (y * t) / -a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -5.6e+103], N[(t * (-N[(y / a), $MachinePrecision])), $MachinePrecision], If[LessEqual[t, 2.85e+141], N[(x + N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * t), $MachinePrecision] / (-a)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.6 \cdot 10^{+103}:\\
\;\;\;\;t \cdot \left(-\frac{y}{a}\right)\\
\mathbf{elif}\;t \leq 2.85 \cdot 10^{+141}:\\
\;\;\;\;x + \frac{y}{\frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot t}{-a}\\
\end{array}
\end{array}
if t < -5.60000000000000017e103Initial program 97.2%
+-commutative97.2%
associate-*r/91.0%
fma-udef91.0%
Simplified91.0%
fma-udef91.0%
Applied egg-rr91.0%
Taylor expanded in z around 0 91.3%
mul-1-neg91.3%
associate-*r/93.4%
sub-neg93.4%
Simplified93.4%
Taylor expanded in x around 0 67.8%
mul-1-neg67.8%
associate-*r/69.8%
distribute-rgt-neg-out69.8%
distribute-neg-frac69.8%
Simplified69.8%
if -5.60000000000000017e103 < t < 2.84999999999999999e141Initial program 91.7%
associate-/l*95.8%
Simplified95.8%
Taylor expanded in t around 0 79.1%
+-commutative79.1%
associate-/l*82.6%
Simplified82.6%
if 2.84999999999999999e141 < t Initial program 95.4%
+-commutative95.4%
associate-*r/97.6%
fma-udef97.6%
Simplified97.6%
fma-udef97.6%
Applied egg-rr97.6%
Taylor expanded in z around 0 88.1%
mul-1-neg88.1%
associate-*r/86.8%
sub-neg86.8%
Simplified86.8%
Taylor expanded in x around 0 61.0%
mul-1-neg61.0%
associate-*r/60.9%
distribute-rgt-neg-out60.9%
distribute-neg-frac60.9%
Simplified60.9%
frac-2neg60.9%
remove-double-neg60.9%
associate-*r/61.0%
Applied egg-rr61.0%
Final simplification77.5%
(FPCore (x y z t a) :precision binary64 (if (<= x -6.5e+60) x (if (<= x 2.25e+63) (* t (- (/ y a))) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -6.5e+60) {
tmp = x;
} else if (x <= 2.25e+63) {
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 (x <= (-6.5d+60)) then
tmp = x
else if (x <= 2.25d+63) 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 (x <= -6.5e+60) {
tmp = x;
} else if (x <= 2.25e+63) {
tmp = t * -(y / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -6.5e+60: tmp = x elif x <= 2.25e+63: tmp = t * -(y / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -6.5e+60) tmp = x; elseif (x <= 2.25e+63) 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 (x <= -6.5e+60) tmp = x; elseif (x <= 2.25e+63) tmp = t * -(y / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -6.5e+60], x, If[LessEqual[x, 2.25e+63], N[(t * (-N[(y / a), $MachinePrecision])), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.5 \cdot 10^{+60}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 2.25 \cdot 10^{+63}:\\
\;\;\;\;t \cdot \left(-\frac{y}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -6.49999999999999931e60 or 2.25000000000000008e63 < x Initial program 94.7%
associate-/l*96.4%
Simplified96.4%
Taylor expanded in x around inf 69.3%
if -6.49999999999999931e60 < x < 2.25000000000000008e63Initial program 91.8%
+-commutative91.8%
associate-*r/94.1%
fma-udef94.2%
Simplified94.2%
fma-udef94.1%
Applied egg-rr94.1%
Taylor expanded in z around 0 62.8%
mul-1-neg62.8%
associate-*r/63.5%
sub-neg63.5%
Simplified63.5%
Taylor expanded in x around 0 44.6%
mul-1-neg44.6%
associate-*r/45.6%
distribute-rgt-neg-out45.6%
distribute-neg-frac45.6%
Simplified45.6%
Final simplification55.5%
(FPCore (x y z t a) :precision binary64 (+ x (/ y (/ a (- z t)))))
double code(double x, double y, double z, double t, double a) {
return x + (y / (a / (z - t)));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (y / (a / (z - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y / (a / (z - t)));
}
def code(x, y, z, t, a): return x + (y / (a / (z - t)))
function code(x, y, z, t, a) return Float64(x + Float64(y / Float64(a / Float64(z - t)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y / (a / (z - t))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y / N[(a / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{\frac{a}{z - t}}
\end{array}
Initial program 93.0%
associate-/l*95.4%
Simplified95.4%
Final simplification95.4%
(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 93.0%
associate-/l*95.4%
Simplified95.4%
Taylor expanded in x around inf 41.0%
Final simplification41.0%
(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 2024021
(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)))