
(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 (- (- u) t1)) (/ v (+ t1 u))))
double code(double u, double v, double t1) {
return (t1 / (-u - t1)) * (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 / (-u - t1)) * (v / (t1 + u))
end function
public static double code(double u, double v, double t1) {
return (t1 / (-u - t1)) * (v / (t1 + u));
}
def code(u, v, t1): return (t1 / (-u - t1)) * (v / (t1 + u))
function code(u, v, t1) return Float64(Float64(t1 / Float64(Float64(-u) - t1)) * Float64(v / Float64(t1 + u))) end
function tmp = code(u, v, t1) tmp = (t1 / (-u - t1)) * (v / (t1 + u)); end
code[u_, v_, t1_] := N[(N[(t1 / N[((-u) - t1), $MachinePrecision]), $MachinePrecision] * N[(v / N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{t1}{\left(-u\right) - t1} \cdot \frac{v}{t1 + u}
\end{array}
Initial program 62.4%
times-frac97.8%
distribute-frac-neg97.8%
distribute-neg-frac297.8%
+-commutative97.8%
distribute-neg-in97.8%
unsub-neg97.8%
Simplified97.8%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (- (- u) t1)))
(if (<= t1 -5.2e+111)
(/ v (- u t1))
(if (<= t1 5.4e+134) (* t1 (/ (/ v (+ t1 u)) t_1)) (/ v t_1)))))
double code(double u, double v, double t1) {
double t_1 = -u - t1;
double tmp;
if (t1 <= -5.2e+111) {
tmp = v / (u - t1);
} else if (t1 <= 5.4e+134) {
tmp = t1 * ((v / (t1 + u)) / t_1);
} else {
tmp = v / t_1;
}
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) :: tmp
t_1 = -u - t1
if (t1 <= (-5.2d+111)) then
tmp = v / (u - t1)
else if (t1 <= 5.4d+134) then
tmp = t1 * ((v / (t1 + u)) / t_1)
else
tmp = v / t_1
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double t_1 = -u - t1;
double tmp;
if (t1 <= -5.2e+111) {
tmp = v / (u - t1);
} else if (t1 <= 5.4e+134) {
tmp = t1 * ((v / (t1 + u)) / t_1);
} else {
tmp = v / t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = -u - t1 tmp = 0 if t1 <= -5.2e+111: tmp = v / (u - t1) elif t1 <= 5.4e+134: tmp = t1 * ((v / (t1 + u)) / t_1) else: tmp = v / t_1 return tmp
function code(u, v, t1) t_1 = Float64(Float64(-u) - t1) tmp = 0.0 if (t1 <= -5.2e+111) tmp = Float64(v / Float64(u - t1)); elseif (t1 <= 5.4e+134) tmp = Float64(t1 * Float64(Float64(v / Float64(t1 + u)) / t_1)); else tmp = Float64(v / t_1); end return tmp end
function tmp_2 = code(u, v, t1) t_1 = -u - t1; tmp = 0.0; if (t1 <= -5.2e+111) tmp = v / (u - t1); elseif (t1 <= 5.4e+134) tmp = t1 * ((v / (t1 + u)) / t_1); else tmp = v / t_1; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[((-u) - t1), $MachinePrecision]}, If[LessEqual[t1, -5.2e+111], N[(v / N[(u - t1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, 5.4e+134], N[(t1 * N[(N[(v / N[(t1 + u), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], N[(v / t$95$1), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-u\right) - t1\\
\mathbf{if}\;t1 \leq -5.2 \cdot 10^{+111}:\\
\;\;\;\;\frac{v}{u - t1}\\
\mathbf{elif}\;t1 \leq 5.4 \cdot 10^{+134}:\\
\;\;\;\;t1 \cdot \frac{\frac{v}{t1 + u}}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{t\_1}\\
\end{array}
\end{array}
if t1 < -5.1999999999999997e111Initial program 38.6%
associate-*l/40.2%
*-commutative40.2%
Simplified40.2%
associate-*r/38.6%
*-commutative38.6%
times-frac99.9%
frac-2neg99.9%
+-commutative99.9%
distribute-neg-in99.9%
sub-neg99.9%
associate-*r/99.9%
add-sqr-sqrt99.4%
sqrt-unprod19.0%
sqr-neg19.0%
sqrt-unprod0.0%
add-sqr-sqrt25.5%
sub-neg25.5%
+-commutative25.5%
add-sqr-sqrt25.5%
sqrt-unprod26.4%
sqr-neg26.4%
sqrt-unprod0.0%
add-sqr-sqrt0.0%
sqrt-unprod0.0%
sqr-neg0.0%
Applied egg-rr99.9%
Taylor expanded in t1 around inf 80.9%
mul-1-neg80.9%
Simplified80.9%
add-sqr-sqrt43.4%
sqrt-unprod72.9%
sqr-neg72.9%
sqrt-unprod37.3%
add-sqr-sqrt81.4%
sub-neg81.4%
Applied egg-rr81.4%
if -5.1999999999999997e111 < t1 < 5.4e134Initial program 77.8%
associate-/l*81.7%
Simplified81.7%
associate-/r*89.5%
div-inv89.4%
Applied egg-rr89.4%
associate-*r/89.5%
*-rgt-identity89.5%
Simplified89.5%
if 5.4e134 < t1 Initial program 27.5%
associate-*l/29.4%
*-commutative29.4%
Simplified29.4%
associate-*r/27.5%
*-commutative27.5%
times-frac100.0%
frac-2neg100.0%
+-commutative100.0%
distribute-neg-in100.0%
sub-neg100.0%
associate-*r/100.0%
add-sqr-sqrt0.0%
sqrt-unprod3.3%
sqr-neg3.3%
sqrt-unprod20.7%
add-sqr-sqrt20.7%
sub-neg20.7%
+-commutative20.7%
add-sqr-sqrt0.0%
sqrt-unprod29.4%
sqr-neg29.4%
sqrt-unprod95.5%
add-sqr-sqrt44.9%
sqrt-unprod88.1%
sqr-neg88.1%
Applied egg-rr100.0%
Taylor expanded in t1 around inf 96.4%
mul-1-neg96.4%
Simplified96.4%
Final simplification89.7%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (- (- u) t1)))
(if (<= t1 -1.12e+108)
(/ v (- u t1))
(if (<= t1 8.2e+134) (* v (/ t1 (* (+ t1 u) t_1))) (/ v t_1)))))
double code(double u, double v, double t1) {
double t_1 = -u - t1;
double tmp;
if (t1 <= -1.12e+108) {
tmp = v / (u - t1);
} else if (t1 <= 8.2e+134) {
tmp = v * (t1 / ((t1 + u) * t_1));
} else {
tmp = v / t_1;
}
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) :: tmp
t_1 = -u - t1
if (t1 <= (-1.12d+108)) then
tmp = v / (u - t1)
else if (t1 <= 8.2d+134) then
tmp = v * (t1 / ((t1 + u) * t_1))
else
tmp = v / t_1
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double t_1 = -u - t1;
double tmp;
if (t1 <= -1.12e+108) {
tmp = v / (u - t1);
} else if (t1 <= 8.2e+134) {
tmp = v * (t1 / ((t1 + u) * t_1));
} else {
tmp = v / t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = -u - t1 tmp = 0 if t1 <= -1.12e+108: tmp = v / (u - t1) elif t1 <= 8.2e+134: tmp = v * (t1 / ((t1 + u) * t_1)) else: tmp = v / t_1 return tmp
function code(u, v, t1) t_1 = Float64(Float64(-u) - t1) tmp = 0.0 if (t1 <= -1.12e+108) tmp = Float64(v / Float64(u - t1)); elseif (t1 <= 8.2e+134) tmp = Float64(v * Float64(t1 / Float64(Float64(t1 + u) * t_1))); else tmp = Float64(v / t_1); end return tmp end
function tmp_2 = code(u, v, t1) t_1 = -u - t1; tmp = 0.0; if (t1 <= -1.12e+108) tmp = v / (u - t1); elseif (t1 <= 8.2e+134) tmp = v * (t1 / ((t1 + u) * t_1)); else tmp = v / t_1; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[((-u) - t1), $MachinePrecision]}, If[LessEqual[t1, -1.12e+108], N[(v / N[(u - t1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, 8.2e+134], N[(v * N[(t1 / N[(N[(t1 + u), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(v / t$95$1), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(-u\right) - t1\\
\mathbf{if}\;t1 \leq -1.12 \cdot 10^{+108}:\\
\;\;\;\;\frac{v}{u - t1}\\
\mathbf{elif}\;t1 \leq 8.2 \cdot 10^{+134}:\\
\;\;\;\;v \cdot \frac{t1}{\left(t1 + u\right) \cdot t\_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{t\_1}\\
\end{array}
\end{array}
if t1 < -1.11999999999999994e108Initial program 38.4%
associate-*l/42.3%
*-commutative42.3%
Simplified42.3%
associate-*r/38.4%
*-commutative38.4%
times-frac99.9%
frac-2neg99.9%
+-commutative99.9%
distribute-neg-in99.9%
sub-neg99.9%
associate-*r/99.9%
add-sqr-sqrt99.4%
sqrt-unprod25.3%
sqr-neg25.3%
sqrt-unprod0.0%
add-sqr-sqrt23.6%
sub-neg23.6%
+-commutative23.6%
add-sqr-sqrt23.6%
sqrt-unprod24.5%
sqr-neg24.5%
sqrt-unprod0.0%
add-sqr-sqrt0.0%
sqrt-unprod0.0%
sqr-neg0.0%
Applied egg-rr99.9%
Taylor expanded in t1 around inf 79.9%
mul-1-neg79.9%
Simplified79.9%
add-sqr-sqrt40.0%
sqrt-unprod72.5%
sqr-neg72.5%
sqrt-unprod39.6%
add-sqr-sqrt80.4%
sub-neg80.4%
Applied egg-rr80.4%
if -1.11999999999999994e108 < t1 < 8.2000000000000007e134Initial program 78.5%
associate-*l/85.7%
*-commutative85.7%
Simplified85.7%
if 8.2000000000000007e134 < t1 Initial program 27.5%
associate-*l/29.4%
*-commutative29.4%
Simplified29.4%
associate-*r/27.5%
*-commutative27.5%
times-frac100.0%
frac-2neg100.0%
+-commutative100.0%
distribute-neg-in100.0%
sub-neg100.0%
associate-*r/100.0%
add-sqr-sqrt0.0%
sqrt-unprod3.3%
sqr-neg3.3%
sqrt-unprod20.7%
add-sqr-sqrt20.7%
sub-neg20.7%
+-commutative20.7%
add-sqr-sqrt0.0%
sqrt-unprod29.4%
sqr-neg29.4%
sqrt-unprod95.5%
add-sqr-sqrt44.9%
sqrt-unprod88.1%
sqr-neg88.1%
Applied egg-rr100.0%
Taylor expanded in t1 around inf 96.4%
mul-1-neg96.4%
Simplified96.4%
Final simplification87.0%
(FPCore (u v t1) :precision binary64 (if (or (<= u -1.25e-6) (not (<= u 3.6e-6))) (/ (* t1 (/ v u)) (- u)) (/ (/ (- v) (/ (+ t1 u) t1)) t1)))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -1.25e-6) || !(u <= 3.6e-6)) {
tmp = (t1 * (v / u)) / -u;
} else {
tmp = (-v / ((t1 + u) / t1)) / 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.25d-6)) .or. (.not. (u <= 3.6d-6))) then
tmp = (t1 * (v / u)) / -u
else
tmp = (-v / ((t1 + u) / t1)) / t1
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((u <= -1.25e-6) || !(u <= 3.6e-6)) {
tmp = (t1 * (v / u)) / -u;
} else {
tmp = (-v / ((t1 + u) / t1)) / t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -1.25e-6) or not (u <= 3.6e-6): tmp = (t1 * (v / u)) / -u else: tmp = (-v / ((t1 + u) / t1)) / t1 return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -1.25e-6) || !(u <= 3.6e-6)) tmp = Float64(Float64(t1 * Float64(v / u)) / Float64(-u)); else tmp = Float64(Float64(Float64(-v) / Float64(Float64(t1 + u) / t1)) / t1); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((u <= -1.25e-6) || ~((u <= 3.6e-6))) tmp = (t1 * (v / u)) / -u; else tmp = (-v / ((t1 + u) / t1)) / t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -1.25e-6], N[Not[LessEqual[u, 3.6e-6]], $MachinePrecision]], N[(N[(t1 * N[(v / u), $MachinePrecision]), $MachinePrecision] / (-u)), $MachinePrecision], N[(N[((-v) / N[(N[(t1 + u), $MachinePrecision] / t1), $MachinePrecision]), $MachinePrecision] / t1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -1.25 \cdot 10^{-6} \lor \neg \left(u \leq 3.6 \cdot 10^{-6}\right):\\
\;\;\;\;\frac{t1 \cdot \frac{v}{u}}{-u}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{-v}{\frac{t1 + u}{t1}}}{t1}\\
\end{array}
\end{array}
if u < -1.2500000000000001e-6 or 3.59999999999999984e-6 < u Initial program 71.5%
associate-*l/68.0%
*-commutative68.0%
Simplified68.0%
associate-*r/71.5%
*-commutative71.5%
times-frac97.7%
frac-2neg97.7%
+-commutative97.7%
distribute-neg-in97.7%
sub-neg97.7%
associate-*r/97.6%
add-sqr-sqrt44.4%
sqrt-unprod59.1%
sqr-neg59.1%
sqrt-unprod27.2%
add-sqr-sqrt48.2%
sub-neg48.2%
+-commutative48.2%
add-sqr-sqrt21.0%
sqrt-unprod49.5%
sqr-neg49.5%
sqrt-unprod37.0%
add-sqr-sqrt19.0%
sqrt-unprod40.5%
sqr-neg40.5%
Applied egg-rr97.6%
Taylor expanded in t1 around 0 79.3%
Taylor expanded in t1 around 0 78.6%
Taylor expanded in t1 around 0 76.5%
mul-1-neg76.5%
associate-*r/81.6%
distribute-rgt-neg-out81.6%
distribute-neg-frac281.6%
Simplified81.6%
if -1.2500000000000001e-6 < u < 3.59999999999999984e-6Initial program 54.5%
associate-*l/68.1%
*-commutative68.1%
Simplified68.1%
associate-*r/54.5%
*-commutative54.5%
times-frac97.9%
frac-2neg97.9%
+-commutative97.9%
distribute-neg-in97.9%
sub-neg97.9%
associate-*r/97.6%
add-sqr-sqrt43.1%
sqrt-unprod26.9%
sqr-neg26.9%
sqrt-unprod7.9%
add-sqr-sqrt13.2%
sub-neg13.2%
+-commutative13.2%
add-sqr-sqrt5.4%
sqrt-unprod29.0%
sqr-neg29.0%
sqrt-unprod42.6%
add-sqr-sqrt23.7%
sqrt-unprod48.0%
sqr-neg48.0%
Applied egg-rr97.6%
Taylor expanded in v around 0 67.7%
neg-mul-167.7%
associate-*r/95.6%
*-commutative95.6%
associate-/r/97.6%
distribute-neg-frac297.6%
Simplified97.6%
Taylor expanded in t1 around inf 80.2%
Final simplification80.8%
(FPCore (u v t1) :precision binary64 (if (or (<= u -1.7e-6) (not (<= u 5e-8))) (/ (* t1 (/ v (- u))) u) (/ v (- t1))))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -1.7e-6) || !(u <= 5e-8)) {
tmp = (t1 * (v / -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 <= (-1.7d-6)) .or. (.not. (u <= 5d-8))) then
tmp = (t1 * (v / -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 <= -1.7e-6) || !(u <= 5e-8)) {
tmp = (t1 * (v / -u)) / u;
} else {
tmp = v / -t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -1.7e-6) or not (u <= 5e-8): tmp = (t1 * (v / -u)) / u else: tmp = v / -t1 return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -1.7e-6) || !(u <= 5e-8)) tmp = Float64(Float64(t1 * Float64(v / Float64(-u))) / u); else tmp = Float64(v / Float64(-t1)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((u <= -1.7e-6) || ~((u <= 5e-8))) tmp = (t1 * (v / -u)) / u; else tmp = v / -t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -1.7e-6], N[Not[LessEqual[u, 5e-8]], $MachinePrecision]], N[(N[(t1 * N[(v / (-u)), $MachinePrecision]), $MachinePrecision] / u), $MachinePrecision], N[(v / (-t1)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -1.7 \cdot 10^{-6} \lor \neg \left(u \leq 5 \cdot 10^{-8}\right):\\
\;\;\;\;\frac{t1 \cdot \frac{v}{-u}}{u}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{-t1}\\
\end{array}
\end{array}
if u < -1.70000000000000003e-6 or 4.9999999999999998e-8 < u Initial program 71.5%
associate-*l/68.0%
*-commutative68.0%
Simplified68.0%
associate-*r/71.5%
*-commutative71.5%
times-frac97.7%
frac-2neg97.7%
+-commutative97.7%
distribute-neg-in97.7%
sub-neg97.7%
associate-*r/97.6%
add-sqr-sqrt44.4%
sqrt-unprod59.1%
sqr-neg59.1%
sqrt-unprod27.2%
add-sqr-sqrt48.2%
sub-neg48.2%
+-commutative48.2%
add-sqr-sqrt21.0%
sqrt-unprod49.5%
sqr-neg49.5%
sqrt-unprod37.0%
add-sqr-sqrt19.0%
sqrt-unprod40.5%
sqr-neg40.5%
Applied egg-rr97.6%
Taylor expanded in t1 around 0 79.3%
Taylor expanded in t1 around 0 78.6%
Taylor expanded in t1 around 0 76.5%
mul-1-neg76.5%
associate-*r/81.6%
distribute-rgt-neg-out81.6%
distribute-neg-frac281.6%
Simplified81.6%
if -1.70000000000000003e-6 < u < 4.9999999999999998e-8Initial program 54.5%
associate-*l/68.1%
*-commutative68.1%
Simplified68.1%
Taylor expanded in t1 around inf 79.6%
associate-*r/79.6%
neg-mul-179.6%
Simplified79.6%
Final simplification80.5%
(FPCore (u v t1) :precision binary64 (if (or (<= u -3.4e-7) (not (<= u 5.8e-6))) (* (/ t1 (- u)) (/ v u)) (/ v (- t1))))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -3.4e-7) || !(u <= 5.8e-6)) {
tmp = (t1 / -u) * (v / u);
} else {
tmp = v / -t1;
}
return tmp;
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: tmp
if ((u <= (-3.4d-7)) .or. (.not. (u <= 5.8d-6))) then
tmp = (t1 / -u) * (v / u)
else
tmp = v / -t1
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((u <= -3.4e-7) || !(u <= 5.8e-6)) {
tmp = (t1 / -u) * (v / u);
} else {
tmp = v / -t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -3.4e-7) or not (u <= 5.8e-6): tmp = (t1 / -u) * (v / u) else: tmp = v / -t1 return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -3.4e-7) || !(u <= 5.8e-6)) tmp = Float64(Float64(t1 / Float64(-u)) * 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 <= -3.4e-7) || ~((u <= 5.8e-6))) tmp = (t1 / -u) * (v / u); else tmp = v / -t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -3.4e-7], N[Not[LessEqual[u, 5.8e-6]], $MachinePrecision]], N[(N[(t1 / (-u)), $MachinePrecision] * N[(v / u), $MachinePrecision]), $MachinePrecision], N[(v / (-t1)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -3.4 \cdot 10^{-7} \lor \neg \left(u \leq 5.8 \cdot 10^{-6}\right):\\
\;\;\;\;\frac{t1}{-u} \cdot \frac{v}{u}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{-t1}\\
\end{array}
\end{array}
if u < -3.39999999999999974e-7 or 5.8000000000000004e-6 < u Initial program 71.5%
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 0 79.4%
Taylor expanded in t1 around 0 79.5%
associate-*r/79.5%
mul-1-neg79.5%
Simplified79.5%
if -3.39999999999999974e-7 < u < 5.8000000000000004e-6Initial program 54.5%
associate-*l/68.1%
*-commutative68.1%
Simplified68.1%
Taylor expanded in t1 around inf 79.6%
associate-*r/79.6%
neg-mul-179.6%
Simplified79.6%
Final simplification79.6%
(FPCore (u v t1) :precision binary64 (if (or (<= u -3e+166) (not (<= u 4.8e+183))) (* v (/ (/ t1 u) u)) (/ v (- (- u) t1))))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -3e+166) || !(u <= 4.8e+183)) {
tmp = v * ((t1 / u) / u);
} else {
tmp = v / (-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 ((u <= (-3d+166)) .or. (.not. (u <= 4.8d+183))) then
tmp = v * ((t1 / u) / u)
else
tmp = v / (-u - t1)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((u <= -3e+166) || !(u <= 4.8e+183)) {
tmp = v * ((t1 / u) / u);
} else {
tmp = v / (-u - t1);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -3e+166) or not (u <= 4.8e+183): tmp = v * ((t1 / u) / u) else: tmp = v / (-u - t1) return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -3e+166) || !(u <= 4.8e+183)) tmp = Float64(v * Float64(Float64(t1 / u) / u)); else tmp = Float64(v / Float64(Float64(-u) - t1)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((u <= -3e+166) || ~((u <= 4.8e+183))) tmp = v * ((t1 / u) / u); else tmp = v / (-u - t1); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -3e+166], N[Not[LessEqual[u, 4.8e+183]], $MachinePrecision]], N[(v * N[(N[(t1 / u), $MachinePrecision] / u), $MachinePrecision]), $MachinePrecision], N[(v / N[((-u) - t1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -3 \cdot 10^{+166} \lor \neg \left(u \leq 4.8 \cdot 10^{+183}\right):\\
\;\;\;\;v \cdot \frac{\frac{t1}{u}}{u}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{\left(-u\right) - t1}\\
\end{array}
\end{array}
if u < -2.99999999999999998e166 or 4.8000000000000003e183 < u Initial program 70.7%
associate-*l/71.5%
*-commutative71.5%
Simplified71.5%
associate-*r/70.7%
*-commutative70.7%
times-frac99.9%
frac-2neg99.9%
+-commutative99.9%
distribute-neg-in99.9%
sub-neg99.9%
associate-*r/99.9%
add-sqr-sqrt47.9%
sqrt-unprod70.6%
sqr-neg70.6%
sqrt-unprod40.3%
add-sqr-sqrt71.0%
sub-neg71.0%
+-commutative71.0%
add-sqr-sqrt30.7%
sqrt-unprod71.4%
sqr-neg71.4%
sqrt-unprod44.2%
add-sqr-sqrt30.1%
sqrt-unprod40.5%
sqr-neg40.5%
Applied egg-rr99.9%
Taylor expanded in t1 around 0 92.0%
Taylor expanded in t1 around 0 92.0%
*-commutative92.0%
associate-/l*77.1%
add-sqr-sqrt40.5%
sqrt-unprod66.4%
sqr-neg66.4%
sqrt-unprod32.6%
add-sqr-sqrt71.2%
Applied egg-rr71.2%
if -2.99999999999999998e166 < u < 4.8000000000000003e183Initial program 60.4%
associate-*l/67.2%
*-commutative67.2%
Simplified67.2%
associate-*r/60.4%
*-commutative60.4%
times-frac97.3%
frac-2neg97.3%
+-commutative97.3%
distribute-neg-in97.3%
sub-neg97.3%
associate-*r/97.0%
add-sqr-sqrt42.7%
sqrt-unprod34.9%
sqr-neg34.9%
sqrt-unprod11.1%
add-sqr-sqrt19.4%
sub-neg19.4%
+-commutative19.4%
add-sqr-sqrt8.2%
sqrt-unprod30.6%
sqr-neg30.6%
sqrt-unprod39.0%
add-sqr-sqrt19.5%
sqrt-unprod45.5%
sqr-neg45.5%
Applied egg-rr97.0%
Taylor expanded in t1 around inf 65.3%
mul-1-neg65.3%
Simplified65.3%
Final simplification66.5%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -5e+101) (not (<= t1 1.8e+88))) (/ v t1) (/ v u)))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -5e+101) || !(t1 <= 1.8e+88)) {
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 <= (-5d+101)) .or. (.not. (t1 <= 1.8d+88))) 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 <= -5e+101) || !(t1 <= 1.8e+88)) {
tmp = v / t1;
} else {
tmp = v / u;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -5e+101) or not (t1 <= 1.8e+88): tmp = v / t1 else: tmp = v / u return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -5e+101) || !(t1 <= 1.8e+88)) 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 <= -5e+101) || ~((t1 <= 1.8e+88))) tmp = v / t1; else tmp = v / u; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -5e+101], N[Not[LessEqual[t1, 1.8e+88]], $MachinePrecision]], N[(v / t1), $MachinePrecision], N[(v / u), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -5 \cdot 10^{+101} \lor \neg \left(t1 \leq 1.8 \cdot 10^{+88}\right):\\
\;\;\;\;\frac{v}{t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{u}\\
\end{array}
\end{array}
if t1 < -4.99999999999999989e101 or 1.8000000000000001e88 < t1 Initial program 36.1%
associate-*l/39.5%
*-commutative39.5%
Simplified39.5%
Taylor expanded in t1 around inf 85.7%
associate-*r/85.7%
neg-mul-185.7%
Simplified85.7%
add-sqr-sqrt56.6%
sqrt-unprod50.5%
sqr-neg50.5%
sqrt-unprod8.1%
add-sqr-sqrt22.0%
div-inv22.0%
Applied egg-rr22.0%
associate-*r/22.0%
*-rgt-identity22.0%
Simplified22.0%
if -4.99999999999999989e101 < t1 < 1.8000000000000001e88Initial program 79.0%
times-frac96.4%
distribute-frac-neg96.4%
distribute-neg-frac296.4%
+-commutative96.4%
distribute-neg-in96.4%
unsub-neg96.4%
Simplified96.4%
Taylor expanded in t1 around 0 67.6%
Taylor expanded in t1 around inf 18.7%
associate-*r/18.7%
mul-1-neg18.7%
Simplified18.7%
add-sqr-sqrt10.9%
sqrt-unprod19.1%
sqr-neg19.1%
sqrt-unprod6.6%
add-sqr-sqrt16.2%
div-inv16.2%
Applied egg-rr16.2%
associate-*r/16.2%
*-rgt-identity16.2%
Simplified16.2%
Final simplification18.5%
(FPCore (u v t1) :precision binary64 (if (<= u -2e+166) (/ 1.0 (/ u v)) (/ v (- t1))))
double code(double u, double v, double t1) {
double tmp;
if (u <= -2e+166) {
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 <= (-2d+166)) 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 <= -2e+166) {
tmp = 1.0 / (u / v);
} else {
tmp = v / -t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if u <= -2e+166: tmp = 1.0 / (u / v) else: tmp = v / -t1 return tmp
function code(u, v, t1) tmp = 0.0 if (u <= -2e+166) tmp = Float64(1.0 / Float64(u / v)); else tmp = Float64(v / Float64(-t1)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (u <= -2e+166) tmp = 1.0 / (u / v); else tmp = v / -t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[u, -2e+166], N[(1.0 / N[(u / v), $MachinePrecision]), $MachinePrecision], N[(v / (-t1)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -2 \cdot 10^{+166}:\\
\;\;\;\;\frac{1}{\frac{u}{v}}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{-t1}\\
\end{array}
\end{array}
if u < -1.99999999999999988e166Initial program 78.2%
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 0 92.8%
Taylor expanded in t1 around inf 38.1%
associate-*r/38.1%
mul-1-neg38.1%
Simplified38.1%
clear-num40.2%
inv-pow40.2%
add-sqr-sqrt23.5%
sqrt-unprod39.5%
sqr-neg39.5%
sqrt-unprod16.4%
add-sqr-sqrt39.8%
Applied egg-rr39.8%
unpow-139.8%
Simplified39.8%
if -1.99999999999999988e166 < u Initial program 60.5%
associate-*l/66.8%
*-commutative66.8%
Simplified66.8%
Taylor expanded in t1 around inf 59.5%
associate-*r/59.5%
neg-mul-159.5%
Simplified59.5%
Final simplification57.4%
(FPCore (u v t1) :precision binary64 (if (<= u -2.3e+165) (/ v (- u)) (/ v (- t1))))
double code(double u, double v, double t1) {
double tmp;
if (u <= -2.3e+165) {
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 <= (-2.3d+165)) 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 <= -2.3e+165) {
tmp = v / -u;
} else {
tmp = v / -t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if u <= -2.3e+165: tmp = v / -u else: tmp = v / -t1 return tmp
function code(u, v, t1) tmp = 0.0 if (u <= -2.3e+165) tmp = Float64(v / Float64(-u)); else tmp = Float64(v / Float64(-t1)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (u <= -2.3e+165) tmp = v / -u; else tmp = v / -t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[u, -2.3e+165], N[(v / (-u)), $MachinePrecision], N[(v / (-t1)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -2.3 \cdot 10^{+165}:\\
\;\;\;\;\frac{v}{-u}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{-t1}\\
\end{array}
\end{array}
if u < -2.30000000000000016e165Initial program 78.2%
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 0 92.8%
Taylor expanded in t1 around inf 38.1%
associate-*r/38.1%
mul-1-neg38.1%
Simplified38.1%
if -2.30000000000000016e165 < u Initial program 60.5%
associate-*l/66.8%
*-commutative66.8%
Simplified66.8%
Taylor expanded in t1 around inf 59.5%
associate-*r/59.5%
neg-mul-159.5%
Simplified59.5%
Final simplification57.2%
(FPCore (u v t1) :precision binary64 (if (<= u -1.85e+165) (/ v u) (/ v (- t1))))
double code(double u, double v, double t1) {
double tmp;
if (u <= -1.85e+165) {
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.85d+165)) 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.85e+165) {
tmp = v / u;
} else {
tmp = v / -t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if u <= -1.85e+165: tmp = v / u else: tmp = v / -t1 return tmp
function code(u, v, t1) tmp = 0.0 if (u <= -1.85e+165) 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.85e+165) tmp = v / u; else tmp = v / -t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[u, -1.85e+165], N[(v / u), $MachinePrecision], N[(v / (-t1)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -1.85 \cdot 10^{+165}:\\
\;\;\;\;\frac{v}{u}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{-t1}\\
\end{array}
\end{array}
if u < -1.85000000000000003e165Initial program 78.2%
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 0 92.8%
Taylor expanded in t1 around inf 38.1%
associate-*r/38.1%
mul-1-neg38.1%
Simplified38.1%
add-sqr-sqrt23.5%
sqrt-unprod37.4%
sqr-neg37.4%
sqrt-unprod14.3%
add-sqr-sqrt37.8%
div-inv37.8%
Applied egg-rr37.8%
associate-*r/37.8%
*-rgt-identity37.8%
Simplified37.8%
if -1.85000000000000003e165 < u Initial program 60.5%
associate-*l/66.8%
*-commutative66.8%
Simplified66.8%
Taylor expanded in t1 around inf 59.5%
associate-*r/59.5%
neg-mul-159.5%
Simplified59.5%
Final simplification57.2%
(FPCore (u v t1) :precision binary64 (/ v (- (- u) t1)))
double code(double u, double v, double t1) {
return v / (-u - 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 - t1)
end function
public static double code(double u, double v, double t1) {
return v / (-u - t1);
}
def code(u, v, t1): return v / (-u - t1)
function code(u, v, t1) return Float64(v / Float64(Float64(-u) - t1)) end
function tmp = code(u, v, t1) tmp = v / (-u - t1); end
code[u_, v_, t1_] := N[(v / N[((-u) - t1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{v}{\left(-u\right) - t1}
\end{array}
Initial program 62.4%
associate-*l/68.0%
*-commutative68.0%
Simplified68.0%
associate-*r/62.4%
*-commutative62.4%
times-frac97.8%
frac-2neg97.8%
+-commutative97.8%
distribute-neg-in97.8%
sub-neg97.8%
associate-*r/97.6%
add-sqr-sqrt43.7%
sqrt-unprod41.9%
sqr-neg41.9%
sqrt-unprod16.8%
add-sqr-sqrt29.5%
sub-neg29.5%
+-commutative29.5%
add-sqr-sqrt12.6%
sqrt-unprod38.6%
sqr-neg38.6%
sqrt-unprod40.0%
add-sqr-sqrt21.5%
sqrt-unprod44.5%
sqr-neg44.5%
Applied egg-rr97.6%
Taylor expanded in t1 around inf 60.8%
mul-1-neg60.8%
Simplified60.8%
Final simplification60.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(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 62.4%
associate-*l/68.0%
*-commutative68.0%
Simplified68.0%
Taylor expanded in t1 around inf 54.8%
associate-*r/54.8%
neg-mul-154.8%
Simplified54.8%
add-sqr-sqrt35.9%
sqrt-unprod34.3%
sqr-neg34.3%
sqrt-unprod3.8%
add-sqr-sqrt10.7%
div-inv10.7%
Applied egg-rr10.7%
associate-*r/10.7%
*-rgt-identity10.7%
Simplified10.7%
herbie shell --seed 2024163
(FPCore (u v t1)
:name "Rosa's DopplerBench"
:precision binary64
(/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))