
(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 9 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[((-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 77.0%
times-frac96.6%
Simplified96.6%
Final simplification96.6%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -2.1e-109) (not (<= t1 5.5e-40))) (/ v (- (* u -2.0) t1)) (* (/ t1 u) (/ (- v) u))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -2.1e-109) || !(t1 <= 5.5e-40)) {
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 <= (-2.1d-109)) .or. (.not. (t1 <= 5.5d-40))) 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 <= -2.1e-109) || !(t1 <= 5.5e-40)) {
tmp = v / ((u * -2.0) - t1);
} else {
tmp = (t1 / u) * (-v / u);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -2.1e-109) or not (t1 <= 5.5e-40): tmp = v / ((u * -2.0) - t1) else: tmp = (t1 / u) * (-v / u) return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -2.1e-109) || !(t1 <= 5.5e-40)) tmp = Float64(v / Float64(Float64(u * -2.0) - t1)); else tmp = Float64(Float64(t1 / u) * Float64(Float64(-v) / u)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -2.1e-109) || ~((t1 <= 5.5e-40))) 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, -2.1e-109], N[Not[LessEqual[t1, 5.5e-40]], $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 -2.1 \cdot 10^{-109} \lor \neg \left(t1 \leq 5.5 \cdot 10^{-40}\right):\\
\;\;\;\;\frac{v}{u \cdot -2 - t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{t1}{u} \cdot \frac{-v}{u}\\
\end{array}
\end{array}
if t1 < -2.09999999999999996e-109 or 5.50000000000000002e-40 < t1 Initial program 73.2%
associate-/r*86.0%
*-commutative86.0%
associate-/l*99.9%
associate-/l/97.6%
+-commutative97.6%
remove-double-neg97.6%
unsub-neg97.6%
div-sub97.6%
sub-neg97.6%
*-inverses97.6%
metadata-eval97.6%
Simplified97.6%
Taylor expanded in t1 around inf 81.1%
mul-1-neg81.1%
unsub-neg81.1%
*-commutative81.1%
Simplified81.1%
if -2.09999999999999996e-109 < t1 < 5.50000000000000002e-40Initial program 84.3%
times-frac90.3%
Simplified90.3%
Taylor expanded in t1 around 0 80.3%
associate-*r/80.3%
mul-1-neg80.3%
Simplified80.3%
Taylor expanded in t1 around 0 83.6%
Final simplification82.0%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -2.3e-109) (not (<= t1 2.1e-43))) (/ v (- (* u -2.0) t1)) (/ (* v (/ t1 u)) (- u))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -2.3e-109) || !(t1 <= 2.1e-43)) {
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 <= (-2.3d-109)) .or. (.not. (t1 <= 2.1d-43))) 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 <= -2.3e-109) || !(t1 <= 2.1e-43)) {
tmp = v / ((u * -2.0) - t1);
} else {
tmp = (v * (t1 / u)) / -u;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -2.3e-109) or not (t1 <= 2.1e-43): tmp = v / ((u * -2.0) - t1) else: tmp = (v * (t1 / u)) / -u return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -2.3e-109) || !(t1 <= 2.1e-43)) tmp = Float64(v / Float64(Float64(u * -2.0) - t1)); else tmp = Float64(Float64(v * Float64(t1 / u)) / Float64(-u)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -2.3e-109) || ~((t1 <= 2.1e-43))) 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, -2.3e-109], N[Not[LessEqual[t1, 2.1e-43]], $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 -2.3 \cdot 10^{-109} \lor \neg \left(t1 \leq 2.1 \cdot 10^{-43}\right):\\
\;\;\;\;\frac{v}{u \cdot -2 - t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{v \cdot \frac{t1}{u}}{-u}\\
\end{array}
\end{array}
if t1 < -2.3000000000000001e-109 or 2.1000000000000001e-43 < t1 Initial program 73.2%
associate-/r*86.0%
*-commutative86.0%
associate-/l*99.9%
associate-/l/97.6%
+-commutative97.6%
remove-double-neg97.6%
unsub-neg97.6%
div-sub97.6%
sub-neg97.6%
*-inverses97.6%
metadata-eval97.6%
Simplified97.6%
Taylor expanded in t1 around inf 81.1%
mul-1-neg81.1%
unsub-neg81.1%
*-commutative81.1%
Simplified81.1%
if -2.3000000000000001e-109 < t1 < 2.1000000000000001e-43Initial program 84.3%
times-frac90.3%
Simplified90.3%
Taylor expanded in t1 around 0 80.3%
associate-*r/80.3%
mul-1-neg80.3%
Simplified80.3%
Taylor expanded in t1 around 0 83.6%
distribute-frac-neg83.6%
frac-2neg83.6%
distribute-frac-neg83.6%
remove-double-neg83.6%
associate-*l/83.7%
associate-*r/89.6%
associate-*l/88.7%
*-commutative88.7%
Applied egg-rr88.7%
Final simplification83.8%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -2.4e-109) (not (<= t1 3.1e-30))) (/ v (- (* u -2.0) t1)) (/ (/ (- v) (/ u t1)) u)))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -2.4e-109) || !(t1 <= 3.1e-30)) {
tmp = v / ((u * -2.0) - t1);
} else {
tmp = (-v / (u / t1)) / 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 <= (-2.4d-109)) .or. (.not. (t1 <= 3.1d-30))) then
tmp = v / ((u * (-2.0d0)) - t1)
else
tmp = (-v / (u / t1)) / u
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -2.4e-109) || !(t1 <= 3.1e-30)) {
tmp = v / ((u * -2.0) - t1);
} else {
tmp = (-v / (u / t1)) / u;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -2.4e-109) or not (t1 <= 3.1e-30): tmp = v / ((u * -2.0) - t1) else: tmp = (-v / (u / t1)) / u return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -2.4e-109) || !(t1 <= 3.1e-30)) tmp = Float64(v / Float64(Float64(u * -2.0) - t1)); else tmp = Float64(Float64(Float64(-v) / Float64(u / t1)) / u); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -2.4e-109) || ~((t1 <= 3.1e-30))) tmp = v / ((u * -2.0) - t1); else tmp = (-v / (u / t1)) / u; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -2.4e-109], N[Not[LessEqual[t1, 3.1e-30]], $MachinePrecision]], N[(v / N[(N[(u * -2.0), $MachinePrecision] - t1), $MachinePrecision]), $MachinePrecision], N[(N[((-v) / N[(u / t1), $MachinePrecision]), $MachinePrecision] / u), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -2.4 \cdot 10^{-109} \lor \neg \left(t1 \leq 3.1 \cdot 10^{-30}\right):\\
\;\;\;\;\frac{v}{u \cdot -2 - t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{-v}{\frac{u}{t1}}}{u}\\
\end{array}
\end{array}
if t1 < -2.39999999999999989e-109 or 3.09999999999999991e-30 < t1 Initial program 73.2%
associate-/r*86.0%
*-commutative86.0%
associate-/l*99.9%
associate-/l/97.6%
+-commutative97.6%
remove-double-neg97.6%
unsub-neg97.6%
div-sub97.6%
sub-neg97.6%
*-inverses97.6%
metadata-eval97.6%
Simplified97.6%
Taylor expanded in t1 around inf 81.1%
mul-1-neg81.1%
unsub-neg81.1%
*-commutative81.1%
Simplified81.1%
if -2.39999999999999989e-109 < t1 < 3.09999999999999991e-30Initial program 84.3%
times-frac90.3%
Simplified90.3%
Taylor expanded in t1 around 0 80.3%
associate-*r/80.3%
mul-1-neg80.3%
Simplified80.3%
Taylor expanded in t1 around 0 83.6%
associate-*l/83.7%
add-sqr-sqrt41.8%
sqrt-unprod45.4%
sqr-neg45.4%
sqrt-unprod16.8%
add-sqr-sqrt37.7%
associate-*r/37.8%
associate-*l/37.8%
*-commutative37.8%
Applied egg-rr37.8%
associate-*r/37.8%
*-commutative37.8%
frac-2neg37.8%
add-sqr-sqrt23.2%
sqrt-unprod50.8%
sqr-neg50.8%
sqrt-unprod33.3%
add-sqr-sqrt89.6%
distribute-neg-frac89.6%
*-commutative89.6%
associate-*r/88.7%
neg-sub088.7%
clear-num88.7%
un-div-inv88.9%
Applied egg-rr88.9%
neg-sub088.9%
distribute-neg-frac88.9%
Simplified88.9%
Final simplification83.8%
(FPCore (u v t1) :precision binary64 (if (or (<= u -3.9e+164) (not (<= u 2.3e+43))) (/ t1 (/ u (/ v u))) (/ (- v) t1)))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -3.9e+164) || !(u <= 2.3e+43)) {
tmp = t1 / (u / (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 <= (-3.9d+164)) .or. (.not. (u <= 2.3d+43))) then
tmp = t1 / (u / (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 <= -3.9e+164) || !(u <= 2.3e+43)) {
tmp = t1 / (u / (v / u));
} else {
tmp = -v / t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -3.9e+164) or not (u <= 2.3e+43): tmp = t1 / (u / (v / u)) else: tmp = -v / t1 return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -3.9e+164) || !(u <= 2.3e+43)) tmp = Float64(t1 / Float64(u / Float64(v / u))); else tmp = Float64(Float64(-v) / t1); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((u <= -3.9e+164) || ~((u <= 2.3e+43))) tmp = t1 / (u / (v / u)); else tmp = -v / t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -3.9e+164], N[Not[LessEqual[u, 2.3e+43]], $MachinePrecision]], N[(t1 / N[(u / N[(v / u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-v) / t1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -3.9 \cdot 10^{+164} \lor \neg \left(u \leq 2.3 \cdot 10^{+43}\right):\\
\;\;\;\;\frac{t1}{\frac{u}{\frac{v}{u}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1}\\
\end{array}
\end{array}
if u < -3.89999999999999985e164 or 2.3000000000000002e43 < u Initial program 81.9%
times-frac99.9%
Simplified99.9%
Taylor expanded in t1 around 0 91.4%
associate-*r/91.4%
mul-1-neg91.4%
Simplified91.4%
Taylor expanded in t1 around 0 90.4%
associate-*l/90.3%
associate-/l*86.9%
add-sqr-sqrt55.8%
sqrt-unprod63.9%
sqr-neg63.9%
sqrt-unprod25.5%
add-sqr-sqrt74.8%
Applied egg-rr74.8%
if -3.89999999999999985e164 < u < 2.3000000000000002e43Initial program 74.9%
times-frac95.1%
Simplified95.1%
Taylor expanded in t1 around inf 68.1%
associate-*r/68.1%
neg-mul-168.1%
Simplified68.1%
Final simplification70.2%
(FPCore (u v t1) :precision binary64 (if (or (<= u -3.5e+163) (not (<= u 2.3e+43))) (/ t1 (/ u (/ v u))) (/ v (- (* u -2.0) t1))))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -3.5e+163) || !(u <= 2.3e+43)) {
tmp = t1 / (u / (v / u));
} else {
tmp = v / ((u * -2.0) - 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 <= (-3.5d+163)) .or. (.not. (u <= 2.3d+43))) then
tmp = t1 / (u / (v / u))
else
tmp = v / ((u * (-2.0d0)) - t1)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((u <= -3.5e+163) || !(u <= 2.3e+43)) {
tmp = t1 / (u / (v / u));
} else {
tmp = v / ((u * -2.0) - t1);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -3.5e+163) or not (u <= 2.3e+43): tmp = t1 / (u / (v / u)) else: tmp = v / ((u * -2.0) - t1) return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -3.5e+163) || !(u <= 2.3e+43)) tmp = Float64(t1 / Float64(u / Float64(v / u))); else tmp = Float64(v / Float64(Float64(u * -2.0) - t1)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((u <= -3.5e+163) || ~((u <= 2.3e+43))) tmp = t1 / (u / (v / u)); else tmp = v / ((u * -2.0) - t1); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -3.5e+163], N[Not[LessEqual[u, 2.3e+43]], $MachinePrecision]], N[(t1 / N[(u / N[(v / u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(v / N[(N[(u * -2.0), $MachinePrecision] - t1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -3.5 \cdot 10^{+163} \lor \neg \left(u \leq 2.3 \cdot 10^{+43}\right):\\
\;\;\;\;\frac{t1}{\frac{u}{\frac{v}{u}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{u \cdot -2 - t1}\\
\end{array}
\end{array}
if u < -3.5000000000000003e163 or 2.3000000000000002e43 < u Initial program 81.9%
times-frac99.9%
Simplified99.9%
Taylor expanded in t1 around 0 91.4%
associate-*r/91.4%
mul-1-neg91.4%
Simplified91.4%
Taylor expanded in t1 around 0 90.4%
associate-*l/90.3%
associate-/l*86.9%
add-sqr-sqrt55.8%
sqrt-unprod63.9%
sqr-neg63.9%
sqrt-unprod25.5%
add-sqr-sqrt74.8%
Applied egg-rr74.8%
if -3.5000000000000003e163 < u < 2.3000000000000002e43Initial program 74.9%
associate-/r*85.7%
*-commutative85.7%
associate-/l*97.8%
associate-/l/95.6%
+-commutative95.6%
remove-double-neg95.6%
unsub-neg95.6%
div-sub95.6%
sub-neg95.6%
*-inverses95.6%
metadata-eval95.6%
Simplified95.6%
Taylor expanded in t1 around inf 68.6%
mul-1-neg68.6%
unsub-neg68.6%
*-commutative68.6%
Simplified68.6%
Final simplification70.5%
(FPCore (u v t1) :precision binary64 (if (or (<= u -6.5e+185) (not (<= u 4.2e+204))) (/ v u) (/ (- v) t1)))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -6.5e+185) || !(u <= 4.2e+204)) {
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 <= (-6.5d+185)) .or. (.not. (u <= 4.2d+204))) 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 <= -6.5e+185) || !(u <= 4.2e+204)) {
tmp = v / u;
} else {
tmp = -v / t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -6.5e+185) or not (u <= 4.2e+204): tmp = v / u else: tmp = -v / t1 return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -6.5e+185) || !(u <= 4.2e+204)) tmp = Float64(v / u); else tmp = Float64(Float64(-v) / t1); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((u <= -6.5e+185) || ~((u <= 4.2e+204))) tmp = v / u; else tmp = -v / t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -6.5e+185], N[Not[LessEqual[u, 4.2e+204]], $MachinePrecision]], N[(v / u), $MachinePrecision], N[((-v) / t1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -6.5 \cdot 10^{+185} \lor \neg \left(u \leq 4.2 \cdot 10^{+204}\right):\\
\;\;\;\;\frac{v}{u}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1}\\
\end{array}
\end{array}
if u < -6.5000000000000002e185 or 4.2000000000000001e204 < u Initial program 86.8%
times-frac99.9%
Simplified99.9%
Taylor expanded in t1 around 0 96.2%
associate-*r/96.2%
mul-1-neg96.2%
Simplified96.2%
expm1-log1p-u96.2%
expm1-udef87.0%
Applied egg-rr87.0%
expm1-def96.3%
expm1-log1p96.3%
associate-/l*90.8%
Simplified90.8%
Taylor expanded in u around 0 46.0%
if -6.5000000000000002e185 < u < 4.2000000000000001e204Initial program 74.7%
times-frac95.7%
Simplified95.7%
Taylor expanded in t1 around inf 63.6%
associate-*r/63.6%
neg-mul-163.6%
Simplified63.6%
Final simplification60.2%
(FPCore (u v t1) :precision binary64 (if (<= u -1.7e+168) (* (/ v u) -0.5) (if (<= u 3.4e+204) (/ (- v) t1) (/ v u))))
double code(double u, double v, double t1) {
double tmp;
if (u <= -1.7e+168) {
tmp = (v / u) * -0.5;
} else if (u <= 3.4e+204) {
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 <= (-1.7d+168)) then
tmp = (v / u) * (-0.5d0)
else if (u <= 3.4d+204) 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 <= -1.7e+168) {
tmp = (v / u) * -0.5;
} else if (u <= 3.4e+204) {
tmp = -v / t1;
} else {
tmp = v / u;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if u <= -1.7e+168: tmp = (v / u) * -0.5 elif u <= 3.4e+204: tmp = -v / t1 else: tmp = v / u return tmp
function code(u, v, t1) tmp = 0.0 if (u <= -1.7e+168) tmp = Float64(Float64(v / u) * -0.5); elseif (u <= 3.4e+204) tmp = Float64(Float64(-v) / t1); else tmp = Float64(v / u); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (u <= -1.7e+168) tmp = (v / u) * -0.5; elseif (u <= 3.4e+204) tmp = -v / t1; else tmp = v / u; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[u, -1.7e+168], N[(N[(v / u), $MachinePrecision] * -0.5), $MachinePrecision], If[LessEqual[u, 3.4e+204], N[((-v) / t1), $MachinePrecision], N[(v / u), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -1.7 \cdot 10^{+168}:\\
\;\;\;\;\frac{v}{u} \cdot -0.5\\
\mathbf{elif}\;u \leq 3.4 \cdot 10^{+204}:\\
\;\;\;\;\frac{-v}{t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{u}\\
\end{array}
\end{array}
if u < -1.70000000000000001e168Initial program 85.2%
associate-/r*96.9%
*-commutative96.9%
associate-/l*99.8%
associate-/l/96.9%
+-commutative96.9%
remove-double-neg96.9%
unsub-neg96.9%
div-sub96.9%
sub-neg96.9%
*-inverses96.9%
metadata-eval96.9%
Simplified96.9%
Taylor expanded in t1 around inf 52.7%
mul-1-neg52.7%
unsub-neg52.7%
*-commutative52.7%
Simplified52.7%
Taylor expanded in u around inf 45.1%
if -1.70000000000000001e168 < u < 3.4000000000000001e204Initial program 74.6%
times-frac95.7%
Simplified95.7%
Taylor expanded in t1 around inf 64.3%
associate-*r/64.3%
neg-mul-164.3%
Simplified64.3%
if 3.4000000000000001e204 < u Initial program 87.2%
times-frac99.9%
Simplified99.9%
Taylor expanded in t1 around 0 99.9%
associate-*r/99.9%
mul-1-neg99.9%
Simplified99.9%
expm1-log1p-u99.9%
expm1-udef87.4%
Applied egg-rr87.4%
expm1-def99.9%
expm1-log1p99.9%
associate-/l*91.6%
Simplified91.6%
Taylor expanded in u around 0 44.0%
Final simplification60.2%
(FPCore (u v t1) :precision binary64 (/ v u))
double code(double u, double v, double t1) {
return v / 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 / u
end function
public static double code(double u, double v, double t1) {
return v / u;
}
def code(u, v, t1): return v / u
function code(u, v, t1) return Float64(v / u) end
function tmp = code(u, v, t1) tmp = v / u; end
code[u_, v_, t1_] := N[(v / u), $MachinePrecision]
\begin{array}{l}
\\
\frac{v}{u}
\end{array}
Initial program 77.0%
times-frac96.6%
Simplified96.6%
Taylor expanded in t1 around 0 51.7%
associate-*r/51.7%
mul-1-neg51.7%
Simplified51.7%
expm1-log1p-u47.2%
expm1-udef36.4%
Applied egg-rr41.0%
expm1-def46.9%
expm1-log1p51.3%
associate-/l*47.7%
Simplified47.7%
Taylor expanded in u around 0 16.2%
Final simplification16.2%
herbie shell --seed 2024019
(FPCore (u v t1)
:name "Rosa's DopplerBench"
:precision binary64
(/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))