
(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 13 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 68.0%
times-frac98.7%
Simplified98.7%
Final simplification98.7%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -5.8e+70) (not (<= t1 9e-58))) (/ v (- (* u -2.0) t1)) (* (/ (- t1) u) (/ v u))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -5.8e+70) || !(t1 <= 9e-58)) {
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 <= (-5.8d+70)) .or. (.not. (t1 <= 9d-58))) 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 <= -5.8e+70) || !(t1 <= 9e-58)) {
tmp = v / ((u * -2.0) - t1);
} else {
tmp = (-t1 / u) * (v / u);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -5.8e+70) or not (t1 <= 9e-58): tmp = v / ((u * -2.0) - t1) else: tmp = (-t1 / u) * (v / u) return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -5.8e+70) || !(t1 <= 9e-58)) tmp = Float64(v / Float64(Float64(u * -2.0) - t1)); else tmp = Float64(Float64(Float64(-t1) / u) * Float64(v / u)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -5.8e+70) || ~((t1 <= 9e-58))) 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, -5.8e+70], N[Not[LessEqual[t1, 9e-58]], $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 -5.8 \cdot 10^{+70} \lor \neg \left(t1 \leq 9 \cdot 10^{-58}\right):\\
\;\;\;\;\frac{v}{u \cdot -2 - t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{-t1}{u} \cdot \frac{v}{u}\\
\end{array}
\end{array}
if t1 < -5.7999999999999997e70 or 9.0000000000000006e-58 < t1 Initial program 49.8%
associate-/r*62.8%
*-commutative62.8%
associate-/l*100.0%
associate-/l/96.8%
+-commutative96.8%
remove-double-neg96.8%
unsub-neg96.8%
div-sub96.8%
sub-neg96.8%
*-inverses96.8%
metadata-eval96.8%
Simplified96.8%
Taylor expanded in t1 around inf 90.6%
mul-1-neg90.6%
unsub-neg90.6%
*-commutative90.6%
Simplified90.6%
if -5.7999999999999997e70 < t1 < 9.0000000000000006e-58Initial program 84.1%
times-frac97.6%
Simplified97.6%
Taylor expanded in t1 around 0 78.7%
associate-*r/78.7%
mul-1-neg78.7%
Simplified78.7%
associate-*r/77.8%
frac-2neg77.8%
div-inv77.8%
div-inv77.8%
add-sqr-sqrt47.5%
sqrt-unprod56.1%
sqr-neg56.1%
sqrt-unprod19.1%
add-sqr-sqrt46.5%
distribute-lft-neg-out46.5%
distribute-frac-neg46.5%
*-commutative46.5%
add-sqr-sqrt27.3%
sqrt-unprod50.9%
sqr-neg50.9%
sqrt-unprod30.2%
add-sqr-sqrt77.8%
distribute-neg-in77.8%
Applied egg-rr78.3%
associate-/l*77.3%
associate-/r/79.2%
Applied egg-rr79.2%
Taylor expanded in t1 around 0 79.7%
associate-*r/79.7%
neg-mul-179.7%
Simplified79.7%
Final simplification84.8%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -1.26e+69) (not (<= t1 9e-58))) (/ v (- (* u -2.0) t1)) (/ (/ (- t1) u) (/ u v))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -1.26e+69) || !(t1 <= 9e-58)) {
tmp = v / ((u * -2.0) - t1);
} else {
tmp = (-t1 / u) / (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 ((t1 <= (-1.26d+69)) .or. (.not. (t1 <= 9d-58))) then
tmp = v / ((u * (-2.0d0)) - t1)
else
tmp = (-t1 / u) / (u / v)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -1.26e+69) || !(t1 <= 9e-58)) {
tmp = v / ((u * -2.0) - t1);
} else {
tmp = (-t1 / u) / (u / v);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -1.26e+69) or not (t1 <= 9e-58): tmp = v / ((u * -2.0) - t1) else: tmp = (-t1 / u) / (u / v) return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -1.26e+69) || !(t1 <= 9e-58)) tmp = Float64(v / Float64(Float64(u * -2.0) - t1)); else tmp = Float64(Float64(Float64(-t1) / u) / Float64(u / v)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -1.26e+69) || ~((t1 <= 9e-58))) tmp = v / ((u * -2.0) - t1); else tmp = (-t1 / u) / (u / v); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -1.26e+69], N[Not[LessEqual[t1, 9e-58]], $MachinePrecision]], N[(v / N[(N[(u * -2.0), $MachinePrecision] - t1), $MachinePrecision]), $MachinePrecision], N[(N[((-t1) / u), $MachinePrecision] / N[(u / v), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -1.26 \cdot 10^{+69} \lor \neg \left(t1 \leq 9 \cdot 10^{-58}\right):\\
\;\;\;\;\frac{v}{u \cdot -2 - t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{-t1}{u}}{\frac{u}{v}}\\
\end{array}
\end{array}
if t1 < -1.26000000000000005e69 or 9.0000000000000006e-58 < t1 Initial program 49.8%
associate-/r*62.8%
*-commutative62.8%
associate-/l*100.0%
associate-/l/96.8%
+-commutative96.8%
remove-double-neg96.8%
unsub-neg96.8%
div-sub96.8%
sub-neg96.8%
*-inverses96.8%
metadata-eval96.8%
Simplified96.8%
Taylor expanded in t1 around inf 90.6%
mul-1-neg90.6%
unsub-neg90.6%
*-commutative90.6%
Simplified90.6%
if -1.26000000000000005e69 < t1 < 9.0000000000000006e-58Initial program 84.1%
times-frac97.6%
Simplified97.6%
*-commutative97.6%
clear-num97.6%
frac-2neg97.6%
frac-times89.2%
*-un-lft-identity89.2%
remove-double-neg89.2%
distribute-neg-in89.2%
add-sqr-sqrt55.2%
sqrt-unprod86.7%
sqr-neg86.7%
sqrt-unprod31.6%
add-sqr-sqrt76.1%
sub-neg76.1%
Applied egg-rr76.1%
*-commutative76.1%
associate-/r*79.0%
Simplified79.0%
Taylor expanded in t1 around 0 80.1%
Taylor expanded in t1 around 0 80.6%
associate-*r/80.6%
mul-1-neg80.6%
Simplified80.6%
Final simplification85.3%
(FPCore (u v t1) :precision binary64 (if (or (<= u -9.2e+86) (not (<= u 8.5e+192))) (/ 1.0 (/ u v)) (/ (- v) t1)))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -9.2e+86) || !(u <= 8.5e+192)) {
tmp = 1.0 / (u / v);
} 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 <= (-9.2d+86)) .or. (.not. (u <= 8.5d+192))) then
tmp = 1.0d0 / (u / v)
else
tmp = -v / t1
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((u <= -9.2e+86) || !(u <= 8.5e+192)) {
tmp = 1.0 / (u / v);
} else {
tmp = -v / t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -9.2e+86) or not (u <= 8.5e+192): tmp = 1.0 / (u / v) else: tmp = -v / t1 return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -9.2e+86) || !(u <= 8.5e+192)) tmp = Float64(1.0 / Float64(u / v)); else tmp = Float64(Float64(-v) / t1); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((u <= -9.2e+86) || ~((u <= 8.5e+192))) tmp = 1.0 / (u / v); else tmp = -v / t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -9.2e+86], N[Not[LessEqual[u, 8.5e+192]], $MachinePrecision]], N[(1.0 / N[(u / v), $MachinePrecision]), $MachinePrecision], N[((-v) / t1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -9.2 \cdot 10^{+86} \lor \neg \left(u \leq 8.5 \cdot 10^{+192}\right):\\
\;\;\;\;\frac{1}{\frac{u}{v}}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1}\\
\end{array}
\end{array}
if u < -9.19999999999999958e86 or 8.49999999999999965e192 < u Initial program 80.0%
times-frac99.9%
Simplified99.9%
*-commutative99.9%
clear-num99.9%
frac-2neg99.9%
frac-times90.2%
*-un-lft-identity90.2%
remove-double-neg90.2%
distribute-neg-in90.2%
add-sqr-sqrt46.4%
sqrt-unprod86.5%
sqr-neg86.5%
sqrt-unprod43.8%
add-sqr-sqrt88.9%
sub-neg88.9%
Applied egg-rr88.9%
*-commutative88.9%
associate-/r*91.2%
Simplified91.2%
Taylor expanded in t1 around 0 90.2%
Taylor expanded in t1 around inf 49.0%
if -9.19999999999999958e86 < u < 8.49999999999999965e192Initial program 62.8%
times-frac98.1%
Simplified98.1%
Taylor expanded in t1 around inf 66.0%
associate-*r/66.0%
neg-mul-166.0%
Simplified66.0%
Final simplification60.8%
(FPCore (u v t1) :precision binary64 (if (<= u -3.5e+83) (/ v (+ t1 u)) (if (<= u 2.5e+192) (/ (- v) t1) (/ 1.0 (/ u v)))))
double code(double u, double v, double t1) {
double tmp;
if (u <= -3.5e+83) {
tmp = v / (t1 + u);
} else if (u <= 2.5e+192) {
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 <= (-3.5d+83)) then
tmp = v / (t1 + u)
else if (u <= 2.5d+192) 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 <= -3.5e+83) {
tmp = v / (t1 + u);
} else if (u <= 2.5e+192) {
tmp = -v / t1;
} else {
tmp = 1.0 / (u / v);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if u <= -3.5e+83: tmp = v / (t1 + u) elif u <= 2.5e+192: tmp = -v / t1 else: tmp = 1.0 / (u / v) return tmp
function code(u, v, t1) tmp = 0.0 if (u <= -3.5e+83) tmp = Float64(v / Float64(t1 + u)); elseif (u <= 2.5e+192) tmp = Float64(Float64(-v) / 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 <= -3.5e+83) tmp = v / (t1 + u); elseif (u <= 2.5e+192) tmp = -v / t1; else tmp = 1.0 / (u / v); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[u, -3.5e+83], N[(v / N[(t1 + u), $MachinePrecision]), $MachinePrecision], If[LessEqual[u, 2.5e+192], N[((-v) / t1), $MachinePrecision], N[(1.0 / N[(u / v), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -3.5 \cdot 10^{+83}:\\
\;\;\;\;\frac{v}{t1 + u}\\
\mathbf{elif}\;u \leq 2.5 \cdot 10^{+192}:\\
\;\;\;\;\frac{-v}{t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{u}{v}}\\
\end{array}
\end{array}
if u < -3.49999999999999977e83Initial program 75.8%
times-frac99.9%
Simplified99.9%
associate-*r/99.9%
clear-num99.8%
associate-*l/99.8%
*-un-lft-identity99.8%
frac-2neg99.8%
distribute-neg-in99.8%
add-sqr-sqrt56.6%
sqrt-unprod82.5%
sqr-neg82.5%
sqrt-unprod38.8%
add-sqr-sqrt88.8%
sub-neg88.8%
remove-double-neg88.8%
Applied egg-rr88.8%
Taylor expanded in t1 around inf 45.6%
if -3.49999999999999977e83 < u < 2.50000000000000017e192Initial program 62.8%
times-frac98.1%
Simplified98.1%
Taylor expanded in t1 around inf 66.0%
associate-*r/66.0%
neg-mul-166.0%
Simplified66.0%
if 2.50000000000000017e192 < u Initial program 85.4%
times-frac99.9%
Simplified99.9%
*-commutative99.9%
clear-num100.0%
frac-2neg100.0%
frac-times91.6%
*-un-lft-identity91.6%
remove-double-neg91.6%
distribute-neg-in91.6%
add-sqr-sqrt41.4%
sqrt-unprod91.6%
sqr-neg91.6%
sqrt-unprod50.2%
add-sqr-sqrt91.6%
sub-neg91.6%
Applied egg-rr91.6%
*-commutative91.6%
associate-/r*94.4%
Simplified94.4%
Taylor expanded in t1 around 0 94.4%
Taylor expanded in t1 around inf 55.3%
Final simplification61.0%
(FPCore (u v t1) :precision binary64 (if (or (<= u -9e+86) (not (<= u 4.6e+217))) (/ v u) (/ (- v) t1)))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -9e+86) || !(u <= 4.6e+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 <= (-9d+86)) .or. (.not. (u <= 4.6d+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 <= -9e+86) || !(u <= 4.6e+217)) {
tmp = v / u;
} else {
tmp = -v / t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -9e+86) or not (u <= 4.6e+217): tmp = v / u else: tmp = -v / t1 return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -9e+86) || !(u <= 4.6e+217)) 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 <= -9e+86) || ~((u <= 4.6e+217))) tmp = v / u; else tmp = -v / t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -9e+86], N[Not[LessEqual[u, 4.6e+217]], $MachinePrecision]], N[(v / u), $MachinePrecision], N[((-v) / t1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -9 \cdot 10^{+86} \lor \neg \left(u \leq 4.6 \cdot 10^{+217}\right):\\
\;\;\;\;\frac{v}{u}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1}\\
\end{array}
\end{array}
if u < -8.99999999999999986e86 or 4.5999999999999998e217 < u Initial program 82.9%
times-frac99.9%
Simplified99.9%
Taylor expanded in t1 around 0 93.0%
associate-*r/93.0%
mul-1-neg93.0%
Simplified93.0%
associate-*r/91.6%
frac-2neg91.6%
div-inv91.5%
div-inv91.6%
add-sqr-sqrt48.8%
sqrt-unprod71.2%
sqr-neg71.2%
sqrt-unprod37.2%
add-sqr-sqrt75.7%
distribute-lft-neg-out75.7%
distribute-frac-neg75.7%
*-commutative75.7%
add-sqr-sqrt38.5%
sqrt-unprod69.4%
sqr-neg69.4%
sqrt-unprod42.7%
add-sqr-sqrt91.6%
distribute-neg-in91.6%
Applied egg-rr91.6%
Taylor expanded in t1 around inf 51.0%
if -8.99999999999999986e86 < u < 4.5999999999999998e217Initial program 62.7%
times-frac98.2%
Simplified98.2%
Taylor expanded in t1 around inf 64.2%
associate-*r/64.2%
neg-mul-164.2%
Simplified64.2%
Final simplification60.7%
(FPCore (u v t1) :precision binary64 (if (<= u -1.4e+81) (/ (- v) u) (if (<= u 5e+217) (/ (- v) t1) (/ v u))))
double code(double u, double v, double t1) {
double tmp;
if (u <= -1.4e+81) {
tmp = -v / u;
} else if (u <= 5e+217) {
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.4d+81)) then
tmp = -v / u
else if (u <= 5d+217) 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.4e+81) {
tmp = -v / u;
} else if (u <= 5e+217) {
tmp = -v / t1;
} else {
tmp = v / u;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if u <= -1.4e+81: tmp = -v / u elif u <= 5e+217: tmp = -v / t1 else: tmp = v / u return tmp
function code(u, v, t1) tmp = 0.0 if (u <= -1.4e+81) tmp = Float64(Float64(-v) / u); elseif (u <= 5e+217) 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.4e+81) tmp = -v / u; elseif (u <= 5e+217) tmp = -v / t1; else tmp = v / u; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[u, -1.4e+81], N[((-v) / u), $MachinePrecision], If[LessEqual[u, 5e+217], N[((-v) / t1), $MachinePrecision], N[(v / u), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -1.4 \cdot 10^{+81}:\\
\;\;\;\;\frac{-v}{u}\\
\mathbf{elif}\;u \leq 5 \cdot 10^{+217}:\\
\;\;\;\;\frac{-v}{t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{u}\\
\end{array}
\end{array}
if u < -1.39999999999999997e81Initial program 76.8%
times-frac99.9%
Simplified99.9%
Taylor expanded in t1 around 0 89.2%
associate-*r/89.2%
mul-1-neg89.2%
Simplified89.2%
Taylor expanded in t1 around inf 42.2%
associate-*r/42.2%
neg-mul-142.2%
Simplified42.2%
if -1.39999999999999997e81 < u < 5.00000000000000041e217Initial program 62.3%
times-frac98.2%
Simplified98.2%
Taylor expanded in t1 around inf 64.8%
associate-*r/64.8%
neg-mul-164.8%
Simplified64.8%
if 5.00000000000000041e217 < u Initial program 95.8%
times-frac99.9%
Simplified99.9%
Taylor expanded in t1 around 0 99.9%
associate-*r/99.9%
mul-1-neg99.9%
Simplified99.9%
associate-*r/100.0%
frac-2neg100.0%
div-inv100.0%
div-inv100.0%
add-sqr-sqrt50.0%
sqrt-unprod83.6%
sqr-neg83.6%
sqrt-unprod50.0%
add-sqr-sqrt96.0%
distribute-lft-neg-out96.0%
distribute-frac-neg96.0%
*-commutative96.0%
add-sqr-sqrt46.0%
sqrt-unprod83.6%
sqr-neg83.6%
sqrt-unprod50.0%
add-sqr-sqrt100.0%
distribute-neg-in100.0%
Applied egg-rr100.0%
Taylor expanded in t1 around inf 64.5%
Final simplification60.7%
(FPCore (u v t1) :precision binary64 (if (<= u -7.6e+80) (* -0.5 (/ v u)) (if (<= u 3.8e+219) (/ (- v) t1) (/ v u))))
double code(double u, double v, double t1) {
double tmp;
if (u <= -7.6e+80) {
tmp = -0.5 * (v / u);
} else if (u <= 3.8e+219) {
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 <= (-7.6d+80)) then
tmp = (-0.5d0) * (v / u)
else if (u <= 3.8d+219) 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 <= -7.6e+80) {
tmp = -0.5 * (v / u);
} else if (u <= 3.8e+219) {
tmp = -v / t1;
} else {
tmp = v / u;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if u <= -7.6e+80: tmp = -0.5 * (v / u) elif u <= 3.8e+219: tmp = -v / t1 else: tmp = v / u return tmp
function code(u, v, t1) tmp = 0.0 if (u <= -7.6e+80) tmp = Float64(-0.5 * Float64(v / u)); elseif (u <= 3.8e+219) 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 <= -7.6e+80) tmp = -0.5 * (v / u); elseif (u <= 3.8e+219) tmp = -v / t1; else tmp = v / u; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[u, -7.6e+80], N[(-0.5 * N[(v / u), $MachinePrecision]), $MachinePrecision], If[LessEqual[u, 3.8e+219], N[((-v) / t1), $MachinePrecision], N[(v / u), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -7.6 \cdot 10^{+80}:\\
\;\;\;\;-0.5 \cdot \frac{v}{u}\\
\mathbf{elif}\;u \leq 3.8 \cdot 10^{+219}:\\
\;\;\;\;\frac{-v}{t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{u}\\
\end{array}
\end{array}
if u < -7.59999999999999995e80Initial program 76.8%
associate-/r*87.2%
*-commutative87.2%
associate-/l*99.8%
associate-/l/91.7%
+-commutative91.7%
remove-double-neg91.7%
unsub-neg91.7%
div-sub91.7%
sub-neg91.7%
*-inverses91.7%
metadata-eval91.7%
Simplified91.7%
Taylor expanded in t1 around inf 54.6%
mul-1-neg54.6%
unsub-neg54.6%
*-commutative54.6%
Simplified54.6%
Taylor expanded in u around inf 42.3%
if -7.59999999999999995e80 < u < 3.79999999999999996e219Initial program 62.3%
times-frac98.2%
Simplified98.2%
Taylor expanded in t1 around inf 64.8%
associate-*r/64.8%
neg-mul-164.8%
Simplified64.8%
if 3.79999999999999996e219 < u Initial program 95.8%
times-frac99.9%
Simplified99.9%
Taylor expanded in t1 around 0 99.9%
associate-*r/99.9%
mul-1-neg99.9%
Simplified99.9%
associate-*r/100.0%
frac-2neg100.0%
div-inv100.0%
div-inv100.0%
add-sqr-sqrt50.0%
sqrt-unprod83.6%
sqr-neg83.6%
sqrt-unprod50.0%
add-sqr-sqrt96.0%
distribute-lft-neg-out96.0%
distribute-frac-neg96.0%
*-commutative96.0%
add-sqr-sqrt46.0%
sqrt-unprod83.6%
sqr-neg83.6%
sqrt-unprod50.0%
add-sqr-sqrt100.0%
distribute-neg-in100.0%
Applied egg-rr100.0%
Taylor expanded in t1 around inf 64.5%
Final simplification60.7%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -2.2e+87) (not (<= t1 4.5e+52))) (/ v t1) (/ v u)))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -2.2e+87) || !(t1 <= 4.5e+52)) {
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 <= (-2.2d+87)) .or. (.not. (t1 <= 4.5d+52))) 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 <= -2.2e+87) || !(t1 <= 4.5e+52)) {
tmp = v / t1;
} else {
tmp = v / u;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -2.2e+87) or not (t1 <= 4.5e+52): tmp = v / t1 else: tmp = v / u return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -2.2e+87) || !(t1 <= 4.5e+52)) 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 <= -2.2e+87) || ~((t1 <= 4.5e+52))) tmp = v / t1; else tmp = v / u; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -2.2e+87], N[Not[LessEqual[t1, 4.5e+52]], $MachinePrecision]], N[(v / t1), $MachinePrecision], N[(v / u), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -2.2 \cdot 10^{+87} \lor \neg \left(t1 \leq 4.5 \cdot 10^{+52}\right):\\
\;\;\;\;\frac{v}{t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{u}\\
\end{array}
\end{array}
if t1 < -2.2000000000000001e87 or 4.5e52 < t1 Initial program 43.1%
times-frac99.9%
Simplified99.9%
*-commutative99.9%
clear-num97.7%
frac-2neg97.7%
frac-times65.4%
*-un-lft-identity65.4%
remove-double-neg65.4%
distribute-neg-in65.4%
add-sqr-sqrt29.0%
sqrt-unprod39.3%
sqr-neg39.3%
sqrt-unprod22.2%
add-sqr-sqrt36.2%
sub-neg36.2%
Applied egg-rr36.2%
*-commutative36.2%
associate-/r*38.2%
Simplified38.2%
Taylor expanded in t1 around inf 27.3%
if -2.2000000000000001e87 < t1 < 4.5e52Initial program 85.1%
times-frac97.9%
Simplified97.9%
Taylor expanded in t1 around 0 75.1%
associate-*r/75.1%
mul-1-neg75.1%
Simplified75.1%
associate-*r/74.3%
frac-2neg74.3%
div-inv74.3%
div-inv74.3%
add-sqr-sqrt42.5%
sqrt-unprod53.8%
sqr-neg53.8%
sqrt-unprod20.7%
add-sqr-sqrt45.2%
distribute-lft-neg-out45.2%
distribute-frac-neg45.2%
*-commutative45.2%
add-sqr-sqrt24.5%
sqrt-unprod50.3%
sqr-neg50.3%
sqrt-unprod31.7%
add-sqr-sqrt74.3%
distribute-neg-in74.3%
Applied egg-rr75.0%
Taylor expanded in t1 around inf 23.2%
Final simplification24.9%
(FPCore (u v t1) :precision binary64 (/ (/ v (- -1.0 (/ u t1))) (+ t1 u)))
double code(double u, double v, double t1) {
return (v / (-1.0 - (u / t1))) / (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 / ((-1.0d0) - (u / t1))) / (t1 + u)
end function
public static double code(double u, double v, double t1) {
return (v / (-1.0 - (u / t1))) / (t1 + u);
}
def code(u, v, t1): return (v / (-1.0 - (u / t1))) / (t1 + u)
function code(u, v, t1) return Float64(Float64(v / Float64(-1.0 - Float64(u / t1))) / Float64(t1 + u)) end
function tmp = code(u, v, t1) tmp = (v / (-1.0 - (u / t1))) / (t1 + u); end
code[u_, v_, t1_] := N[(N[(v / N[(-1.0 - N[(u / t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t1 + u), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{v}{-1 - \frac{u}{t1}}}{t1 + u}
\end{array}
Initial program 68.0%
times-frac98.7%
Simplified98.7%
associate-*r/98.2%
clear-num97.9%
associate-*l/98.0%
*-un-lft-identity98.0%
frac-2neg98.0%
distribute-neg-in98.0%
add-sqr-sqrt51.3%
sqrt-unprod66.9%
sqr-neg66.9%
sqrt-unprod27.6%
add-sqr-sqrt59.0%
sub-neg59.0%
remove-double-neg59.0%
Applied egg-rr59.0%
frac-2neg59.0%
add-sqr-sqrt31.4%
sqrt-unprod44.4%
sqr-neg44.4%
sqrt-unprod37.6%
add-sqr-sqrt76.6%
distribute-neg-frac76.6%
neg-sub076.6%
div-sub76.6%
*-inverses76.6%
sub-neg76.6%
mul-1-neg76.6%
associate-*r/76.6%
neg-mul-176.6%
add-sqr-sqrt37.7%
sqrt-unprod79.6%
sqr-neg79.6%
sqrt-unprod51.4%
add-sqr-sqrt98.0%
frac-2neg98.0%
Applied egg-rr98.0%
associate--r+98.0%
metadata-eval98.0%
Simplified98.0%
Final simplification98.0%
(FPCore (u v t1) :precision binary64 (/ v (- (* u -2.0) t1)))
double code(double u, double v, double t1) {
return v / ((u * -2.0) - 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 / ((u * (-2.0d0)) - t1)
end function
public static double code(double u, double v, double t1) {
return v / ((u * -2.0) - t1);
}
def code(u, v, t1): return v / ((u * -2.0) - t1)
function code(u, v, t1) return Float64(v / Float64(Float64(u * -2.0) - t1)) end
function tmp = code(u, v, t1) tmp = v / ((u * -2.0) - t1); end
code[u_, v_, t1_] := N[(v / N[(N[(u * -2.0), $MachinePrecision] - t1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{v}{u \cdot -2 - t1}
\end{array}
Initial program 68.0%
associate-/r*79.0%
*-commutative79.0%
associate-/l*98.0%
associate-/l/96.2%
+-commutative96.2%
remove-double-neg96.2%
unsub-neg96.2%
div-sub96.2%
sub-neg96.2%
*-inverses96.2%
metadata-eval96.2%
Simplified96.2%
Taylor expanded in t1 around inf 63.9%
mul-1-neg63.9%
unsub-neg63.9%
*-commutative63.9%
Simplified63.9%
Final simplification63.9%
(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 68.0%
times-frac98.7%
Simplified98.7%
associate-*r/98.2%
clear-num97.9%
associate-*l/98.0%
*-un-lft-identity98.0%
frac-2neg98.0%
distribute-neg-in98.0%
add-sqr-sqrt51.3%
sqrt-unprod66.9%
sqr-neg66.9%
sqrt-unprod27.6%
add-sqr-sqrt59.0%
sub-neg59.0%
remove-double-neg59.0%
Applied egg-rr59.0%
frac-2neg59.0%
add-sqr-sqrt31.4%
sqrt-unprod44.4%
sqr-neg44.4%
sqrt-unprod37.6%
add-sqr-sqrt76.6%
distribute-neg-frac76.6%
neg-sub076.6%
div-sub76.6%
*-inverses76.6%
sub-neg76.6%
mul-1-neg76.6%
associate-*r/76.6%
neg-mul-176.6%
add-sqr-sqrt37.7%
sqrt-unprod79.6%
sqr-neg79.6%
sqrt-unprod51.4%
add-sqr-sqrt98.0%
frac-2neg98.0%
Applied egg-rr98.0%
associate--r+98.0%
metadata-eval98.0%
Simplified98.0%
Taylor expanded in u around 0 63.7%
neg-mul-163.7%
Simplified63.7%
Final simplification63.7%
(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 68.0%
times-frac98.7%
Simplified98.7%
*-commutative98.7%
clear-num97.8%
frac-2neg97.8%
frac-times80.2%
*-un-lft-identity80.2%
remove-double-neg80.2%
distribute-neg-in80.2%
add-sqr-sqrt41.5%
sqrt-unprod65.2%
sqr-neg65.2%
sqrt-unprod28.6%
add-sqr-sqrt57.9%
sub-neg57.9%
Applied egg-rr57.9%
*-commutative57.9%
associate-/r*60.2%
Simplified60.2%
Taylor expanded in t1 around inf 12.4%
Final simplification12.4%
herbie shell --seed 2024027
(FPCore (u v t1)
:name "Rosa's DopplerBench"
:precision binary64
(/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))