
(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 11 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 71.1%
times-frac98.2%
Simplified98.2%
Final simplification98.2%
(FPCore (u v t1) :precision binary64 (if (or (<= u -4.9e-12) (not (<= u 2.2e+77))) (/ (* t1 (/ v (+ t1 u))) (- u)) (/ (- v) t1)))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -4.9e-12) || !(u <= 2.2e+77)) {
tmp = (t1 * (v / (t1 + u))) / -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 <= (-4.9d-12)) .or. (.not. (u <= 2.2d+77))) then
tmp = (t1 * (v / (t1 + u))) / -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 <= -4.9e-12) || !(u <= 2.2e+77)) {
tmp = (t1 * (v / (t1 + u))) / -u;
} else {
tmp = -v / t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -4.9e-12) or not (u <= 2.2e+77): tmp = (t1 * (v / (t1 + u))) / -u else: tmp = -v / t1 return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -4.9e-12) || !(u <= 2.2e+77)) tmp = Float64(Float64(t1 * Float64(v / Float64(t1 + u))) / Float64(-u)); else tmp = Float64(Float64(-v) / t1); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((u <= -4.9e-12) || ~((u <= 2.2e+77))) tmp = (t1 * (v / (t1 + u))) / -u; else tmp = -v / t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -4.9e-12], N[Not[LessEqual[u, 2.2e+77]], $MachinePrecision]], N[(N[(t1 * N[(v / N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / (-u)), $MachinePrecision], N[((-v) / t1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -4.9 \cdot 10^{-12} \lor \neg \left(u \leq 2.2 \cdot 10^{+77}\right):\\
\;\;\;\;\frac{t1 \cdot \frac{v}{t1 + u}}{-u}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1}\\
\end{array}
\end{array}
if u < -4.89999999999999972e-12 or 2.2e77 < u Initial program 74.0%
times-frac97.9%
Simplified97.9%
Taylor expanded in t1 around 0 87.6%
associate-*r/87.6%
mul-1-neg87.6%
Simplified87.6%
frac-2neg87.6%
remove-double-neg87.6%
associate-*l/89.5%
Applied egg-rr89.5%
if -4.89999999999999972e-12 < u < 2.2e77Initial program 68.5%
times-frac98.5%
Simplified98.5%
Taylor expanded in t1 around inf 79.7%
associate-*r/79.7%
neg-mul-179.7%
Simplified79.7%
Final simplification84.4%
(FPCore (u v t1) :precision binary64 (if (or (<= u -1.2e-11) (not (<= u 4.6e+77))) (* (/ (- v) u) (/ t1 u)) (/ (- v) t1)))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -1.2e-11) || !(u <= 4.6e+77)) {
tmp = (-v / u) * (t1 / 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.2d-11)) .or. (.not. (u <= 4.6d+77))) then
tmp = (-v / u) * (t1 / 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.2e-11) || !(u <= 4.6e+77)) {
tmp = (-v / u) * (t1 / u);
} else {
tmp = -v / t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -1.2e-11) or not (u <= 4.6e+77): tmp = (-v / u) * (t1 / u) else: tmp = -v / t1 return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -1.2e-11) || !(u <= 4.6e+77)) tmp = Float64(Float64(Float64(-v) / u) * Float64(t1 / u)); else tmp = Float64(Float64(-v) / t1); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((u <= -1.2e-11) || ~((u <= 4.6e+77))) tmp = (-v / u) * (t1 / u); else tmp = -v / t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -1.2e-11], N[Not[LessEqual[u, 4.6e+77]], $MachinePrecision]], N[(N[((-v) / u), $MachinePrecision] * N[(t1 / u), $MachinePrecision]), $MachinePrecision], N[((-v) / t1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -1.2 \cdot 10^{-11} \lor \neg \left(u \leq 4.6 \cdot 10^{+77}\right):\\
\;\;\;\;\frac{-v}{u} \cdot \frac{t1}{u}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1}\\
\end{array}
\end{array}
if u < -1.2000000000000001e-11 or 4.5999999999999999e77 < u Initial program 73.8%
times-frac97.9%
Simplified97.9%
Taylor expanded in t1 around 0 87.5%
associate-*r/87.5%
mul-1-neg87.5%
Simplified87.5%
Taylor expanded in t1 around 0 84.3%
if -1.2000000000000001e-11 < u < 4.5999999999999999e77Initial program 68.7%
times-frac98.5%
Simplified98.5%
Taylor expanded in t1 around inf 79.8%
associate-*r/79.8%
neg-mul-179.8%
Simplified79.8%
Final simplification81.9%
(FPCore (u v t1) :precision binary64 (if (<= u -6.3e-12) (/ t1 (* u (/ (- u) v))) (if (<= u 4.8e+77) (/ (- v) t1) (* (/ (- v) u) (/ t1 u)))))
double code(double u, double v, double t1) {
double tmp;
if (u <= -6.3e-12) {
tmp = t1 / (u * (-u / v));
} else if (u <= 4.8e+77) {
tmp = -v / 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 (u <= (-6.3d-12)) then
tmp = t1 / (u * (-u / v))
else if (u <= 4.8d+77) then
tmp = -v / 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 (u <= -6.3e-12) {
tmp = t1 / (u * (-u / v));
} else if (u <= 4.8e+77) {
tmp = -v / t1;
} else {
tmp = (-v / u) * (t1 / u);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if u <= -6.3e-12: tmp = t1 / (u * (-u / v)) elif u <= 4.8e+77: tmp = -v / t1 else: tmp = (-v / u) * (t1 / u) return tmp
function code(u, v, t1) tmp = 0.0 if (u <= -6.3e-12) tmp = Float64(t1 / Float64(u * Float64(Float64(-u) / v))); elseif (u <= 4.8e+77) tmp = Float64(Float64(-v) / t1); else tmp = Float64(Float64(Float64(-v) / u) * Float64(t1 / u)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (u <= -6.3e-12) tmp = t1 / (u * (-u / v)); elseif (u <= 4.8e+77) tmp = -v / t1; else tmp = (-v / u) * (t1 / u); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[u, -6.3e-12], N[(t1 / N[(u * N[((-u) / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[u, 4.8e+77], N[((-v) / t1), $MachinePrecision], N[(N[((-v) / u), $MachinePrecision] * N[(t1 / u), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -6.3 \cdot 10^{-12}:\\
\;\;\;\;\frac{t1}{u \cdot \frac{-u}{v}}\\
\mathbf{elif}\;u \leq 4.8 \cdot 10^{+77}:\\
\;\;\;\;\frac{-v}{t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{u} \cdot \frac{t1}{u}\\
\end{array}
\end{array}
if u < -6.3000000000000002e-12Initial program 77.7%
times-frac98.4%
Simplified98.4%
Taylor expanded in t1 around 0 89.5%
associate-*r/89.5%
mul-1-neg89.5%
Simplified89.5%
Taylor expanded in t1 around 0 84.6%
*-commutative84.6%
clear-num84.5%
frac-2neg84.5%
frac-times86.3%
*-un-lft-identity86.3%
remove-double-neg86.3%
Applied egg-rr86.3%
if -6.3000000000000002e-12 < u < 4.7999999999999997e77Initial program 68.7%
times-frac98.5%
Simplified98.5%
Taylor expanded in t1 around inf 79.8%
associate-*r/79.8%
neg-mul-179.8%
Simplified79.8%
if 4.7999999999999997e77 < u Initial program 69.8%
times-frac97.4%
Simplified97.4%
Taylor expanded in t1 around 0 85.6%
associate-*r/85.6%
mul-1-neg85.6%
Simplified85.6%
Taylor expanded in t1 around 0 83.9%
Final simplification82.3%
(FPCore (u v t1) :precision binary64 (if (<= u -8.5e-12) (/ t1 (* u (/ (- u) v))) (if (<= u 4.6e+77) (/ (- v) t1) (/ (* t1 (/ v u)) (- u)))))
double code(double u, double v, double t1) {
double tmp;
if (u <= -8.5e-12) {
tmp = t1 / (u * (-u / v));
} else if (u <= 4.6e+77) {
tmp = -v / t1;
} else {
tmp = (t1 * (v / 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 <= (-8.5d-12)) then
tmp = t1 / (u * (-u / v))
else if (u <= 4.6d+77) then
tmp = -v / t1
else
tmp = (t1 * (v / u)) / -u
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if (u <= -8.5e-12) {
tmp = t1 / (u * (-u / v));
} else if (u <= 4.6e+77) {
tmp = -v / t1;
} else {
tmp = (t1 * (v / u)) / -u;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if u <= -8.5e-12: tmp = t1 / (u * (-u / v)) elif u <= 4.6e+77: tmp = -v / t1 else: tmp = (t1 * (v / u)) / -u return tmp
function code(u, v, t1) tmp = 0.0 if (u <= -8.5e-12) tmp = Float64(t1 / Float64(u * Float64(Float64(-u) / v))); elseif (u <= 4.6e+77) tmp = Float64(Float64(-v) / t1); else tmp = Float64(Float64(t1 * Float64(v / u)) / Float64(-u)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (u <= -8.5e-12) tmp = t1 / (u * (-u / v)); elseif (u <= 4.6e+77) tmp = -v / t1; else tmp = (t1 * (v / u)) / -u; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[u, -8.5e-12], N[(t1 / N[(u * N[((-u) / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[u, 4.6e+77], N[((-v) / t1), $MachinePrecision], N[(N[(t1 * N[(v / u), $MachinePrecision]), $MachinePrecision] / (-u)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -8.5 \cdot 10^{-12}:\\
\;\;\;\;\frac{t1}{u \cdot \frac{-u}{v}}\\
\mathbf{elif}\;u \leq 4.6 \cdot 10^{+77}:\\
\;\;\;\;\frac{-v}{t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{t1 \cdot \frac{v}{u}}{-u}\\
\end{array}
\end{array}
if u < -8.4999999999999997e-12Initial program 77.7%
times-frac98.4%
Simplified98.4%
Taylor expanded in t1 around 0 89.5%
associate-*r/89.5%
mul-1-neg89.5%
Simplified89.5%
Taylor expanded in t1 around 0 84.6%
*-commutative84.6%
clear-num84.5%
frac-2neg84.5%
frac-times86.3%
*-un-lft-identity86.3%
remove-double-neg86.3%
Applied egg-rr86.3%
if -8.4999999999999997e-12 < u < 4.5999999999999999e77Initial program 68.7%
times-frac98.5%
Simplified98.5%
Taylor expanded in t1 around inf 79.8%
associate-*r/79.8%
neg-mul-179.8%
Simplified79.8%
if 4.5999999999999999e77 < u Initial program 69.8%
times-frac97.4%
Simplified97.4%
Taylor expanded in t1 around 0 85.6%
associate-*r/85.6%
mul-1-neg85.6%
Simplified85.6%
Taylor expanded in t1 around 0 83.9%
frac-2neg83.9%
remove-double-neg83.9%
associate-*l/86.3%
Applied egg-rr86.3%
Final simplification82.9%
(FPCore (u v t1) :precision binary64 (if (<= u -1.9e-12) (/ t1 (* (/ u v) (- t1 u))) (if (<= u 4.6e+77) (/ (- v) t1) (/ (* t1 (/ v u)) (- u)))))
double code(double u, double v, double t1) {
double tmp;
if (u <= -1.9e-12) {
tmp = t1 / ((u / v) * (t1 - u));
} else if (u <= 4.6e+77) {
tmp = -v / t1;
} else {
tmp = (t1 * (v / 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 <= (-1.9d-12)) then
tmp = t1 / ((u / v) * (t1 - u))
else if (u <= 4.6d+77) then
tmp = -v / t1
else
tmp = (t1 * (v / u)) / -u
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if (u <= -1.9e-12) {
tmp = t1 / ((u / v) * (t1 - u));
} else if (u <= 4.6e+77) {
tmp = -v / t1;
} else {
tmp = (t1 * (v / u)) / -u;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if u <= -1.9e-12: tmp = t1 / ((u / v) * (t1 - u)) elif u <= 4.6e+77: tmp = -v / t1 else: tmp = (t1 * (v / u)) / -u return tmp
function code(u, v, t1) tmp = 0.0 if (u <= -1.9e-12) tmp = Float64(t1 / Float64(Float64(u / v) * Float64(t1 - u))); elseif (u <= 4.6e+77) tmp = Float64(Float64(-v) / t1); else tmp = Float64(Float64(t1 * Float64(v / u)) / Float64(-u)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (u <= -1.9e-12) tmp = t1 / ((u / v) * (t1 - u)); elseif (u <= 4.6e+77) tmp = -v / t1; else tmp = (t1 * (v / u)) / -u; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[u, -1.9e-12], N[(t1 / N[(N[(u / v), $MachinePrecision] * N[(t1 - u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[u, 4.6e+77], N[((-v) / t1), $MachinePrecision], N[(N[(t1 * N[(v / u), $MachinePrecision]), $MachinePrecision] / (-u)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -1.9 \cdot 10^{-12}:\\
\;\;\;\;\frac{t1}{\frac{u}{v} \cdot \left(t1 - u\right)}\\
\mathbf{elif}\;u \leq 4.6 \cdot 10^{+77}:\\
\;\;\;\;\frac{-v}{t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{t1 \cdot \frac{v}{u}}{-u}\\
\end{array}
\end{array}
if u < -1.89999999999999998e-12Initial program 77.7%
times-frac98.4%
Simplified98.4%
*-commutative98.4%
clear-num98.2%
frac-2neg98.2%
frac-times95.3%
*-un-lft-identity95.3%
remove-double-neg95.3%
distribute-neg-in95.3%
add-sqr-sqrt60.7%
sqrt-unprod87.7%
sqr-neg87.7%
sqrt-unprod33.3%
add-sqr-sqrt87.6%
sub-neg87.6%
Applied egg-rr87.6%
Taylor expanded in t1 around 0 87.6%
if -1.89999999999999998e-12 < u < 4.5999999999999999e77Initial program 68.7%
times-frac98.5%
Simplified98.5%
Taylor expanded in t1 around inf 79.8%
associate-*r/79.8%
neg-mul-179.8%
Simplified79.8%
if 4.5999999999999999e77 < u Initial program 69.8%
times-frac97.4%
Simplified97.4%
Taylor expanded in t1 around 0 85.6%
associate-*r/85.6%
mul-1-neg85.6%
Simplified85.6%
Taylor expanded in t1 around 0 83.9%
frac-2neg83.9%
remove-double-neg83.9%
associate-*l/86.3%
Applied egg-rr86.3%
Final simplification83.2%
(FPCore (u v t1) :precision binary64 (if (<= u -3e-11) (* (/ v (+ t1 u)) (/ (- t1) u)) (if (<= u 5e+77) (/ (- v) t1) (/ (* t1 (/ v u)) (- u)))))
double code(double u, double v, double t1) {
double tmp;
if (u <= -3e-11) {
tmp = (v / (t1 + u)) * (-t1 / u);
} else if (u <= 5e+77) {
tmp = -v / t1;
} else {
tmp = (t1 * (v / 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 <= (-3d-11)) then
tmp = (v / (t1 + u)) * (-t1 / u)
else if (u <= 5d+77) then
tmp = -v / t1
else
tmp = (t1 * (v / u)) / -u
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if (u <= -3e-11) {
tmp = (v / (t1 + u)) * (-t1 / u);
} else if (u <= 5e+77) {
tmp = -v / t1;
} else {
tmp = (t1 * (v / u)) / -u;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if u <= -3e-11: tmp = (v / (t1 + u)) * (-t1 / u) elif u <= 5e+77: tmp = -v / t1 else: tmp = (t1 * (v / u)) / -u return tmp
function code(u, v, t1) tmp = 0.0 if (u <= -3e-11) tmp = Float64(Float64(v / Float64(t1 + u)) * Float64(Float64(-t1) / u)); elseif (u <= 5e+77) tmp = Float64(Float64(-v) / t1); else tmp = Float64(Float64(t1 * Float64(v / u)) / Float64(-u)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (u <= -3e-11) tmp = (v / (t1 + u)) * (-t1 / u); elseif (u <= 5e+77) tmp = -v / t1; else tmp = (t1 * (v / u)) / -u; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[u, -3e-11], N[(N[(v / N[(t1 + u), $MachinePrecision]), $MachinePrecision] * N[((-t1) / u), $MachinePrecision]), $MachinePrecision], If[LessEqual[u, 5e+77], N[((-v) / t1), $MachinePrecision], N[(N[(t1 * N[(v / u), $MachinePrecision]), $MachinePrecision] / (-u)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -3 \cdot 10^{-11}:\\
\;\;\;\;\frac{v}{t1 + u} \cdot \frac{-t1}{u}\\
\mathbf{elif}\;u \leq 5 \cdot 10^{+77}:\\
\;\;\;\;\frac{-v}{t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{t1 \cdot \frac{v}{u}}{-u}\\
\end{array}
\end{array}
if u < -3e-11Initial program 77.7%
times-frac98.4%
Simplified98.4%
Taylor expanded in t1 around 0 89.5%
associate-*r/89.5%
mul-1-neg89.5%
Simplified89.5%
if -3e-11 < u < 5.00000000000000004e77Initial program 68.7%
times-frac98.5%
Simplified98.5%
Taylor expanded in t1 around inf 79.8%
associate-*r/79.8%
neg-mul-179.8%
Simplified79.8%
if 5.00000000000000004e77 < u Initial program 69.8%
times-frac97.4%
Simplified97.4%
Taylor expanded in t1 around 0 85.6%
associate-*r/85.6%
mul-1-neg85.6%
Simplified85.6%
Taylor expanded in t1 around 0 83.9%
frac-2neg83.9%
remove-double-neg83.9%
associate-*l/86.3%
Applied egg-rr86.3%
Final simplification83.7%
(FPCore (u v t1) :precision binary64 (if (or (<= u -2.05e+65) (not (<= u 3e+77))) (/ t1 (/ u (/ v u))) (/ (- v) t1)))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -2.05e+65) || !(u <= 3e+77)) {
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 <= (-2.05d+65)) .or. (.not. (u <= 3d+77))) 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 <= -2.05e+65) || !(u <= 3e+77)) {
tmp = t1 / (u / (v / u));
} else {
tmp = -v / t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -2.05e+65) or not (u <= 3e+77): tmp = t1 / (u / (v / u)) else: tmp = -v / t1 return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -2.05e+65) || !(u <= 3e+77)) 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 <= -2.05e+65) || ~((u <= 3e+77))) tmp = t1 / (u / (v / u)); else tmp = -v / t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -2.05e+65], N[Not[LessEqual[u, 3e+77]], $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 -2.05 \cdot 10^{+65} \lor \neg \left(u \leq 3 \cdot 10^{+77}\right):\\
\;\;\;\;\frac{t1}{\frac{u}{\frac{v}{u}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1}\\
\end{array}
\end{array}
if u < -2.0500000000000001e65 or 2.9999999999999998e77 < u Initial program 73.8%
times-frac97.8%
Simplified97.8%
Taylor expanded in t1 around 0 89.0%
associate-*r/89.0%
mul-1-neg89.0%
Simplified89.0%
Taylor expanded in t1 around 0 85.6%
associate-*l/87.6%
associate-/l*86.1%
add-sqr-sqrt52.4%
sqrt-unprod62.7%
sqr-neg62.7%
sqrt-unprod23.5%
add-sqr-sqrt61.0%
Applied egg-rr61.0%
if -2.0500000000000001e65 < u < 2.9999999999999998e77Initial program 68.9%
times-frac98.6%
Simplified98.6%
Taylor expanded in t1 around inf 77.4%
associate-*r/77.4%
neg-mul-177.4%
Simplified77.4%
Final simplification70.0%
(FPCore (u v t1) :precision binary64 (if (or (<= u -2e+104) (not (<= u 4.5e+218))) (* (/ v u) -0.5) (/ (- v) t1)))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -2e+104) || !(u <= 4.5e+218)) {
tmp = (v / u) * -0.5;
} 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 <= (-2d+104)) .or. (.not. (u <= 4.5d+218))) then
tmp = (v / u) * (-0.5d0)
else
tmp = -v / t1
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((u <= -2e+104) || !(u <= 4.5e+218)) {
tmp = (v / u) * -0.5;
} else {
tmp = -v / t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -2e+104) or not (u <= 4.5e+218): tmp = (v / u) * -0.5 else: tmp = -v / t1 return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -2e+104) || !(u <= 4.5e+218)) tmp = Float64(Float64(v / u) * -0.5); else tmp = Float64(Float64(-v) / t1); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((u <= -2e+104) || ~((u <= 4.5e+218))) tmp = (v / u) * -0.5; else tmp = -v / t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -2e+104], N[Not[LessEqual[u, 4.5e+218]], $MachinePrecision]], N[(N[(v / u), $MachinePrecision] * -0.5), $MachinePrecision], N[((-v) / t1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -2 \cdot 10^{+104} \lor \neg \left(u \leq 4.5 \cdot 10^{+218}\right):\\
\;\;\;\;\frac{v}{u} \cdot -0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1}\\
\end{array}
\end{array}
if u < -2e104 or 4.50000000000000008e218 < u Initial program 72.7%
associate-/r*83.4%
*-commutative83.4%
associate-/l*98.5%
associate-/l/82.7%
+-commutative82.7%
remove-double-neg82.7%
unsub-neg82.7%
div-sub82.8%
sub-neg82.8%
*-inverses82.8%
metadata-eval82.8%
Simplified82.8%
Taylor expanded in t1 around inf 44.0%
mul-1-neg44.0%
unsub-neg44.0%
*-commutative44.0%
Simplified44.0%
Taylor expanded in u around inf 38.7%
if -2e104 < u < 4.50000000000000008e218Initial program 70.5%
times-frac98.1%
Simplified98.1%
Taylor expanded in t1 around inf 65.1%
associate-*r/65.1%
neg-mul-165.1%
Simplified65.1%
Final simplification57.8%
(FPCore (u v t1) :precision binary64 (if (or (<= u -2e+104) (not (<= u 1.85e+217))) (/ (- v) u) (/ (- v) t1)))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -2e+104) || !(u <= 1.85e+217)) {
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 <= (-2d+104)) .or. (.not. (u <= 1.85d+217))) 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 <= -2e+104) || !(u <= 1.85e+217)) {
tmp = -v / u;
} else {
tmp = -v / t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -2e+104) or not (u <= 1.85e+217): tmp = -v / u else: tmp = -v / t1 return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -2e+104) || !(u <= 1.85e+217)) tmp = Float64(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 <= -2e+104) || ~((u <= 1.85e+217))) tmp = -v / u; else tmp = -v / t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -2e+104], N[Not[LessEqual[u, 1.85e+217]], $MachinePrecision]], N[((-v) / u), $MachinePrecision], N[((-v) / t1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -2 \cdot 10^{+104} \lor \neg \left(u \leq 1.85 \cdot 10^{+217}\right):\\
\;\;\;\;\frac{-v}{u}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1}\\
\end{array}
\end{array}
if u < -2e104 or 1.85000000000000005e217 < u Initial program 72.7%
times-frac98.5%
Simplified98.5%
Taylor expanded in t1 around 0 92.3%
associate-*r/92.3%
mul-1-neg92.3%
Simplified92.3%
Taylor expanded in t1 around inf 38.7%
associate-*r/38.7%
neg-mul-138.7%
Simplified38.7%
if -2e104 < u < 1.85000000000000005e217Initial program 70.5%
times-frac98.1%
Simplified98.1%
Taylor expanded in t1 around inf 65.1%
associate-*r/65.1%
neg-mul-165.1%
Simplified65.1%
Final simplification57.8%
(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(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 71.1%
times-frac98.2%
Simplified98.2%
Taylor expanded in t1 around inf 51.8%
associate-*r/51.8%
neg-mul-151.8%
Simplified51.8%
Final simplification51.8%
herbie shell --seed 2024040
(FPCore (u v t1)
:name "Rosa's DopplerBench"
:precision binary64
(/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))