
(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 67.8%
times-frac98.0%
distribute-frac-neg98.0%
distribute-neg-frac298.0%
+-commutative98.0%
distribute-neg-in98.0%
unsub-neg98.0%
Simplified98.0%
Final simplification98.0%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -3.4e+77) (not (<= t1 4e+138))) (/ (- v) (+ t1 (* u 2.0))) (* t1 (/ (/ v (+ t1 u)) (- (- u) t1)))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -3.4e+77) || !(t1 <= 4e+138)) {
tmp = -v / (t1 + (u * 2.0));
} else {
tmp = t1 * ((v / (t1 + u)) / (-u - 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 ((t1 <= (-3.4d+77)) .or. (.not. (t1 <= 4d+138))) then
tmp = -v / (t1 + (u * 2.0d0))
else
tmp = t1 * ((v / (t1 + u)) / (-u - t1))
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -3.4e+77) || !(t1 <= 4e+138)) {
tmp = -v / (t1 + (u * 2.0));
} else {
tmp = t1 * ((v / (t1 + u)) / (-u - t1));
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -3.4e+77) or not (t1 <= 4e+138): tmp = -v / (t1 + (u * 2.0)) else: tmp = t1 * ((v / (t1 + u)) / (-u - t1)) return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -3.4e+77) || !(t1 <= 4e+138)) tmp = Float64(Float64(-v) / Float64(t1 + Float64(u * 2.0))); else tmp = Float64(t1 * Float64(Float64(v / Float64(t1 + u)) / Float64(Float64(-u) - t1))); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -3.4e+77) || ~((t1 <= 4e+138))) tmp = -v / (t1 + (u * 2.0)); else tmp = t1 * ((v / (t1 + u)) / (-u - t1)); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -3.4e+77], N[Not[LessEqual[t1, 4e+138]], $MachinePrecision]], N[((-v) / N[(t1 + N[(u * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t1 * N[(N[(v / N[(t1 + u), $MachinePrecision]), $MachinePrecision] / N[((-u) - t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -3.4 \cdot 10^{+77} \lor \neg \left(t1 \leq 4 \cdot 10^{+138}\right):\\
\;\;\;\;\frac{-v}{t1 + u \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;t1 \cdot \frac{\frac{v}{t1 + u}}{\left(-u\right) - t1}\\
\end{array}
\end{array}
if t1 < -3.39999999999999997e77 or 4.0000000000000001e138 < t1 Initial program 41.3%
times-frac100.0%
distribute-frac-neg100.0%
distribute-neg-frac2100.0%
+-commutative100.0%
distribute-neg-in100.0%
unsub-neg100.0%
Simplified100.0%
clear-num99.9%
frac-2neg99.9%
frac-times98.8%
*-un-lft-identity98.8%
+-commutative98.8%
distribute-neg-in98.8%
sub-neg98.8%
frac-2neg98.8%
sub-neg98.8%
distribute-neg-in98.8%
+-commutative98.8%
remove-double-neg98.8%
add-sqr-sqrt46.3%
sqrt-unprod15.4%
sqr-neg15.4%
sqrt-unprod15.2%
add-sqr-sqrt28.4%
sub-neg28.4%
distribute-neg-in28.4%
+-commutative28.4%
add-sqr-sqrt10.7%
sqrt-unprod38.2%
Applied egg-rr98.8%
Taylor expanded in u around 0 91.1%
*-commutative91.1%
Simplified91.1%
if -3.39999999999999997e77 < t1 < 4.0000000000000001e138Initial program 81.2%
associate-/l*84.6%
distribute-lft-neg-out84.6%
distribute-rgt-neg-in84.6%
associate-/r*91.2%
distribute-neg-frac291.2%
Simplified91.2%
Final simplification91.1%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -2.6e+17) (not (<= t1 1.4e-12))) (/ (- v) (+ t1 u)) (* (/ t1 u) (/ v (- u)))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -2.6e+17) || !(t1 <= 1.4e-12)) {
tmp = -v / (t1 + u);
} 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.6d+17)) .or. (.not. (t1 <= 1.4d-12))) then
tmp = -v / (t1 + u)
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.6e+17) || !(t1 <= 1.4e-12)) {
tmp = -v / (t1 + u);
} else {
tmp = (t1 / u) * (v / -u);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -2.6e+17) or not (t1 <= 1.4e-12): tmp = -v / (t1 + u) else: tmp = (t1 / u) * (v / -u) return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -2.6e+17) || !(t1 <= 1.4e-12)) tmp = Float64(Float64(-v) / Float64(t1 + u)); 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 <= -2.6e+17) || ~((t1 <= 1.4e-12))) tmp = -v / (t1 + u); else tmp = (t1 / u) * (v / -u); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -2.6e+17], N[Not[LessEqual[t1, 1.4e-12]], $MachinePrecision]], N[((-v) / N[(t1 + u), $MachinePrecision]), $MachinePrecision], N[(N[(t1 / u), $MachinePrecision] * N[(v / (-u)), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -2.6 \cdot 10^{+17} \lor \neg \left(t1 \leq 1.4 \cdot 10^{-12}\right):\\
\;\;\;\;\frac{-v}{t1 + u}\\
\mathbf{else}:\\
\;\;\;\;\frac{t1}{u} \cdot \frac{v}{-u}\\
\end{array}
\end{array}
if t1 < -2.6e17 or 1.4000000000000001e-12 < t1 Initial program 56.1%
times-frac99.9%
distribute-frac-neg99.9%
distribute-neg-frac299.9%
+-commutative99.9%
distribute-neg-in99.9%
unsub-neg99.9%
Simplified99.9%
Taylor expanded in t1 around inf 83.7%
if -2.6e17 < t1 < 1.4000000000000001e-12Initial program 80.0%
times-frac95.9%
distribute-frac-neg95.9%
distribute-neg-frac295.9%
+-commutative95.9%
distribute-neg-in95.9%
unsub-neg95.9%
Simplified95.9%
Taylor expanded in t1 around 0 73.4%
associate-*r/73.4%
mul-1-neg73.4%
Simplified73.4%
Taylor expanded in t1 around 0 77.9%
Final simplification80.9%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -3.8e+18) (not (<= t1 1.2e-10))) (/ (- v) (+ t1 (* u 2.0))) (* (/ t1 u) (/ v (- u)))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -3.8e+18) || !(t1 <= 1.2e-10)) {
tmp = -v / (t1 + (u * 2.0));
} 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.8d+18)) .or. (.not. (t1 <= 1.2d-10))) then
tmp = -v / (t1 + (u * 2.0d0))
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.8e+18) || !(t1 <= 1.2e-10)) {
tmp = -v / (t1 + (u * 2.0));
} else {
tmp = (t1 / u) * (v / -u);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -3.8e+18) or not (t1 <= 1.2e-10): tmp = -v / (t1 + (u * 2.0)) else: tmp = (t1 / u) * (v / -u) return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -3.8e+18) || !(t1 <= 1.2e-10)) tmp = Float64(Float64(-v) / Float64(t1 + Float64(u * 2.0))); 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.8e+18) || ~((t1 <= 1.2e-10))) tmp = -v / (t1 + (u * 2.0)); else tmp = (t1 / u) * (v / -u); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -3.8e+18], N[Not[LessEqual[t1, 1.2e-10]], $MachinePrecision]], N[((-v) / N[(t1 + N[(u * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t1 / u), $MachinePrecision] * N[(v / (-u)), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -3.8 \cdot 10^{+18} \lor \neg \left(t1 \leq 1.2 \cdot 10^{-10}\right):\\
\;\;\;\;\frac{-v}{t1 + u \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{t1}{u} \cdot \frac{v}{-u}\\
\end{array}
\end{array}
if t1 < -3.8e18 or 1.2e-10 < t1 Initial program 56.1%
times-frac99.9%
distribute-frac-neg99.9%
distribute-neg-frac299.9%
+-commutative99.9%
distribute-neg-in99.9%
unsub-neg99.9%
Simplified99.9%
clear-num99.9%
frac-2neg99.9%
frac-times97.0%
*-un-lft-identity97.0%
+-commutative97.0%
distribute-neg-in97.0%
sub-neg97.0%
frac-2neg97.0%
sub-neg97.0%
distribute-neg-in97.0%
+-commutative97.0%
remove-double-neg97.0%
add-sqr-sqrt38.8%
sqrt-unprod23.1%
sqr-neg23.1%
sqrt-unprod14.5%
add-sqr-sqrt25.7%
sub-neg25.7%
distribute-neg-in25.7%
+-commutative25.7%
add-sqr-sqrt9.6%
sqrt-unprod49.8%
Applied egg-rr97.0%
Taylor expanded in u around 0 84.8%
*-commutative84.8%
Simplified84.8%
if -3.8e18 < t1 < 1.2e-10Initial program 80.0%
times-frac95.9%
distribute-frac-neg95.9%
distribute-neg-frac295.9%
+-commutative95.9%
distribute-neg-in95.9%
unsub-neg95.9%
Simplified95.9%
Taylor expanded in t1 around 0 73.4%
associate-*r/73.4%
mul-1-neg73.4%
Simplified73.4%
Taylor expanded in t1 around 0 77.9%
Final simplification81.5%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -1.3e+21) (not (<= t1 4.8e-11))) (/ (- v) (+ t1 (* u 2.0))) (/ (* v (/ t1 u)) (- u))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -1.3e+21) || !(t1 <= 4.8e-11)) {
tmp = -v / (t1 + (u * 2.0));
} 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 <= (-1.3d+21)) .or. (.not. (t1 <= 4.8d-11))) then
tmp = -v / (t1 + (u * 2.0d0))
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 <= -1.3e+21) || !(t1 <= 4.8e-11)) {
tmp = -v / (t1 + (u * 2.0));
} else {
tmp = (v * (t1 / u)) / -u;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -1.3e+21) or not (t1 <= 4.8e-11): tmp = -v / (t1 + (u * 2.0)) else: tmp = (v * (t1 / u)) / -u return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -1.3e+21) || !(t1 <= 4.8e-11)) tmp = Float64(Float64(-v) / Float64(t1 + Float64(u * 2.0))); 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 <= -1.3e+21) || ~((t1 <= 4.8e-11))) tmp = -v / (t1 + (u * 2.0)); else tmp = (v * (t1 / u)) / -u; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -1.3e+21], N[Not[LessEqual[t1, 4.8e-11]], $MachinePrecision]], N[((-v) / N[(t1 + N[(u * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(v * N[(t1 / u), $MachinePrecision]), $MachinePrecision] / (-u)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -1.3 \cdot 10^{+21} \lor \neg \left(t1 \leq 4.8 \cdot 10^{-11}\right):\\
\;\;\;\;\frac{-v}{t1 + u \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{v \cdot \frac{t1}{u}}{-u}\\
\end{array}
\end{array}
if t1 < -1.3e21 or 4.8000000000000002e-11 < t1 Initial program 56.1%
times-frac99.9%
distribute-frac-neg99.9%
distribute-neg-frac299.9%
+-commutative99.9%
distribute-neg-in99.9%
unsub-neg99.9%
Simplified99.9%
clear-num99.9%
frac-2neg99.9%
frac-times97.0%
*-un-lft-identity97.0%
+-commutative97.0%
distribute-neg-in97.0%
sub-neg97.0%
frac-2neg97.0%
sub-neg97.0%
distribute-neg-in97.0%
+-commutative97.0%
remove-double-neg97.0%
add-sqr-sqrt38.8%
sqrt-unprod23.1%
sqr-neg23.1%
sqrt-unprod14.5%
add-sqr-sqrt25.7%
sub-neg25.7%
distribute-neg-in25.7%
+-commutative25.7%
add-sqr-sqrt9.6%
sqrt-unprod49.8%
Applied egg-rr97.0%
Taylor expanded in u around 0 84.8%
*-commutative84.8%
Simplified84.8%
if -1.3e21 < t1 < 4.8000000000000002e-11Initial program 80.0%
times-frac95.9%
distribute-frac-neg95.9%
distribute-neg-frac295.9%
+-commutative95.9%
distribute-neg-in95.9%
unsub-neg95.9%
Simplified95.9%
Taylor expanded in t1 around 0 73.4%
associate-*r/73.4%
mul-1-neg73.4%
Simplified73.4%
Taylor expanded in t1 around 0 77.9%
distribute-frac-neg77.9%
distribute-frac-neg277.9%
associate-*l/76.8%
*-commutative76.8%
associate-/r/78.6%
div-inv78.6%
clear-num78.8%
Applied egg-rr78.8%
Final simplification81.9%
(FPCore (u v t1) :precision binary64 (if (or (<= u -6.1e+115) (not (<= u 1.95e+117))) (/ t1 (* u (/ u v))) (/ (- v) (+ t1 u))))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -6.1e+115) || !(u <= 1.95e+117)) {
tmp = t1 / (u * (u / v));
} else {
tmp = -v / (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.1d+115)) .or. (.not. (u <= 1.95d+117))) then
tmp = t1 / (u * (u / v))
else
tmp = -v / (t1 + u)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((u <= -6.1e+115) || !(u <= 1.95e+117)) {
tmp = t1 / (u * (u / v));
} else {
tmp = -v / (t1 + u);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -6.1e+115) or not (u <= 1.95e+117): tmp = t1 / (u * (u / v)) else: tmp = -v / (t1 + u) return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -6.1e+115) || !(u <= 1.95e+117)) tmp = Float64(t1 / Float64(u * Float64(u / v))); else tmp = Float64(Float64(-v) / Float64(t1 + u)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((u <= -6.1e+115) || ~((u <= 1.95e+117))) tmp = t1 / (u * (u / v)); else tmp = -v / (t1 + u); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -6.1e+115], N[Not[LessEqual[u, 1.95e+117]], $MachinePrecision]], N[(t1 / N[(u * N[(u / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-v) / N[(t1 + u), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -6.1 \cdot 10^{+115} \lor \neg \left(u \leq 1.95 \cdot 10^{+117}\right):\\
\;\;\;\;\frac{t1}{u \cdot \frac{u}{v}}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1 + u}\\
\end{array}
\end{array}
if u < -6.09999999999999966e115 or 1.94999999999999995e117 < u Initial program 75.9%
times-frac98.6%
distribute-frac-neg98.6%
distribute-neg-frac298.6%
+-commutative98.6%
distribute-neg-in98.6%
unsub-neg98.6%
Simplified98.6%
Taylor expanded in t1 around 0 88.7%
associate-*r/88.7%
mul-1-neg88.7%
Simplified88.7%
Taylor expanded in t1 around 0 87.6%
*-commutative87.6%
clear-num87.6%
frac-times82.4%
*-un-lft-identity82.4%
add-sqr-sqrt35.4%
sqrt-unprod61.3%
sqr-neg61.3%
sqrt-prod40.2%
add-sqr-sqrt70.2%
Applied egg-rr70.2%
if -6.09999999999999966e115 < u < 1.94999999999999995e117Initial program 64.0%
times-frac97.7%
distribute-frac-neg97.7%
distribute-neg-frac297.7%
+-commutative97.7%
distribute-neg-in97.7%
unsub-neg97.7%
Simplified97.7%
Taylor expanded in t1 around inf 71.7%
Final simplification71.2%
(FPCore (u v t1) :precision binary64 (if (or (<= u -1.55e+118) (not (<= u 1.7e+164))) (/ v u) (/ v (- t1))))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -1.55e+118) || !(u <= 1.7e+164)) {
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.55d+118)) .or. (.not. (u <= 1.7d+164))) 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.55e+118) || !(u <= 1.7e+164)) {
tmp = v / u;
} else {
tmp = v / -t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -1.55e+118) or not (u <= 1.7e+164): tmp = v / u else: tmp = v / -t1 return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -1.55e+118) || !(u <= 1.7e+164)) 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.55e+118) || ~((u <= 1.7e+164))) tmp = v / u; else tmp = v / -t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -1.55e+118], N[Not[LessEqual[u, 1.7e+164]], $MachinePrecision]], N[(v / u), $MachinePrecision], N[(v / (-t1)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -1.55 \cdot 10^{+118} \lor \neg \left(u \leq 1.7 \cdot 10^{+164}\right):\\
\;\;\;\;\frac{v}{u}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{-t1}\\
\end{array}
\end{array}
if u < -1.54999999999999993e118 or 1.7000000000000001e164 < u Initial program 76.1%
times-frac99.7%
distribute-frac-neg99.7%
distribute-neg-frac299.7%
+-commutative99.7%
distribute-neg-in99.7%
unsub-neg99.7%
Simplified99.7%
Taylor expanded in t1 around 0 93.1%
associate-*r/93.1%
mul-1-neg93.1%
Simplified93.1%
clear-num92.6%
frac-2neg92.6%
frac-times79.9%
*-un-lft-identity79.9%
add-sqr-sqrt34.7%
sqrt-unprod60.1%
sqr-neg60.1%
sqrt-unprod40.5%
add-sqr-sqrt74.0%
add-sqr-sqrt30.7%
sqrt-unprod62.4%
sqr-neg62.4%
sqrt-unprod46.8%
add-sqr-sqrt79.9%
distribute-neg-in79.9%
add-sqr-sqrt33.1%
sqrt-unprod78.2%
sqr-neg78.2%
sqrt-unprod47.0%
add-sqr-sqrt80.1%
sub-neg80.1%
Applied egg-rr80.1%
Taylor expanded in u around 0 40.7%
if -1.54999999999999993e118 < u < 1.7000000000000001e164Initial program 64.9%
times-frac97.4%
distribute-frac-neg97.4%
distribute-neg-frac297.4%
+-commutative97.4%
distribute-neg-in97.4%
unsub-neg97.4%
Simplified97.4%
Taylor expanded in t1 around inf 66.8%
associate-*r/66.8%
neg-mul-166.8%
Simplified66.8%
Final simplification60.0%
(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 67.8%
times-frac98.0%
distribute-frac-neg98.0%
distribute-neg-frac298.0%
+-commutative98.0%
distribute-neg-in98.0%
unsub-neg98.0%
Simplified98.0%
Taylor expanded in t1 around inf 62.6%
Final simplification62.6%
(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 67.8%
times-frac98.0%
distribute-frac-neg98.0%
distribute-neg-frac298.0%
+-commutative98.0%
distribute-neg-in98.0%
unsub-neg98.0%
Simplified98.0%
Taylor expanded in t1 around 0 52.5%
associate-*r/52.5%
mul-1-neg52.5%
Simplified52.5%
clear-num52.4%
frac-2neg52.4%
frac-times48.1%
*-un-lft-identity48.1%
add-sqr-sqrt21.7%
sqrt-unprod32.4%
sqr-neg32.4%
sqrt-unprod14.9%
add-sqr-sqrt29.4%
add-sqr-sqrt12.5%
sqrt-unprod29.9%
sqr-neg29.9%
sqrt-unprod26.5%
add-sqr-sqrt48.1%
distribute-neg-in48.1%
add-sqr-sqrt21.5%
sqrt-unprod50.6%
sqr-neg50.6%
sqrt-unprod27.2%
add-sqr-sqrt48.9%
sub-neg48.9%
Applied egg-rr48.9%
Taylor expanded in u around 0 16.2%
Final simplification16.2%
herbie shell --seed 2024096
(FPCore (u v t1)
:name "Rosa's DopplerBench"
:precision binary64
(/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))