
(FPCore (u v t1) :precision binary64 (/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))
double code(double u, double v, double t1) {
return (-t1 * v) / ((t1 + u) * (t1 + u));
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
code = (-t1 * v) / ((t1 + u) * (t1 + u))
end function
public static double code(double u, double v, double t1) {
return (-t1 * v) / ((t1 + u) * (t1 + u));
}
def code(u, v, t1): return (-t1 * v) / ((t1 + u) * (t1 + u))
function code(u, v, t1) return Float64(Float64(Float64(-t1) * v) / Float64(Float64(t1 + u) * Float64(t1 + u))) end
function tmp = code(u, v, t1) tmp = (-t1 * v) / ((t1 + u) * (t1 + u)); end
code[u_, v_, t1_] := N[(N[((-t1) * v), $MachinePrecision] / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (u v t1) :precision binary64 (/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))
double code(double u, double v, double t1) {
return (-t1 * v) / ((t1 + u) * (t1 + u));
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
code = (-t1 * v) / ((t1 + u) * (t1 + u))
end function
public static double code(double u, double v, double t1) {
return (-t1 * v) / ((t1 + u) * (t1 + u));
}
def code(u, v, t1): return (-t1 * v) / ((t1 + u) * (t1 + u))
function code(u, v, t1) return Float64(Float64(Float64(-t1) * v) / Float64(Float64(t1 + u) * Float64(t1 + u))) end
function tmp = code(u, v, t1) tmp = (-t1 * v) / ((t1 + u) * (t1 + u)); end
code[u_, v_, t1_] := N[(N[((-t1) * v), $MachinePrecision] / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}
\end{array}
(FPCore (u v t1) :precision binary64 (/ (* (/ t1 (+ t1 u)) (- v)) (+ t1 u)))
double code(double u, double v, double t1) {
return ((t1 / (t1 + u)) * -v) / (t1 + u);
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
code = ((t1 / (t1 + u)) * -v) / (t1 + u)
end function
public static double code(double u, double v, double t1) {
return ((t1 / (t1 + u)) * -v) / (t1 + u);
}
def code(u, v, t1): return ((t1 / (t1 + u)) * -v) / (t1 + u)
function code(u, v, t1) return Float64(Float64(Float64(t1 / Float64(t1 + u)) * Float64(-v)) / Float64(t1 + u)) end
function tmp = code(u, v, t1) tmp = ((t1 / (t1 + u)) * -v) / (t1 + u); end
code[u_, v_, t1_] := N[(N[(N[(t1 / N[(t1 + u), $MachinePrecision]), $MachinePrecision] * (-v)), $MachinePrecision] / N[(t1 + u), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{t1}{t1 + u} \cdot \left(-v\right)}{t1 + u}
\end{array}
Initial program 69.1%
associate-/l*72.5%
distribute-lft-neg-out72.5%
distribute-rgt-neg-in72.5%
associate-/r*83.4%
distribute-neg-frac283.4%
Simplified83.4%
distribute-frac-neg283.4%
distribute-rgt-neg-out83.4%
associate-/r*72.5%
distribute-lft-neg-out72.5%
associate-/l*69.1%
times-frac98.4%
frac-2neg98.4%
associate-*r/99.1%
add-sqr-sqrt52.5%
sqrt-unprod44.3%
sqr-neg44.3%
sqrt-unprod14.1%
add-sqr-sqrt32.7%
add-sqr-sqrt16.4%
sqrt-unprod53.4%
sqr-neg53.4%
sqrt-prod48.6%
add-sqr-sqrt99.1%
Applied egg-rr99.1%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -3.1e-88) (not (<= t1 1.25e+68))) (/ v (- (* u -2.0) t1)) (/ (* (- v) (/ t1 u)) u)))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -3.1e-88) || !(t1 <= 1.25e+68)) {
tmp = v / ((u * -2.0) - t1);
} else {
tmp = (-v * (t1 / u)) / u;
}
return tmp;
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: tmp
if ((t1 <= (-3.1d-88)) .or. (.not. (t1 <= 1.25d+68))) then
tmp = v / ((u * (-2.0d0)) - t1)
else
tmp = (-v * (t1 / u)) / u
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -3.1e-88) || !(t1 <= 1.25e+68)) {
tmp = v / ((u * -2.0) - t1);
} else {
tmp = (-v * (t1 / u)) / u;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -3.1e-88) or not (t1 <= 1.25e+68): tmp = v / ((u * -2.0) - t1) else: tmp = (-v * (t1 / u)) / u return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -3.1e-88) || !(t1 <= 1.25e+68)) tmp = Float64(v / Float64(Float64(u * -2.0) - t1)); else tmp = Float64(Float64(Float64(-v) * Float64(t1 / u)) / u); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -3.1e-88) || ~((t1 <= 1.25e+68))) tmp = v / ((u * -2.0) - t1); else tmp = (-v * (t1 / u)) / u; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -3.1e-88], N[Not[LessEqual[t1, 1.25e+68]], $MachinePrecision]], N[(v / N[(N[(u * -2.0), $MachinePrecision] - t1), $MachinePrecision]), $MachinePrecision], N[(N[((-v) * N[(t1 / u), $MachinePrecision]), $MachinePrecision] / u), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -3.1 \cdot 10^{-88} \lor \neg \left(t1 \leq 1.25 \cdot 10^{+68}\right):\\
\;\;\;\;\frac{v}{u \cdot -2 - t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-v\right) \cdot \frac{t1}{u}}{u}\\
\end{array}
\end{array}
if t1 < -3.0999999999999998e-88 or 1.2500000000000001e68 < t1 Initial program 58.0%
associate-/l*62.3%
distribute-lft-neg-out62.3%
distribute-rgt-neg-in62.3%
associate-/r*76.0%
distribute-neg-frac276.0%
Simplified76.0%
associate-*r/99.9%
+-commutative99.9%
distribute-neg-in99.9%
sub-neg99.9%
associate-*l/99.8%
clear-num99.8%
frac-2neg99.8%
frac-times98.5%
*-un-lft-identity98.5%
frac-2neg98.5%
sub-neg98.5%
distribute-neg-in98.5%
+-commutative98.5%
remove-double-neg98.5%
add-sqr-sqrt61.4%
sqrt-unprod43.0%
sqr-neg43.0%
sqrt-unprod9.7%
add-sqr-sqrt27.7%
add-sqr-sqrt17.1%
sqrt-unprod41.8%
Applied egg-rr98.5%
Taylor expanded in t1 around inf 98.5%
Taylor expanded in v around 0 98.5%
distribute-lft-in97.8%
associate-*r/97.8%
+-commutative97.8%
distribute-lft-in98.5%
associate-*r/98.5%
neg-mul-198.5%
distribute-neg-frac298.5%
*-commutative98.5%
distribute-rgt-neg-in98.5%
distribute-neg-in98.5%
metadata-eval98.5%
unsub-neg98.5%
Simplified98.5%
Taylor expanded in u around 0 81.2%
neg-mul-181.2%
unsub-neg81.2%
*-commutative81.2%
Simplified81.2%
if -3.0999999999999998e-88 < t1 < 1.2500000000000001e68Initial program 81.7%
associate-*l/84.7%
*-commutative84.7%
Simplified84.7%
Taylor expanded in t1 around 0 71.1%
associate-*r/68.9%
*-commutative68.9%
associate-/r*75.0%
frac-2neg75.0%
distribute-lft-neg-out75.0%
remove-double-neg75.0%
distribute-neg-in75.0%
add-sqr-sqrt35.3%
sqrt-unprod76.4%
sqr-neg76.4%
sqrt-unprod40.2%
add-sqr-sqrt74.5%
sub-neg74.5%
Applied egg-rr74.5%
Taylor expanded in t1 around 0 76.6%
mul-1-neg76.6%
*-commutative76.6%
associate-*r/81.8%
distribute-lft-neg-in81.8%
Simplified81.8%
Final simplification81.5%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -3.1e-88) (not (<= t1 3.1e+68))) (/ v (- (* u -2.0) t1)) (* (/ t1 u) (/ v (- u)))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -3.1e-88) || !(t1 <= 3.1e+68)) {
tmp = v / ((u * -2.0) - t1);
} else {
tmp = (t1 / u) * (v / -u);
}
return tmp;
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: tmp
if ((t1 <= (-3.1d-88)) .or. (.not. (t1 <= 3.1d+68))) then
tmp = v / ((u * (-2.0d0)) - t1)
else
tmp = (t1 / u) * (v / -u)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -3.1e-88) || !(t1 <= 3.1e+68)) {
tmp = v / ((u * -2.0) - t1);
} else {
tmp = (t1 / u) * (v / -u);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -3.1e-88) or not (t1 <= 3.1e+68): tmp = v / ((u * -2.0) - t1) else: tmp = (t1 / u) * (v / -u) return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -3.1e-88) || !(t1 <= 3.1e+68)) tmp = Float64(v / Float64(Float64(u * -2.0) - t1)); else tmp = Float64(Float64(t1 / u) * Float64(v / Float64(-u))); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -3.1e-88) || ~((t1 <= 3.1e+68))) tmp = v / ((u * -2.0) - t1); else tmp = (t1 / u) * (v / -u); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -3.1e-88], N[Not[LessEqual[t1, 3.1e+68]], $MachinePrecision]], N[(v / N[(N[(u * -2.0), $MachinePrecision] - t1), $MachinePrecision]), $MachinePrecision], N[(N[(t1 / u), $MachinePrecision] * N[(v / (-u)), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -3.1 \cdot 10^{-88} \lor \neg \left(t1 \leq 3.1 \cdot 10^{+68}\right):\\
\;\;\;\;\frac{v}{u \cdot -2 - t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{t1}{u} \cdot \frac{v}{-u}\\
\end{array}
\end{array}
if t1 < -3.0999999999999998e-88 or 3.0999999999999998e68 < t1 Initial program 58.0%
associate-/l*62.3%
distribute-lft-neg-out62.3%
distribute-rgt-neg-in62.3%
associate-/r*76.0%
distribute-neg-frac276.0%
Simplified76.0%
associate-*r/99.9%
+-commutative99.9%
distribute-neg-in99.9%
sub-neg99.9%
associate-*l/99.8%
clear-num99.8%
frac-2neg99.8%
frac-times98.5%
*-un-lft-identity98.5%
frac-2neg98.5%
sub-neg98.5%
distribute-neg-in98.5%
+-commutative98.5%
remove-double-neg98.5%
add-sqr-sqrt61.4%
sqrt-unprod43.0%
sqr-neg43.0%
sqrt-unprod9.7%
add-sqr-sqrt27.7%
add-sqr-sqrt17.1%
sqrt-unprod41.8%
Applied egg-rr98.5%
Taylor expanded in t1 around inf 98.5%
Taylor expanded in v around 0 98.5%
distribute-lft-in97.8%
associate-*r/97.8%
+-commutative97.8%
distribute-lft-in98.5%
associate-*r/98.5%
neg-mul-198.5%
distribute-neg-frac298.5%
*-commutative98.5%
distribute-rgt-neg-in98.5%
distribute-neg-in98.5%
metadata-eval98.5%
unsub-neg98.5%
Simplified98.5%
Taylor expanded in u around 0 81.2%
neg-mul-181.2%
unsub-neg81.2%
*-commutative81.2%
Simplified81.2%
if -3.0999999999999998e-88 < t1 < 3.0999999999999998e68Initial program 81.7%
times-frac96.7%
distribute-frac-neg96.7%
distribute-neg-frac296.7%
+-commutative96.7%
distribute-neg-in96.7%
unsub-neg96.7%
Simplified96.7%
Taylor expanded in t1 around 0 78.7%
Taylor expanded in t1 around 0 80.3%
associate-*r/80.3%
mul-1-neg80.3%
Simplified80.3%
Final simplification80.8%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -3.1e-88) (not (<= t1 8e+65))) (/ v (- (* u -2.0) t1)) (* v (/ t1 (* u (- u))))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -3.1e-88) || !(t1 <= 8e+65)) {
tmp = v / ((u * -2.0) - t1);
} else {
tmp = v * (t1 / (u * -u));
}
return tmp;
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: tmp
if ((t1 <= (-3.1d-88)) .or. (.not. (t1 <= 8d+65))) then
tmp = v / ((u * (-2.0d0)) - t1)
else
tmp = v * (t1 / (u * -u))
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -3.1e-88) || !(t1 <= 8e+65)) {
tmp = v / ((u * -2.0) - t1);
} else {
tmp = v * (t1 / (u * -u));
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -3.1e-88) or not (t1 <= 8e+65): tmp = v / ((u * -2.0) - t1) else: tmp = v * (t1 / (u * -u)) return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -3.1e-88) || !(t1 <= 8e+65)) tmp = Float64(v / Float64(Float64(u * -2.0) - t1)); else tmp = Float64(v * Float64(t1 / Float64(u * Float64(-u)))); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -3.1e-88) || ~((t1 <= 8e+65))) tmp = v / ((u * -2.0) - t1); else tmp = v * (t1 / (u * -u)); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -3.1e-88], N[Not[LessEqual[t1, 8e+65]], $MachinePrecision]], N[(v / N[(N[(u * -2.0), $MachinePrecision] - t1), $MachinePrecision]), $MachinePrecision], N[(v * N[(t1 / N[(u * (-u)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -3.1 \cdot 10^{-88} \lor \neg \left(t1 \leq 8 \cdot 10^{+65}\right):\\
\;\;\;\;\frac{v}{u \cdot -2 - t1}\\
\mathbf{else}:\\
\;\;\;\;v \cdot \frac{t1}{u \cdot \left(-u\right)}\\
\end{array}
\end{array}
if t1 < -3.0999999999999998e-88 or 7.9999999999999999e65 < t1 Initial program 57.6%
associate-/l*61.8%
distribute-lft-neg-out61.8%
distribute-rgt-neg-in61.8%
associate-/r*76.1%
distribute-neg-frac276.1%
Simplified76.1%
associate-*r/99.9%
+-commutative99.9%
distribute-neg-in99.9%
sub-neg99.9%
associate-*l/99.8%
clear-num99.8%
frac-2neg99.8%
frac-times98.5%
*-un-lft-identity98.5%
frac-2neg98.5%
sub-neg98.5%
distribute-neg-in98.5%
+-commutative98.5%
remove-double-neg98.5%
add-sqr-sqrt60.9%
sqrt-unprod42.7%
sqr-neg42.7%
sqrt-unprod9.6%
add-sqr-sqrt27.5%
add-sqr-sqrt17.0%
sqrt-unprod41.5%
Applied egg-rr98.5%
Taylor expanded in t1 around inf 98.5%
Taylor expanded in v around 0 98.5%
distribute-lft-in97.8%
associate-*r/97.8%
+-commutative97.8%
distribute-lft-in98.5%
associate-*r/98.5%
neg-mul-198.5%
distribute-neg-frac298.5%
*-commutative98.5%
distribute-rgt-neg-in98.5%
distribute-neg-in98.5%
metadata-eval98.5%
unsub-neg98.5%
Simplified98.5%
Taylor expanded in u around 0 80.7%
neg-mul-180.7%
unsub-neg80.7%
*-commutative80.7%
Simplified80.7%
if -3.0999999999999998e-88 < t1 < 7.9999999999999999e65Initial program 82.4%
associate-*l/85.4%
*-commutative85.4%
Simplified85.4%
Taylor expanded in t1 around 0 71.7%
Taylor expanded in t1 around 0 73.4%
Final simplification77.3%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -3.1e-88) (not (<= t1 1.3e-216))) (/ (- v) (+ t1 u)) (* v (/ (/ t1 u) u))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -3.1e-88) || !(t1 <= 1.3e-216)) {
tmp = -v / (t1 + u);
} else {
tmp = v * ((t1 / u) / u);
}
return tmp;
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: tmp
if ((t1 <= (-3.1d-88)) .or. (.not. (t1 <= 1.3d-216))) then
tmp = -v / (t1 + u)
else
tmp = v * ((t1 / u) / u)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -3.1e-88) || !(t1 <= 1.3e-216)) {
tmp = -v / (t1 + u);
} else {
tmp = v * ((t1 / u) / u);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -3.1e-88) or not (t1 <= 1.3e-216): tmp = -v / (t1 + u) else: tmp = v * ((t1 / u) / u) return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -3.1e-88) || !(t1 <= 1.3e-216)) tmp = Float64(Float64(-v) / Float64(t1 + u)); else tmp = Float64(v * Float64(Float64(t1 / u) / u)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -3.1e-88) || ~((t1 <= 1.3e-216))) tmp = -v / (t1 + u); else tmp = v * ((t1 / u) / u); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -3.1e-88], N[Not[LessEqual[t1, 1.3e-216]], $MachinePrecision]], N[((-v) / N[(t1 + u), $MachinePrecision]), $MachinePrecision], N[(v * N[(N[(t1 / u), $MachinePrecision] / u), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -3.1 \cdot 10^{-88} \lor \neg \left(t1 \leq 1.3 \cdot 10^{-216}\right):\\
\;\;\;\;\frac{-v}{t1 + u}\\
\mathbf{else}:\\
\;\;\;\;v \cdot \frac{\frac{t1}{u}}{u}\\
\end{array}
\end{array}
if t1 < -3.0999999999999998e-88 or 1.2999999999999999e-216 < t1 Initial program 64.2%
associate-/l*67.6%
distribute-lft-neg-out67.6%
distribute-rgt-neg-in67.6%
associate-/r*80.8%
distribute-neg-frac280.8%
Simplified80.8%
distribute-frac-neg280.8%
distribute-rgt-neg-out80.8%
associate-/r*67.6%
distribute-lft-neg-out67.6%
associate-/l*64.2%
times-frac99.3%
frac-2neg99.3%
associate-*r/99.8%
add-sqr-sqrt45.6%
sqrt-unprod39.7%
sqr-neg39.7%
sqrt-unprod14.6%
add-sqr-sqrt27.8%
add-sqr-sqrt15.9%
sqrt-unprod50.4%
sqr-neg50.4%
sqrt-prod50.5%
add-sqr-sqrt99.8%
Applied egg-rr99.8%
Taylor expanded in t1 around inf 71.2%
mul-1-neg71.2%
Simplified71.2%
if -3.0999999999999998e-88 < t1 < 1.2999999999999999e-216Initial program 82.1%
associate-*l/84.9%
*-commutative84.9%
Simplified84.9%
Taylor expanded in t1 around 0 79.5%
Taylor expanded in t1 around 0 79.6%
associate-/r*86.1%
div-inv86.2%
add-sqr-sqrt59.6%
sqrt-unprod50.5%
sqr-neg50.5%
sqrt-unprod12.8%
add-sqr-sqrt45.4%
Applied egg-rr45.4%
associate-*r/45.4%
*-rgt-identity45.4%
Simplified45.4%
Final simplification64.0%
(FPCore (u v t1) :precision binary64 (if (<= u -3e+108) (/ v (- u)) (if (<= u 5.2e+246) (/ v (- t1)) (/ 1.0 (/ u v)))))
double code(double u, double v, double t1) {
double tmp;
if (u <= -3e+108) {
tmp = v / -u;
} else if (u <= 5.2e+246) {
tmp = v / -t1;
} else {
tmp = 1.0 / (u / v);
}
return tmp;
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: tmp
if (u <= (-3d+108)) then
tmp = v / -u
else if (u <= 5.2d+246) then
tmp = v / -t1
else
tmp = 1.0d0 / (u / v)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if (u <= -3e+108) {
tmp = v / -u;
} else if (u <= 5.2e+246) {
tmp = v / -t1;
} else {
tmp = 1.0 / (u / v);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if u <= -3e+108: tmp = v / -u elif u <= 5.2e+246: tmp = v / -t1 else: tmp = 1.0 / (u / v) return tmp
function code(u, v, t1) tmp = 0.0 if (u <= -3e+108) tmp = Float64(v / Float64(-u)); elseif (u <= 5.2e+246) tmp = Float64(v / Float64(-t1)); else tmp = Float64(1.0 / Float64(u / v)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (u <= -3e+108) tmp = v / -u; elseif (u <= 5.2e+246) tmp = v / -t1; else tmp = 1.0 / (u / v); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[u, -3e+108], N[(v / (-u)), $MachinePrecision], If[LessEqual[u, 5.2e+246], N[(v / (-t1)), $MachinePrecision], N[(1.0 / N[(u / v), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -3 \cdot 10^{+108}:\\
\;\;\;\;\frac{v}{-u}\\
\mathbf{elif}\;u \leq 5.2 \cdot 10^{+246}:\\
\;\;\;\;\frac{v}{-t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{u}{v}}\\
\end{array}
\end{array}
if u < -2.99999999999999984e108Initial program 73.4%
associate-*l/76.4%
*-commutative76.4%
Simplified76.4%
Taylor expanded in t1 around 0 76.4%
Taylor expanded in t1 around inf 41.2%
associate-*r/41.2%
mul-1-neg41.2%
Simplified41.2%
if -2.99999999999999984e108 < u < 5.20000000000000028e246Initial program 66.6%
associate-/l*70.7%
distribute-lft-neg-out70.7%
distribute-rgt-neg-in70.7%
associate-/r*81.8%
distribute-neg-frac281.8%
Simplified81.8%
Taylor expanded in t1 around inf 61.2%
associate-*r/61.2%
neg-mul-161.2%
Simplified61.2%
if 5.20000000000000028e246 < u Initial program 92.9%
associate-*l/93.2%
*-commutative93.2%
Simplified93.2%
Taylor expanded in t1 around 0 93.2%
Taylor expanded in t1 around inf 50.8%
associate-*r/50.8%
mul-1-neg50.8%
Simplified50.8%
clear-num59.3%
inv-pow59.3%
add-sqr-sqrt29.0%
sqrt-unprod59.1%
sqr-neg59.1%
sqrt-unprod30.8%
add-sqr-sqrt59.8%
Applied egg-rr59.8%
unpow-159.8%
Simplified59.8%
Final simplification58.0%
(FPCore (u v t1) :precision binary64 (if (or (<= u -1.35e+114) (not (<= u 1.35e+246))) (/ v u) (/ v (- t1))))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -1.35e+114) || !(u <= 1.35e+246)) {
tmp = v / u;
} else {
tmp = v / -t1;
}
return tmp;
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: tmp
if ((u <= (-1.35d+114)) .or. (.not. (u <= 1.35d+246))) then
tmp = v / u
else
tmp = v / -t1
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((u <= -1.35e+114) || !(u <= 1.35e+246)) {
tmp = v / u;
} else {
tmp = v / -t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -1.35e+114) or not (u <= 1.35e+246): tmp = v / u else: tmp = v / -t1 return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -1.35e+114) || !(u <= 1.35e+246)) tmp = Float64(v / u); else tmp = Float64(v / Float64(-t1)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((u <= -1.35e+114) || ~((u <= 1.35e+246))) tmp = v / u; else tmp = v / -t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -1.35e+114], N[Not[LessEqual[u, 1.35e+246]], $MachinePrecision]], N[(v / u), $MachinePrecision], N[(v / (-t1)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -1.35 \cdot 10^{+114} \lor \neg \left(u \leq 1.35 \cdot 10^{+246}\right):\\
\;\;\;\;\frac{v}{u}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{-t1}\\
\end{array}
\end{array}
if u < -1.35e114 or 1.35e246 < u Initial program 78.1%
associate-*l/80.4%
*-commutative80.4%
Simplified80.4%
Taylor expanded in t1 around 0 80.4%
associate-*r/78.1%
*-commutative78.1%
associate-/r*86.1%
frac-2neg86.1%
distribute-lft-neg-out86.1%
remove-double-neg86.1%
distribute-neg-in86.1%
add-sqr-sqrt48.4%
sqrt-unprod84.9%
sqr-neg84.9%
sqrt-unprod37.8%
add-sqr-sqrt86.1%
sub-neg86.1%
Applied egg-rr86.1%
Taylor expanded in t1 around inf 44.3%
if -1.35e114 < u < 1.35e246Initial program 66.8%
associate-/l*70.8%
distribute-lft-neg-out70.8%
distribute-rgt-neg-in70.8%
associate-/r*81.9%
distribute-neg-frac281.9%
Simplified81.9%
Taylor expanded in t1 around inf 60.9%
associate-*r/60.9%
neg-mul-160.9%
Simplified60.9%
Final simplification57.5%
(FPCore (u v t1) :precision binary64 (if (<= u -6e+108) (/ v (- u)) (if (<= u 1.35e+246) (/ v (- t1)) (/ v u))))
double code(double u, double v, double t1) {
double tmp;
if (u <= -6e+108) {
tmp = v / -u;
} else if (u <= 1.35e+246) {
tmp = v / -t1;
} else {
tmp = v / u;
}
return tmp;
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: tmp
if (u <= (-6d+108)) then
tmp = v / -u
else if (u <= 1.35d+246) then
tmp = v / -t1
else
tmp = v / u
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if (u <= -6e+108) {
tmp = v / -u;
} else if (u <= 1.35e+246) {
tmp = v / -t1;
} else {
tmp = v / u;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if u <= -6e+108: tmp = v / -u elif u <= 1.35e+246: tmp = v / -t1 else: tmp = v / u return tmp
function code(u, v, t1) tmp = 0.0 if (u <= -6e+108) tmp = Float64(v / Float64(-u)); elseif (u <= 1.35e+246) tmp = Float64(v / Float64(-t1)); else tmp = Float64(v / u); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (u <= -6e+108) tmp = v / -u; elseif (u <= 1.35e+246) tmp = v / -t1; else tmp = v / u; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[u, -6e+108], N[(v / (-u)), $MachinePrecision], If[LessEqual[u, 1.35e+246], N[(v / (-t1)), $MachinePrecision], N[(v / u), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -6 \cdot 10^{+108}:\\
\;\;\;\;\frac{v}{-u}\\
\mathbf{elif}\;u \leq 1.35 \cdot 10^{+246}:\\
\;\;\;\;\frac{v}{-t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{u}\\
\end{array}
\end{array}
if u < -5.99999999999999968e108Initial program 73.4%
associate-*l/76.4%
*-commutative76.4%
Simplified76.4%
Taylor expanded in t1 around 0 76.4%
Taylor expanded in t1 around inf 41.2%
associate-*r/41.2%
mul-1-neg41.2%
Simplified41.2%
if -5.99999999999999968e108 < u < 1.35e246Initial program 66.6%
associate-/l*70.7%
distribute-lft-neg-out70.7%
distribute-rgt-neg-in70.7%
associate-/r*81.8%
distribute-neg-frac281.8%
Simplified81.8%
Taylor expanded in t1 around inf 61.2%
associate-*r/61.2%
neg-mul-161.2%
Simplified61.2%
if 1.35e246 < u Initial program 92.9%
associate-*l/93.2%
*-commutative93.2%
Simplified93.2%
Taylor expanded in t1 around 0 93.2%
associate-*r/92.9%
*-commutative92.9%
associate-/r*93.0%
frac-2neg93.0%
distribute-lft-neg-out93.0%
remove-double-neg93.0%
distribute-neg-in93.0%
add-sqr-sqrt57.3%
sqrt-unprod92.9%
sqr-neg92.9%
sqrt-unprod35.7%
add-sqr-sqrt93.0%
sub-neg93.0%
Applied egg-rr93.0%
Taylor expanded in t1 around inf 51.3%
Final simplification57.5%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -1.45e+64) (not (<= t1 5e+126))) (/ v t1) (/ v u)))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -1.45e+64) || !(t1 <= 5e+126)) {
tmp = v / t1;
} else {
tmp = v / u;
}
return tmp;
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: tmp
if ((t1 <= (-1.45d+64)) .or. (.not. (t1 <= 5d+126))) then
tmp = v / t1
else
tmp = v / u
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -1.45e+64) || !(t1 <= 5e+126)) {
tmp = v / t1;
} else {
tmp = v / u;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -1.45e+64) or not (t1 <= 5e+126): tmp = v / t1 else: tmp = v / u return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -1.45e+64) || !(t1 <= 5e+126)) tmp = Float64(v / t1); else tmp = Float64(v / u); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -1.45e+64) || ~((t1 <= 5e+126))) tmp = v / t1; else tmp = v / u; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -1.45e+64], N[Not[LessEqual[t1, 5e+126]], $MachinePrecision]], N[(v / t1), $MachinePrecision], N[(v / u), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -1.45 \cdot 10^{+64} \lor \neg \left(t1 \leq 5 \cdot 10^{+126}\right):\\
\;\;\;\;\frac{v}{t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{u}\\
\end{array}
\end{array}
if t1 < -1.44999999999999997e64 or 4.99999999999999977e126 < t1 Initial program 43.5%
associate-/l*48.8%
distribute-lft-neg-out48.8%
distribute-rgt-neg-in48.8%
associate-/r*67.4%
distribute-neg-frac267.4%
Simplified67.4%
Taylor expanded in t1 around inf 86.2%
associate-*r/86.2%
neg-mul-186.2%
Simplified86.2%
neg-sub086.2%
sub-neg86.2%
add-sqr-sqrt39.1%
sqrt-unprod41.3%
sqr-neg41.3%
sqrt-unprod12.7%
add-sqr-sqrt26.7%
Applied egg-rr26.7%
+-lft-identity26.7%
Simplified26.7%
if -1.44999999999999997e64 < t1 < 4.99999999999999977e126Initial program 83.0%
associate-*l/87.1%
*-commutative87.1%
Simplified87.1%
Taylor expanded in t1 around 0 63.2%
associate-*r/61.0%
*-commutative61.0%
associate-/r*67.1%
frac-2neg67.1%
distribute-lft-neg-out67.1%
remove-double-neg67.1%
distribute-neg-in67.1%
add-sqr-sqrt35.9%
sqrt-unprod68.1%
sqr-neg68.1%
sqrt-unprod31.6%
add-sqr-sqrt67.2%
sub-neg67.2%
Applied egg-rr67.2%
Taylor expanded in t1 around inf 18.4%
Final simplification21.3%
(FPCore (u v t1) :precision binary64 (if (<= u 4.2e+117) (/ v (- (* u -2.0) t1)) (* v (/ (/ t1 u) u))))
double code(double u, double v, double t1) {
double tmp;
if (u <= 4.2e+117) {
tmp = v / ((u * -2.0) - t1);
} else {
tmp = v * ((t1 / u) / u);
}
return tmp;
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: tmp
if (u <= 4.2d+117) then
tmp = v / ((u * (-2.0d0)) - t1)
else
tmp = v * ((t1 / u) / u)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if (u <= 4.2e+117) {
tmp = v / ((u * -2.0) - t1);
} else {
tmp = v * ((t1 / u) / u);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if u <= 4.2e+117: tmp = v / ((u * -2.0) - t1) else: tmp = v * ((t1 / u) / u) return tmp
function code(u, v, t1) tmp = 0.0 if (u <= 4.2e+117) tmp = Float64(v / Float64(Float64(u * -2.0) - t1)); else tmp = Float64(v * Float64(Float64(t1 / u) / u)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (u <= 4.2e+117) tmp = v / ((u * -2.0) - t1); else tmp = v * ((t1 / u) / u); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[u, 4.2e+117], N[(v / N[(N[(u * -2.0), $MachinePrecision] - t1), $MachinePrecision]), $MachinePrecision], N[(v * N[(N[(t1 / u), $MachinePrecision] / u), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq 4.2 \cdot 10^{+117}:\\
\;\;\;\;\frac{v}{u \cdot -2 - t1}\\
\mathbf{else}:\\
\;\;\;\;v \cdot \frac{\frac{t1}{u}}{u}\\
\end{array}
\end{array}
if u < 4.2000000000000002e117Initial program 69.3%
associate-/l*73.1%
distribute-lft-neg-out73.1%
distribute-rgt-neg-in73.1%
associate-/r*82.6%
distribute-neg-frac282.6%
Simplified82.6%
associate-*r/98.1%
+-commutative98.1%
distribute-neg-in98.1%
sub-neg98.1%
associate-*l/98.1%
clear-num98.0%
frac-2neg98.0%
frac-times96.8%
*-un-lft-identity96.8%
frac-2neg96.8%
sub-neg96.8%
distribute-neg-in96.8%
+-commutative96.8%
remove-double-neg96.8%
add-sqr-sqrt51.6%
sqrt-unprod39.3%
sqr-neg39.3%
sqrt-unprod12.0%
add-sqr-sqrt27.4%
add-sqr-sqrt19.0%
sqrt-unprod50.5%
Applied egg-rr96.8%
Taylor expanded in t1 around inf 96.8%
Taylor expanded in v around 0 96.8%
distribute-lft-in95.4%
associate-*r/95.4%
+-commutative95.4%
distribute-lft-in96.8%
associate-*r/96.8%
neg-mul-196.8%
distribute-neg-frac296.8%
*-commutative96.8%
distribute-rgt-neg-in96.8%
distribute-neg-in96.8%
metadata-eval96.8%
unsub-neg96.8%
Simplified96.8%
Taylor expanded in u around 0 63.9%
neg-mul-163.9%
unsub-neg63.9%
*-commutative63.9%
Simplified63.9%
if 4.2000000000000002e117 < u Initial program 68.5%
associate-*l/69.0%
*-commutative69.0%
Simplified69.0%
Taylor expanded in t1 around 0 69.0%
Taylor expanded in t1 around 0 69.1%
associate-/r*82.9%
div-inv82.8%
add-sqr-sqrt49.9%
sqrt-unprod68.2%
sqr-neg68.2%
sqrt-unprod25.8%
add-sqr-sqrt61.4%
Applied egg-rr61.4%
associate-*r/61.4%
*-rgt-identity61.4%
Simplified61.4%
(FPCore (u v t1) :precision binary64 (* (/ t1 (+ t1 u)) (/ (- v) (+ t1 u))))
double code(double u, double v, double t1) {
return (t1 / (t1 + u)) * (-v / (t1 + u));
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
code = (t1 / (t1 + u)) * (-v / (t1 + u))
end function
public static double code(double u, double v, double t1) {
return (t1 / (t1 + u)) * (-v / (t1 + u));
}
def code(u, v, t1): return (t1 / (t1 + u)) * (-v / (t1 + u))
function code(u, v, t1) return Float64(Float64(t1 / Float64(t1 + u)) * Float64(Float64(-v) / Float64(t1 + u))) end
function tmp = code(u, v, t1) tmp = (t1 / (t1 + u)) * (-v / (t1 + u)); end
code[u_, v_, t1_] := N[(N[(t1 / N[(t1 + u), $MachinePrecision]), $MachinePrecision] * N[((-v) / N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{t1}{t1 + u} \cdot \frac{-v}{t1 + u}
\end{array}
Initial program 69.1%
times-frac98.4%
distribute-frac-neg98.4%
distribute-neg-frac298.4%
+-commutative98.4%
distribute-neg-in98.4%
unsub-neg98.4%
Simplified98.4%
Final simplification98.4%
(FPCore (u v t1) :precision binary64 (/ v (* (+ t1 u) (- -1.0 (/ u t1)))))
double code(double u, double v, double t1) {
return v / ((t1 + u) * (-1.0 - (u / t1)));
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
code = v / ((t1 + u) * ((-1.0d0) - (u / t1)))
end function
public static double code(double u, double v, double t1) {
return v / ((t1 + u) * (-1.0 - (u / t1)));
}
def code(u, v, t1): return v / ((t1 + u) * (-1.0 - (u / t1)))
function code(u, v, t1) return Float64(v / Float64(Float64(t1 + u) * Float64(-1.0 - Float64(u / t1)))) end
function tmp = code(u, v, t1) tmp = v / ((t1 + u) * (-1.0 - (u / t1))); end
code[u_, v_, t1_] := N[(v / N[(N[(t1 + u), $MachinePrecision] * N[(-1.0 - N[(u / t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{v}{\left(t1 + u\right) \cdot \left(-1 - \frac{u}{t1}\right)}
\end{array}
Initial program 69.1%
associate-/l*72.5%
distribute-lft-neg-out72.5%
distribute-rgt-neg-in72.5%
associate-/r*83.4%
distribute-neg-frac283.4%
Simplified83.4%
associate-*r/98.3%
+-commutative98.3%
distribute-neg-in98.3%
sub-neg98.3%
associate-*l/98.4%
clear-num98.3%
frac-2neg98.3%
frac-times96.5%
*-un-lft-identity96.5%
frac-2neg96.5%
sub-neg96.5%
distribute-neg-in96.5%
+-commutative96.5%
remove-double-neg96.5%
add-sqr-sqrt51.7%
sqrt-unprod43.8%
sqr-neg43.8%
sqrt-unprod14.1%
add-sqr-sqrt32.7%
add-sqr-sqrt16.4%
sqrt-unprod53.4%
Applied egg-rr96.5%
Taylor expanded in t1 around inf 96.5%
Taylor expanded in v around 0 96.5%
distribute-lft-in91.1%
associate-*r/91.1%
+-commutative91.1%
distribute-lft-in96.5%
associate-*r/96.5%
neg-mul-196.5%
distribute-neg-frac296.5%
*-commutative96.5%
distribute-rgt-neg-in96.5%
distribute-neg-in96.5%
metadata-eval96.5%
unsub-neg96.5%
Simplified96.5%
Final simplification96.5%
(FPCore (u v t1) :precision binary64 (/ (- v) (+ t1 u)))
double code(double u, double v, double t1) {
return -v / (t1 + u);
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
code = -v / (t1 + u)
end function
public static double code(double u, double v, double t1) {
return -v / (t1 + u);
}
def code(u, v, t1): return -v / (t1 + u)
function code(u, v, t1) return Float64(Float64(-v) / Float64(t1 + u)) end
function tmp = code(u, v, t1) tmp = -v / (t1 + u); end
code[u_, v_, t1_] := N[((-v) / N[(t1 + u), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{-v}{t1 + u}
\end{array}
Initial program 69.1%
associate-/l*72.5%
distribute-lft-neg-out72.5%
distribute-rgt-neg-in72.5%
associate-/r*83.4%
distribute-neg-frac283.4%
Simplified83.4%
distribute-frac-neg283.4%
distribute-rgt-neg-out83.4%
associate-/r*72.5%
distribute-lft-neg-out72.5%
associate-/l*69.1%
times-frac98.4%
frac-2neg98.4%
associate-*r/99.1%
add-sqr-sqrt52.5%
sqrt-unprod44.3%
sqr-neg44.3%
sqrt-unprod14.1%
add-sqr-sqrt32.7%
add-sqr-sqrt16.4%
sqrt-unprod53.4%
sqr-neg53.4%
sqrt-prod48.6%
add-sqr-sqrt99.1%
Applied egg-rr99.1%
Taylor expanded in t1 around inf 59.3%
mul-1-neg59.3%
Simplified59.3%
(FPCore (u v t1) :precision binary64 (/ v t1))
double code(double u, double v, double t1) {
return v / t1;
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
code = v / t1
end function
public static double code(double u, double v, double t1) {
return v / t1;
}
def code(u, v, t1): return v / t1
function code(u, v, t1) return Float64(v / t1) end
function tmp = code(u, v, t1) tmp = v / t1; end
code[u_, v_, t1_] := N[(v / t1), $MachinePrecision]
\begin{array}{l}
\\
\frac{v}{t1}
\end{array}
Initial program 69.1%
associate-/l*72.5%
distribute-lft-neg-out72.5%
distribute-rgt-neg-in72.5%
associate-/r*83.4%
distribute-neg-frac283.4%
Simplified83.4%
Taylor expanded in t1 around inf 51.8%
associate-*r/51.8%
neg-mul-151.8%
Simplified51.8%
neg-sub051.8%
sub-neg51.8%
add-sqr-sqrt23.7%
sqrt-unprod30.7%
sqr-neg30.7%
sqrt-unprod5.4%
add-sqr-sqrt11.1%
Applied egg-rr11.1%
+-lft-identity11.1%
Simplified11.1%
herbie shell --seed 2024110
(FPCore (u v t1)
:name "Rosa's DopplerBench"
:precision binary64
(/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))