
(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 10 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 78.2%
times-frac97.7%
Simplified97.7%
Final simplification97.7%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (/ v (- (* u -2.0) t1)))
(t_2 (/ (- t1) u))
(t_3 (* (/ v (+ t1 u)) t_2)))
(if (<= u -8.8e-24)
t_3
(if (<= u 3e-57)
t_1
(if (<= u 1.25e-17) (* t_2 (/ v u)) (if (<= u 4.4e+17) t_1 t_3))))))
double code(double u, double v, double t1) {
double t_1 = v / ((u * -2.0) - t1);
double t_2 = -t1 / u;
double t_3 = (v / (t1 + u)) * t_2;
double tmp;
if (u <= -8.8e-24) {
tmp = t_3;
} else if (u <= 3e-57) {
tmp = t_1;
} else if (u <= 1.25e-17) {
tmp = t_2 * (v / u);
} else if (u <= 4.4e+17) {
tmp = t_1;
} else {
tmp = t_3;
}
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) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = v / ((u * (-2.0d0)) - t1)
t_2 = -t1 / u
t_3 = (v / (t1 + u)) * t_2
if (u <= (-8.8d-24)) then
tmp = t_3
else if (u <= 3d-57) then
tmp = t_1
else if (u <= 1.25d-17) then
tmp = t_2 * (v / u)
else if (u <= 4.4d+17) then
tmp = t_1
else
tmp = t_3
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double t_1 = v / ((u * -2.0) - t1);
double t_2 = -t1 / u;
double t_3 = (v / (t1 + u)) * t_2;
double tmp;
if (u <= -8.8e-24) {
tmp = t_3;
} else if (u <= 3e-57) {
tmp = t_1;
} else if (u <= 1.25e-17) {
tmp = t_2 * (v / u);
} else if (u <= 4.4e+17) {
tmp = t_1;
} else {
tmp = t_3;
}
return tmp;
}
def code(u, v, t1): t_1 = v / ((u * -2.0) - t1) t_2 = -t1 / u t_3 = (v / (t1 + u)) * t_2 tmp = 0 if u <= -8.8e-24: tmp = t_3 elif u <= 3e-57: tmp = t_1 elif u <= 1.25e-17: tmp = t_2 * (v / u) elif u <= 4.4e+17: tmp = t_1 else: tmp = t_3 return tmp
function code(u, v, t1) t_1 = Float64(v / Float64(Float64(u * -2.0) - t1)) t_2 = Float64(Float64(-t1) / u) t_3 = Float64(Float64(v / Float64(t1 + u)) * t_2) tmp = 0.0 if (u <= -8.8e-24) tmp = t_3; elseif (u <= 3e-57) tmp = t_1; elseif (u <= 1.25e-17) tmp = Float64(t_2 * Float64(v / u)); elseif (u <= 4.4e+17) tmp = t_1; else tmp = t_3; end return tmp end
function tmp_2 = code(u, v, t1) t_1 = v / ((u * -2.0) - t1); t_2 = -t1 / u; t_3 = (v / (t1 + u)) * t_2; tmp = 0.0; if (u <= -8.8e-24) tmp = t_3; elseif (u <= 3e-57) tmp = t_1; elseif (u <= 1.25e-17) tmp = t_2 * (v / u); elseif (u <= 4.4e+17) tmp = t_1; else tmp = t_3; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[(v / N[(N[(u * -2.0), $MachinePrecision] - t1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[((-t1) / u), $MachinePrecision]}, Block[{t$95$3 = N[(N[(v / N[(t1 + u), $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision]}, If[LessEqual[u, -8.8e-24], t$95$3, If[LessEqual[u, 3e-57], t$95$1, If[LessEqual[u, 1.25e-17], N[(t$95$2 * N[(v / u), $MachinePrecision]), $MachinePrecision], If[LessEqual[u, 4.4e+17], t$95$1, t$95$3]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{v}{u \cdot -2 - t1}\\
t_2 := \frac{-t1}{u}\\
t_3 := \frac{v}{t1 + u} \cdot t_2\\
\mathbf{if}\;u \leq -8.8 \cdot 10^{-24}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;u \leq 3 \cdot 10^{-57}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;u \leq 1.25 \cdot 10^{-17}:\\
\;\;\;\;t_2 \cdot \frac{v}{u}\\
\mathbf{elif}\;u \leq 4.4 \cdot 10^{+17}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_3\\
\end{array}
\end{array}
if u < -8.80000000000000006e-24 or 4.4e17 < u Initial program 79.1%
times-frac98.3%
Simplified98.3%
Taylor expanded in t1 around 0 83.9%
associate-*r/83.9%
mul-1-neg83.9%
Simplified83.9%
if -8.80000000000000006e-24 < u < 3.00000000000000001e-57 or 1.25e-17 < u < 4.4e17Initial program 77.2%
associate-/r*83.7%
*-commutative83.7%
associate-/l*97.8%
associate-/l/99.9%
+-commutative99.9%
remove-double-neg99.9%
unsub-neg99.9%
div-sub99.9%
sub-neg99.9%
*-inverses99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in t1 around inf 86.3%
mul-1-neg86.3%
unsub-neg86.3%
*-commutative86.3%
Simplified86.3%
if 3.00000000000000001e-57 < u < 1.25e-17Initial program 78.7%
times-frac100.0%
Simplified100.0%
Taylor expanded in t1 around 0 78.5%
associate-*r/78.5%
mul-1-neg78.5%
Simplified78.5%
Taylor expanded in t1 around 0 78.8%
Final simplification84.9%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -2.65e-107) (not (<= t1 3.6e-50))) (/ v (- (* u -2.0) t1)) (* (/ (- t1) u) (/ v u))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -2.65e-107) || !(t1 <= 3.6e-50)) {
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.65d-107)) .or. (.not. (t1 <= 3.6d-50))) 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.65e-107) || !(t1 <= 3.6e-50)) {
tmp = v / ((u * -2.0) - t1);
} else {
tmp = (-t1 / u) * (v / u);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -2.65e-107) or not (t1 <= 3.6e-50): 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.65e-107) || !(t1 <= 3.6e-50)) 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 <= -2.65e-107) || ~((t1 <= 3.6e-50))) 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.65e-107], N[Not[LessEqual[t1, 3.6e-50]], $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.65 \cdot 10^{-107} \lor \neg \left(t1 \leq 3.6 \cdot 10^{-50}\right):\\
\;\;\;\;\frac{v}{u \cdot -2 - t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{-t1}{u} \cdot \frac{v}{u}\\
\end{array}
\end{array}
if t1 < -2.65e-107 or 3.59999999999999979e-50 < t1 Initial program 76.0%
associate-/r*85.0%
*-commutative85.0%
associate-/l*99.9%
associate-/l/95.4%
+-commutative95.4%
remove-double-neg95.4%
unsub-neg95.4%
div-sub95.4%
sub-neg95.4%
*-inverses95.4%
metadata-eval95.4%
Simplified95.4%
Taylor expanded in t1 around inf 81.0%
mul-1-neg81.0%
unsub-neg81.0%
*-commutative81.0%
Simplified81.0%
if -2.65e-107 < t1 < 3.59999999999999979e-50Initial program 82.1%
times-frac93.5%
Simplified93.5%
Taylor expanded in t1 around 0 80.5%
associate-*r/80.5%
mul-1-neg80.5%
Simplified80.5%
Taylor expanded in t1 around 0 81.0%
Final simplification81.0%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -5.8e-108) (not (<= t1 3.5e-50))) (/ v (- (* u -2.0) t1)) (/ (* (/ t1 u) (- v)) u)))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -5.8e-108) || !(t1 <= 3.5e-50)) {
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-108)) .or. (.not. (t1 <= 3.5d-50))) 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-108) || !(t1 <= 3.5e-50)) {
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-108) or not (t1 <= 3.5e-50): 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-108) || !(t1 <= 3.5e-50)) 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-108) || ~((t1 <= 3.5e-50))) 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-108], N[Not[LessEqual[t1, 3.5e-50]], $MachinePrecision]], N[(v / N[(N[(u * -2.0), $MachinePrecision] - t1), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t1 / u), $MachinePrecision] * (-v)), $MachinePrecision] / u), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -5.8 \cdot 10^{-108} \lor \neg \left(t1 \leq 3.5 \cdot 10^{-50}\right):\\
\;\;\;\;\frac{v}{u \cdot -2 - t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{t1}{u} \cdot \left(-v\right)}{u}\\
\end{array}
\end{array}
if t1 < -5.8000000000000002e-108 or 3.49999999999999997e-50 < t1 Initial program 76.0%
associate-/r*85.0%
*-commutative85.0%
associate-/l*99.9%
associate-/l/95.4%
+-commutative95.4%
remove-double-neg95.4%
unsub-neg95.4%
div-sub95.4%
sub-neg95.4%
*-inverses95.4%
metadata-eval95.4%
Simplified95.4%
Taylor expanded in t1 around inf 81.0%
mul-1-neg81.0%
unsub-neg81.0%
*-commutative81.0%
Simplified81.0%
if -5.8000000000000002e-108 < t1 < 3.49999999999999997e-50Initial program 82.1%
times-frac93.5%
Simplified93.5%
Taylor expanded in t1 around 0 80.5%
associate-*r/80.5%
mul-1-neg80.5%
Simplified80.5%
Taylor expanded in t1 around 0 81.0%
frac-2neg81.0%
associate-*r/81.7%
add-sqr-sqrt36.1%
sqrt-unprod47.1%
sqr-neg47.1%
sqrt-unprod21.4%
add-sqr-sqrt44.3%
add-sqr-sqrt27.0%
sqrt-unprod61.2%
sqr-neg61.2%
sqrt-unprod38.5%
add-sqr-sqrt81.7%
Applied egg-rr81.7%
Final simplification81.3%
(FPCore (u v t1) :precision binary64 (if (or (<= u -4.3e+27) (not (<= u 3.5e+91))) (/ t1 (/ u (/ v u))) (/ (- v) t1)))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -4.3e+27) || !(u <= 3.5e+91)) {
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 <= (-4.3d+27)) .or. (.not. (u <= 3.5d+91))) 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 <= -4.3e+27) || !(u <= 3.5e+91)) {
tmp = t1 / (u / (v / u));
} else {
tmp = -v / t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -4.3e+27) or not (u <= 3.5e+91): tmp = t1 / (u / (v / u)) else: tmp = -v / t1 return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -4.3e+27) || !(u <= 3.5e+91)) 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 <= -4.3e+27) || ~((u <= 3.5e+91))) tmp = t1 / (u / (v / u)); else tmp = -v / t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -4.3e+27], N[Not[LessEqual[u, 3.5e+91]], $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 -4.3 \cdot 10^{+27} \lor \neg \left(u \leq 3.5 \cdot 10^{+91}\right):\\
\;\;\;\;\frac{t1}{\frac{u}{\frac{v}{u}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1}\\
\end{array}
\end{array}
if u < -4.30000000000000008e27 or 3.50000000000000001e91 < u Initial program 80.6%
times-frac97.9%
Simplified97.9%
Taylor expanded in t1 around 0 89.1%
associate-*r/89.1%
mul-1-neg89.1%
Simplified89.1%
Taylor expanded in t1 around 0 86.3%
associate-*l/88.2%
associate-/l*87.3%
add-sqr-sqrt48.2%
sqrt-unprod57.3%
sqr-neg57.3%
sqrt-unprod25.9%
add-sqr-sqrt65.9%
Applied egg-rr65.9%
if -4.30000000000000008e27 < u < 3.50000000000000001e91Initial program 76.7%
times-frac97.6%
Simplified97.6%
Taylor expanded in t1 around inf 75.3%
associate-*r/75.3%
neg-mul-175.3%
Simplified75.3%
Final simplification71.8%
(FPCore (u v t1) :precision binary64 (if (or (<= u -4.3e+27) (not (<= u 4.2e+93))) (/ t1 (/ u (/ v u))) (/ v (- (* u -2.0) t1))))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -4.3e+27) || !(u <= 4.2e+93)) {
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 <= (-4.3d+27)) .or. (.not. (u <= 4.2d+93))) 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 <= -4.3e+27) || !(u <= 4.2e+93)) {
tmp = t1 / (u / (v / u));
} else {
tmp = v / ((u * -2.0) - t1);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -4.3e+27) or not (u <= 4.2e+93): tmp = t1 / (u / (v / u)) else: tmp = v / ((u * -2.0) - t1) return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -4.3e+27) || !(u <= 4.2e+93)) 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 <= -4.3e+27) || ~((u <= 4.2e+93))) 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, -4.3e+27], N[Not[LessEqual[u, 4.2e+93]], $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 -4.3 \cdot 10^{+27} \lor \neg \left(u \leq 4.2 \cdot 10^{+93}\right):\\
\;\;\;\;\frac{t1}{\frac{u}{\frac{v}{u}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{u \cdot -2 - t1}\\
\end{array}
\end{array}
if u < -4.30000000000000008e27 or 4.1999999999999996e93 < u Initial program 80.2%
times-frac97.8%
Simplified97.8%
Taylor expanded in t1 around 0 89.8%
associate-*r/89.8%
mul-1-neg89.8%
Simplified89.8%
Taylor expanded in t1 around 0 87.0%
associate-*l/89.0%
associate-/l*88.0%
add-sqr-sqrt49.2%
sqrt-unprod57.4%
sqr-neg57.4%
sqrt-unprod25.3%
add-sqr-sqrt66.1%
Applied egg-rr66.1%
if -4.30000000000000008e27 < u < 4.1999999999999996e93Initial program 77.0%
associate-/r*84.3%
*-commutative84.3%
associate-/l*98.0%
associate-/l/99.9%
+-commutative99.9%
remove-double-neg99.9%
unsub-neg99.9%
div-sub99.9%
sub-neg99.9%
*-inverses99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in t1 around inf 76.7%
mul-1-neg76.7%
unsub-neg76.7%
*-commutative76.7%
Simplified76.7%
Final simplification72.8%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -1.5e+199) (not (<= t1 2.3e+57))) (/ v t1) (/ v u)))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -1.5e+199) || !(t1 <= 2.3e+57)) {
tmp = v / t1;
} else {
tmp = v / u;
}
return tmp;
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: tmp
if ((t1 <= (-1.5d+199)) .or. (.not. (t1 <= 2.3d+57))) then
tmp = v / t1
else
tmp = v / u
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -1.5e+199) || !(t1 <= 2.3e+57)) {
tmp = v / t1;
} else {
tmp = v / u;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -1.5e+199) or not (t1 <= 2.3e+57): tmp = v / t1 else: tmp = v / u return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -1.5e+199) || !(t1 <= 2.3e+57)) tmp = Float64(v / t1); else tmp = Float64(v / u); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -1.5e+199) || ~((t1 <= 2.3e+57))) tmp = v / t1; else tmp = v / u; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -1.5e+199], N[Not[LessEqual[t1, 2.3e+57]], $MachinePrecision]], N[(v / t1), $MachinePrecision], N[(v / u), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -1.5 \cdot 10^{+199} \lor \neg \left(t1 \leq 2.3 \cdot 10^{+57}\right):\\
\;\;\;\;\frac{v}{t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{u}\\
\end{array}
\end{array}
if t1 < -1.5e199 or 2.2999999999999999e57 < t1 Initial program 63.1%
times-frac99.9%
Simplified99.9%
*-commutative99.9%
clear-num98.6%
frac-2neg98.6%
frac-times77.3%
*-un-lft-identity77.3%
remove-double-neg77.3%
distribute-neg-in77.3%
add-sqr-sqrt24.1%
sqrt-unprod48.9%
sqr-neg48.9%
sqrt-unprod31.1%
add-sqr-sqrt51.3%
sub-neg51.3%
Applied egg-rr51.3%
Taylor expanded in t1 around inf 44.4%
if -1.5e199 < t1 < 2.2999999999999999e57Initial program 84.4%
times-frac96.7%
Simplified96.7%
clear-num96.2%
frac-times94.6%
*-un-lft-identity94.6%
frac-2neg94.6%
distribute-neg-in94.6%
add-sqr-sqrt53.0%
sqrt-unprod76.4%
sqr-neg76.4%
sqrt-unprod26.3%
add-sqr-sqrt57.9%
sub-neg57.9%
remove-double-neg57.9%
Applied egg-rr57.9%
associate-/l/59.5%
Simplified59.5%
Taylor expanded in t1 around 0 60.0%
Taylor expanded in u around 0 17.8%
Final simplification25.6%
(FPCore (u v t1) :precision binary64 (* v (/ -1.0 (- t1 u))))
double code(double u, double v, double t1) {
return v * (-1.0 / (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) / (t1 - u))
end function
public static double code(double u, double v, double t1) {
return v * (-1.0 / (t1 - u));
}
def code(u, v, t1): return v * (-1.0 / (t1 - u))
function code(u, v, t1) return Float64(v * Float64(-1.0 / Float64(t1 - u))) end
function tmp = code(u, v, t1) tmp = v * (-1.0 / (t1 - u)); end
code[u_, v_, t1_] := N[(v * N[(-1.0 / N[(t1 - u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
v \cdot \frac{-1}{t1 - u}
\end{array}
Initial program 78.2%
frac-times97.7%
associate-*r/98.0%
div-inv97.8%
clear-num97.5%
associate-*l/97.4%
*-un-lft-identity97.4%
frac-2neg97.4%
distribute-neg-in97.4%
add-sqr-sqrt46.1%
sqrt-unprod69.6%
sqr-neg69.6%
sqrt-unprod28.6%
add-sqr-sqrt57.7%
sub-neg57.7%
remove-double-neg57.7%
frac-2neg57.7%
metadata-eval57.7%
distribute-neg-in57.7%
add-sqr-sqrt29.1%
sqrt-unprod72.0%
sqr-neg72.0%
sqrt-unprod50.2%
add-sqr-sqrt95.7%
Applied egg-rr95.7%
Taylor expanded in t1 around inf 63.4%
Final simplification63.4%
(FPCore (u v t1) :precision binary64 (if (<= u -3.4e+91) (/ v u) (/ (- v) t1)))
double code(double u, double v, double t1) {
double tmp;
if (u <= -3.4e+91) {
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 <= (-3.4d+91)) 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 <= -3.4e+91) {
tmp = v / u;
} else {
tmp = -v / t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if u <= -3.4e+91: tmp = v / u else: tmp = -v / t1 return tmp
function code(u, v, t1) tmp = 0.0 if (u <= -3.4e+91) 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 <= -3.4e+91) tmp = v / u; else tmp = -v / t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[u, -3.4e+91], N[(v / u), $MachinePrecision], N[((-v) / t1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -3.4 \cdot 10^{+91}:\\
\;\;\;\;\frac{v}{u}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1}\\
\end{array}
\end{array}
if u < -3.4000000000000001e91Initial program 82.2%
times-frac97.6%
Simplified97.6%
clear-num95.5%
frac-times84.9%
*-un-lft-identity84.9%
frac-2neg84.9%
distribute-neg-in84.9%
add-sqr-sqrt47.9%
sqrt-unprod82.8%
sqr-neg82.8%
sqrt-unprod37.0%
add-sqr-sqrt84.9%
sub-neg84.9%
remove-double-neg84.9%
Applied egg-rr84.9%
associate-/l/95.5%
Simplified95.5%
Taylor expanded in t1 around 0 95.5%
Taylor expanded in u around 0 48.2%
if -3.4000000000000001e91 < u Initial program 77.3%
times-frac97.7%
Simplified97.7%
Taylor expanded in t1 around inf 64.9%
associate-*r/64.9%
neg-mul-164.9%
Simplified64.9%
Final simplification62.1%
(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 78.2%
times-frac97.7%
Simplified97.7%
*-commutative97.7%
clear-num97.1%
frac-2neg97.1%
frac-times84.8%
*-un-lft-identity84.8%
remove-double-neg84.8%
distribute-neg-in84.8%
add-sqr-sqrt42.4%
sqrt-unprod66.2%
sqr-neg66.2%
sqrt-unprod26.4%
add-sqr-sqrt55.4%
sub-neg55.4%
Applied egg-rr55.4%
Taylor expanded in t1 around inf 17.0%
Final simplification17.0%
herbie shell --seed 2023319
(FPCore (u v t1)
:name "Rosa's DopplerBench"
:precision binary64
(/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))