
(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 (+ 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(Float64(y / 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[(N[(y / a), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{a} \cdot \left(z - t\right)
\end{array}
Initial program 91.5%
associate-*l/97.8%
Simplified97.8%
Final simplification97.8%
(FPCore (x y z t a)
:precision binary64
(if (<= x -1.02e+123)
x
(if (<= x 9e-303)
(/ (* y z) a)
(if (<= x 2.2e-40)
(* y (/ (- t) a))
(if (<= x 6.6e+39) x (if (<= x 4.2e+108) (/ (* y (- t)) a) x))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -1.02e+123) {
tmp = x;
} else if (x <= 9e-303) {
tmp = (y * z) / a;
} else if (x <= 2.2e-40) {
tmp = y * (-t / a);
} else if (x <= 6.6e+39) {
tmp = x;
} else if (x <= 4.2e+108) {
tmp = (y * -t) / 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 <= (-1.02d+123)) then
tmp = x
else if (x <= 9d-303) then
tmp = (y * z) / a
else if (x <= 2.2d-40) then
tmp = y * (-t / a)
else if (x <= 6.6d+39) then
tmp = x
else if (x <= 4.2d+108) then
tmp = (y * -t) / 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 <= -1.02e+123) {
tmp = x;
} else if (x <= 9e-303) {
tmp = (y * z) / a;
} else if (x <= 2.2e-40) {
tmp = y * (-t / a);
} else if (x <= 6.6e+39) {
tmp = x;
} else if (x <= 4.2e+108) {
tmp = (y * -t) / a;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -1.02e+123: tmp = x elif x <= 9e-303: tmp = (y * z) / a elif x <= 2.2e-40: tmp = y * (-t / a) elif x <= 6.6e+39: tmp = x elif x <= 4.2e+108: tmp = (y * -t) / a else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -1.02e+123) tmp = x; elseif (x <= 9e-303) tmp = Float64(Float64(y * z) / a); elseif (x <= 2.2e-40) tmp = Float64(y * Float64(Float64(-t) / a)); elseif (x <= 6.6e+39) tmp = x; elseif (x <= 4.2e+108) tmp = Float64(Float64(y * Float64(-t)) / a); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -1.02e+123) tmp = x; elseif (x <= 9e-303) tmp = (y * z) / a; elseif (x <= 2.2e-40) tmp = y * (-t / a); elseif (x <= 6.6e+39) tmp = x; elseif (x <= 4.2e+108) tmp = (y * -t) / a; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -1.02e+123], x, If[LessEqual[x, 9e-303], N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[x, 2.2e-40], N[(y * N[((-t) / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 6.6e+39], x, If[LessEqual[x, 4.2e+108], N[(N[(y * (-t)), $MachinePrecision] / a), $MachinePrecision], x]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.02 \cdot 10^{+123}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 9 \cdot 10^{-303}:\\
\;\;\;\;\frac{y \cdot z}{a}\\
\mathbf{elif}\;x \leq 2.2 \cdot 10^{-40}:\\
\;\;\;\;y \cdot \frac{-t}{a}\\
\mathbf{elif}\;x \leq 6.6 \cdot 10^{+39}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 4.2 \cdot 10^{+108}:\\
\;\;\;\;\frac{y \cdot \left(-t\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1.02e123 or 2.20000000000000009e-40 < x < 6.60000000000000042e39 or 4.20000000000000019e108 < x Initial program 94.8%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in x around inf 68.6%
if -1.02e123 < x < 9.0000000000000002e-303Initial program 90.5%
associate-*l/97.0%
Simplified97.0%
associate-/r/90.4%
div-inv90.3%
associate-/r*96.8%
Applied egg-rr96.8%
+-commutative96.8%
associate-/r/97.0%
associate-/r/96.8%
div-inv96.9%
clear-num96.1%
frac-times96.2%
metadata-eval96.2%
div-inv96.3%
clear-num96.4%
flip-+47.9%
Applied egg-rr48.5%
Taylor expanded in y around -inf 72.1%
Taylor expanded in z around inf 48.7%
if 9.0000000000000002e-303 < x < 2.20000000000000009e-40Initial program 89.4%
associate-*l/94.4%
Simplified94.4%
Taylor expanded in z around 0 65.3%
mul-1-neg65.3%
associate-*l/65.3%
distribute-rgt-neg-out65.3%
Simplified65.3%
add-sqr-sqrt65.3%
fma-def65.3%
distribute-rgt-neg-out65.3%
add-sqr-sqrt26.5%
sqrt-unprod25.5%
sqr-neg25.5%
sqrt-unprod8.1%
add-sqr-sqrt14.2%
*-commutative14.2%
*-commutative14.2%
fma-neg14.2%
add-sqr-sqrt14.2%
add-sqr-sqrt8.1%
sqrt-unprod25.5%
sqr-neg25.5%
sqrt-unprod26.5%
add-sqr-sqrt65.3%
Applied egg-rr65.3%
Taylor expanded in x around 0 53.0%
mul-1-neg53.0%
associate-*r/56.5%
distribute-rgt-neg-out56.5%
Simplified56.5%
if 6.60000000000000042e39 < x < 4.20000000000000019e108Initial program 79.3%
associate-*l/99.9%
Simplified99.9%
associate-/r/81.5%
div-inv81.4%
associate-/r*99.8%
Applied egg-rr99.8%
+-commutative99.8%
associate-/r/99.9%
associate-/r/99.8%
div-inv99.8%
clear-num99.7%
frac-times99.5%
metadata-eval99.5%
div-inv99.8%
clear-num99.8%
flip-+16.4%
Applied egg-rr16.4%
Taylor expanded in y around -inf 79.3%
Taylor expanded in z around 0 59.1%
mul-1-neg59.1%
distribute-rgt-neg-out59.1%
Simplified59.1%
Final simplification59.3%
(FPCore (x y z t a)
:precision binary64
(if (<= x -1.75e+124)
x
(if (or (<= x 1.7e-33) (and (not (<= x 1400000000000.0)) (<= x 4.5e+106)))
(/ (* y z) a)
x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -1.75e+124) {
tmp = x;
} else if ((x <= 1.7e-33) || (!(x <= 1400000000000.0) && (x <= 4.5e+106))) {
tmp = (y * 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 (x <= (-1.75d+124)) then
tmp = x
else if ((x <= 1.7d-33) .or. (.not. (x <= 1400000000000.0d0)) .and. (x <= 4.5d+106)) then
tmp = (y * 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 (x <= -1.75e+124) {
tmp = x;
} else if ((x <= 1.7e-33) || (!(x <= 1400000000000.0) && (x <= 4.5e+106))) {
tmp = (y * z) / a;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -1.75e+124: tmp = x elif (x <= 1.7e-33) or (not (x <= 1400000000000.0) and (x <= 4.5e+106)): tmp = (y * z) / a else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -1.75e+124) tmp = x; elseif ((x <= 1.7e-33) || (!(x <= 1400000000000.0) && (x <= 4.5e+106))) tmp = Float64(Float64(y * z) / a); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -1.75e+124) tmp = x; elseif ((x <= 1.7e-33) || (~((x <= 1400000000000.0)) && (x <= 4.5e+106))) tmp = (y * z) / a; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -1.75e+124], x, If[Or[LessEqual[x, 1.7e-33], And[N[Not[LessEqual[x, 1400000000000.0]], $MachinePrecision], LessEqual[x, 4.5e+106]]], N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.75 \cdot 10^{+124}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.7 \cdot 10^{-33} \lor \neg \left(x \leq 1400000000000\right) \land x \leq 4.5 \cdot 10^{+106}:\\
\;\;\;\;\frac{y \cdot z}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1.7500000000000001e124 or 1.7e-33 < x < 1.4e12 or 4.4999999999999997e106 < x Initial program 94.7%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in x around inf 69.6%
if -1.7500000000000001e124 < x < 1.7e-33 or 1.4e12 < x < 4.4999999999999997e106Initial program 89.2%
associate-*l/96.4%
Simplified96.4%
associate-/r/91.9%
div-inv91.8%
associate-/r*96.3%
Applied egg-rr96.3%
+-commutative96.3%
associate-/r/96.4%
associate-/r/96.3%
div-inv96.3%
clear-num95.9%
frac-times95.9%
metadata-eval95.9%
div-inv96.0%
clear-num96.1%
flip-+40.8%
Applied egg-rr41.2%
Taylor expanded in y around -inf 74.4%
Taylor expanded in z around inf 43.0%
Final simplification53.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* y (/ (- t) a))))
(if (<= t -3200000.0)
t_1
(if (<= t 1e-78) x (if (<= t 1.5e+30) (/ (* y z) a) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y * (-t / a);
double tmp;
if (t <= -3200000.0) {
tmp = t_1;
} else if (t <= 1e-78) {
tmp = x;
} else if (t <= 1.5e+30) {
tmp = (y * z) / a;
} else {
tmp = 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 = y * (-t / a)
if (t <= (-3200000.0d0)) then
tmp = t_1
else if (t <= 1d-78) then
tmp = x
else if (t <= 1.5d+30) then
tmp = (y * z) / a
else
tmp = 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 = y * (-t / a);
double tmp;
if (t <= -3200000.0) {
tmp = t_1;
} else if (t <= 1e-78) {
tmp = x;
} else if (t <= 1.5e+30) {
tmp = (y * z) / a;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = y * (-t / a) tmp = 0 if t <= -3200000.0: tmp = t_1 elif t <= 1e-78: tmp = x elif t <= 1.5e+30: tmp = (y * z) / a else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(y * Float64(Float64(-t) / a)) tmp = 0.0 if (t <= -3200000.0) tmp = t_1; elseif (t <= 1e-78) tmp = x; elseif (t <= 1.5e+30) tmp = Float64(Float64(y * z) / a); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = y * (-t / a); tmp = 0.0; if (t <= -3200000.0) tmp = t_1; elseif (t <= 1e-78) tmp = x; elseif (t <= 1.5e+30) tmp = (y * z) / a; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[((-t) / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -3200000.0], t$95$1, If[LessEqual[t, 1e-78], x, If[LessEqual[t, 1.5e+30], N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{-t}{a}\\
\mathbf{if}\;t \leq -3200000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 10^{-78}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 1.5 \cdot 10^{+30}:\\
\;\;\;\;\frac{y \cdot z}{a}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if t < -3.2e6 or 1.49999999999999989e30 < t Initial program 89.8%
associate-*l/98.3%
Simplified98.3%
Taylor expanded in z around 0 79.3%
mul-1-neg79.3%
associate-*l/83.9%
distribute-rgt-neg-out83.9%
Simplified83.9%
add-sqr-sqrt46.7%
fma-def46.7%
distribute-rgt-neg-out46.7%
add-sqr-sqrt20.7%
sqrt-unprod15.1%
sqr-neg15.1%
sqrt-unprod5.4%
add-sqr-sqrt10.6%
*-commutative10.6%
*-commutative10.6%
fma-neg10.6%
add-sqr-sqrt25.2%
add-sqr-sqrt12.2%
sqrt-unprod34.6%
sqr-neg34.6%
sqrt-unprod43.7%
add-sqr-sqrt83.9%
Applied egg-rr83.9%
Taylor expanded in x around 0 56.9%
mul-1-neg56.9%
associate-*r/57.6%
distribute-rgt-neg-out57.6%
Simplified57.6%
if -3.2e6 < t < 9.99999999999999999e-79Initial program 93.9%
associate-*l/97.8%
Simplified97.8%
Taylor expanded in x around inf 54.7%
if 9.99999999999999999e-79 < t < 1.49999999999999989e30Initial program 88.5%
associate-*l/95.8%
Simplified95.8%
associate-/r/96.0%
div-inv96.1%
associate-/r*95.9%
Applied egg-rr95.9%
+-commutative95.9%
associate-/r/95.8%
associate-/r/95.9%
div-inv95.8%
clear-num95.7%
frac-times95.8%
metadata-eval95.8%
div-inv95.7%
clear-num95.8%
flip-+31.4%
Applied egg-rr31.4%
Taylor expanded in y around -inf 60.8%
Taylor expanded in z around inf 55.4%
Final simplification56.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -4.1e+164) (not (<= t 6.5e+155))) (/ (* y (- t)) a) (+ x (* y (/ z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -4.1e+164) || !(t <= 6.5e+155)) {
tmp = (y * -t) / 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 <= (-4.1d+164)) .or. (.not. (t <= 6.5d+155))) then
tmp = (y * -t) / 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 <= -4.1e+164) || !(t <= 6.5e+155)) {
tmp = (y * -t) / a;
} else {
tmp = x + (y * (z / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -4.1e+164) or not (t <= 6.5e+155): tmp = (y * -t) / a else: tmp = x + (y * (z / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -4.1e+164) || !(t <= 6.5e+155)) tmp = Float64(Float64(y * Float64(-t)) / a); else tmp = Float64(x + Float64(y * Float64(z / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -4.1e+164) || ~((t <= 6.5e+155))) tmp = (y * -t) / a; else tmp = x + (y * (z / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -4.1e+164], N[Not[LessEqual[t, 6.5e+155]], $MachinePrecision]], N[(N[(y * (-t)), $MachinePrecision] / a), $MachinePrecision], N[(x + N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.1 \cdot 10^{+164} \lor \neg \left(t \leq 6.5 \cdot 10^{+155}\right):\\
\;\;\;\;\frac{y \cdot \left(-t\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{a}\\
\end{array}
\end{array}
if t < -4.10000000000000016e164 or 6.50000000000000046e155 < t Initial program 92.1%
associate-*l/96.6%
Simplified96.6%
associate-/r/87.4%
div-inv87.4%
associate-/r*96.6%
Applied egg-rr96.6%
+-commutative96.6%
associate-/r/96.6%
associate-/r/96.6%
div-inv96.5%
clear-num96.4%
frac-times96.4%
metadata-eval96.4%
div-inv96.6%
clear-num96.7%
flip-+23.9%
Applied egg-rr23.9%
Taylor expanded in y around -inf 71.0%
Taylor expanded in z around 0 68.6%
mul-1-neg68.6%
distribute-rgt-neg-out68.6%
Simplified68.6%
if -4.10000000000000016e164 < t < 6.50000000000000046e155Initial program 91.3%
associate-/l*94.6%
Simplified94.6%
Taylor expanded in z around inf 78.7%
div-inv78.7%
clear-num78.7%
Applied egg-rr78.7%
Final simplification76.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -3.95e+164) (not (<= t 8e+155))) (/ (* y (- t)) a) (+ x (/ y (/ a z)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -3.95e+164) || !(t <= 8e+155)) {
tmp = (y * -t) / 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 <= (-3.95d+164)) .or. (.not. (t <= 8d+155))) then
tmp = (y * -t) / 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 <= -3.95e+164) || !(t <= 8e+155)) {
tmp = (y * -t) / a;
} else {
tmp = x + (y / (a / z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -3.95e+164) or not (t <= 8e+155): tmp = (y * -t) / a else: tmp = x + (y / (a / z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -3.95e+164) || !(t <= 8e+155)) tmp = Float64(Float64(y * Float64(-t)) / 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 <= -3.95e+164) || ~((t <= 8e+155))) tmp = (y * -t) / a; else tmp = x + (y / (a / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -3.95e+164], N[Not[LessEqual[t, 8e+155]], $MachinePrecision]], N[(N[(y * (-t)), $MachinePrecision] / a), $MachinePrecision], N[(x + N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.95 \cdot 10^{+164} \lor \neg \left(t \leq 8 \cdot 10^{+155}\right):\\
\;\;\;\;\frac{y \cdot \left(-t\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{a}{z}}\\
\end{array}
\end{array}
if t < -3.95000000000000019e164 or 8.00000000000000006e155 < t Initial program 92.1%
associate-*l/96.6%
Simplified96.6%
associate-/r/87.4%
div-inv87.4%
associate-/r*96.6%
Applied egg-rr96.6%
+-commutative96.6%
associate-/r/96.6%
associate-/r/96.6%
div-inv96.5%
clear-num96.4%
frac-times96.4%
metadata-eval96.4%
div-inv96.6%
clear-num96.7%
flip-+23.9%
Applied egg-rr23.9%
Taylor expanded in y around -inf 71.0%
Taylor expanded in z around 0 68.6%
mul-1-neg68.6%
distribute-rgt-neg-out68.6%
Simplified68.6%
if -3.95000000000000019e164 < t < 8.00000000000000006e155Initial program 91.3%
associate-/l*94.6%
Simplified94.6%
Taylor expanded in z around inf 78.7%
Final simplification76.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -1.35e+171) (not (<= t 8e+155))) (/ (* y (- t)) a) (+ x (* (/ y a) z))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -1.35e+171) || !(t <= 8e+155)) {
tmp = (y * -t) / 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 <= (-1.35d+171)) .or. (.not. (t <= 8d+155))) then
tmp = (y * -t) / 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 <= -1.35e+171) || !(t <= 8e+155)) {
tmp = (y * -t) / a;
} else {
tmp = x + ((y / a) * z);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -1.35e+171) or not (t <= 8e+155): tmp = (y * -t) / a else: tmp = x + ((y / a) * z) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -1.35e+171) || !(t <= 8e+155)) tmp = Float64(Float64(y * Float64(-t)) / a); else tmp = Float64(x + Float64(Float64(y / a) * z)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -1.35e+171) || ~((t <= 8e+155))) tmp = (y * -t) / a; else tmp = x + ((y / a) * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -1.35e+171], N[Not[LessEqual[t, 8e+155]], $MachinePrecision]], N[(N[(y * (-t)), $MachinePrecision] / a), $MachinePrecision], N[(x + N[(N[(y / a), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.35 \cdot 10^{+171} \lor \neg \left(t \leq 8 \cdot 10^{+155}\right):\\
\;\;\;\;\frac{y \cdot \left(-t\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{a} \cdot z\\
\end{array}
\end{array}
if t < -1.3499999999999999e171 or 8.00000000000000006e155 < t Initial program 91.9%
associate-*l/96.5%
Simplified96.5%
associate-/r/88.7%
div-inv88.7%
associate-/r*96.5%
Applied egg-rr96.5%
+-commutative96.5%
associate-/r/96.5%
associate-/r/96.5%
div-inv96.4%
clear-num96.3%
frac-times96.3%
metadata-eval96.3%
div-inv96.5%
clear-num96.6%
flip-+24.8%
Applied egg-rr24.7%
Taylor expanded in y around -inf 71.8%
Taylor expanded in z around 0 69.3%
mul-1-neg69.3%
distribute-rgt-neg-out69.3%
Simplified69.3%
if -1.3499999999999999e171 < t < 8.00000000000000006e155Initial program 91.4%
associate-*l/98.2%
Simplified98.2%
Taylor expanded in t around 0 77.0%
associate-*l/82.9%
*-commutative82.9%
Simplified82.9%
Final simplification79.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -5.4e-36) (not (<= z 1.9e-40))) (+ 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.4e-36) || !(z <= 1.9e-40)) {
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.4d-36)) .or. (.not. (z <= 1.9d-40))) 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.4e-36) || !(z <= 1.9e-40)) {
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.4e-36) or not (z <= 1.9e-40): 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.4e-36) || !(z <= 1.9e-40)) tmp = Float64(x + Float64(Float64(y / a) * z)); 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 <= -5.4e-36) || ~((z <= 1.9e-40))) 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.4e-36], N[Not[LessEqual[z, 1.9e-40]], $MachinePrecision]], N[(x + N[(N[(y / a), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x - N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.4 \cdot 10^{-36} \lor \neg \left(z \leq 1.9 \cdot 10^{-40}\right):\\
\;\;\;\;x + \frac{y}{a} \cdot z\\
\mathbf{else}:\\
\;\;\;\;x - y \cdot \frac{t}{a}\\
\end{array}
\end{array}
if z < -5.40000000000000015e-36 or 1.8999999999999999e-40 < z Initial program 88.3%
associate-*l/97.6%
Simplified97.6%
Taylor expanded in t around 0 79.0%
associate-*l/85.7%
*-commutative85.7%
Simplified85.7%
if -5.40000000000000015e-36 < z < 1.8999999999999999e-40Initial program 95.6%
associate-*l/98.1%
Simplified98.1%
associate-/r/98.2%
div-inv98.2%
associate-/r*98.1%
Applied egg-rr98.1%
Taylor expanded in z around 0 91.3%
+-commutative91.3%
mul-1-neg91.3%
associate-*r/93.9%
distribute-lft-neg-out93.9%
cancel-sign-sub-inv93.9%
Simplified93.9%
Final simplification89.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.8e+26) (not (<= z 1.9e-40))) (+ x (* (/ y a) z)) (- x (* (/ y a) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.8e+26) || !(z <= 1.9e-40)) {
tmp = x + ((y / a) * z);
} else {
tmp = x - ((y / a) * t);
}
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.8d+26)) .or. (.not. (z <= 1.9d-40))) then
tmp = x + ((y / a) * z)
else
tmp = x - ((y / a) * t)
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.8e+26) || !(z <= 1.9e-40)) {
tmp = x + ((y / a) * z);
} else {
tmp = x - ((y / a) * t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.8e+26) or not (z <= 1.9e-40): tmp = x + ((y / a) * z) else: tmp = x - ((y / a) * t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.8e+26) || !(z <= 1.9e-40)) tmp = Float64(x + Float64(Float64(y / a) * z)); else tmp = Float64(x - Float64(Float64(y / a) * t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.8e+26) || ~((z <= 1.9e-40))) tmp = x + ((y / a) * z); else tmp = x - ((y / a) * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.8e+26], N[Not[LessEqual[z, 1.9e-40]], $MachinePrecision]], N[(x + N[(N[(y / a), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.8 \cdot 10^{+26} \lor \neg \left(z \leq 1.9 \cdot 10^{-40}\right):\\
\;\;\;\;x + \frac{y}{a} \cdot z\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{a} \cdot t\\
\end{array}
\end{array}
if z < -1.80000000000000012e26 or 1.8999999999999999e-40 < z Initial program 88.4%
associate-*l/97.5%
Simplified97.5%
Taylor expanded in t around 0 79.4%
associate-*l/86.5%
*-commutative86.5%
Simplified86.5%
if -1.80000000000000012e26 < z < 1.8999999999999999e-40Initial program 95.1%
associate-*l/98.2%
Simplified98.2%
Taylor expanded in z around 0 90.2%
mul-1-neg90.2%
associate-*l/93.3%
distribute-rgt-neg-out93.3%
Simplified93.3%
add-sqr-sqrt59.4%
fma-def59.4%
distribute-rgt-neg-out59.4%
add-sqr-sqrt24.9%
sqrt-unprod34.2%
sqr-neg34.2%
sqrt-unprod15.9%
add-sqr-sqrt28.7%
*-commutative28.7%
*-commutative28.7%
fma-neg28.7%
add-sqr-sqrt43.9%
add-sqr-sqrt24.0%
sqrt-unprod58.0%
sqr-neg58.0%
sqrt-unprod43.9%
add-sqr-sqrt93.3%
Applied egg-rr93.3%
Final simplification89.6%
(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 91.5%
associate-*l/97.8%
Simplified97.8%
Taylor expanded in x around inf 38.6%
Final simplification38.6%
(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 2023262
(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)))