
(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 (/ (/ v (+ u t1)) (- -1.0 (/ u t1))))
double code(double u, double v, double t1) {
return (v / (u + t1)) / (-1.0 - (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)) / ((-1.0d0) - (u / t1))
end function
public static double code(double u, double v, double t1) {
return (v / (u + t1)) / (-1.0 - (u / t1));
}
def code(u, v, t1): return (v / (u + t1)) / (-1.0 - (u / t1))
function code(u, v, t1) return Float64(Float64(v / Float64(u + t1)) / Float64(-1.0 - Float64(u / t1))) end
function tmp = code(u, v, t1) tmp = (v / (u + t1)) / (-1.0 - (u / t1)); end
code[u_, v_, t1_] := N[(N[(v / N[(u + t1), $MachinePrecision]), $MachinePrecision] / N[(-1.0 - N[(u / t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{v}{u + t1}}{-1 - \frac{u}{t1}}
\end{array}
Initial program 75.2%
associate-/r*86.2%
*-commutative86.2%
associate-/l*98.1%
associate-/l/95.5%
+-commutative95.5%
remove-double-neg95.5%
unsub-neg95.5%
div-sub95.4%
sub-neg95.4%
*-inverses95.4%
metadata-eval95.4%
Simplified95.4%
Taylor expanded in v around 0 95.4%
associate-/r*99.1%
fma-neg99.1%
metadata-eval99.1%
Simplified99.1%
div-inv99.1%
frac-2neg99.1%
metadata-eval99.1%
fma-udef99.1%
metadata-eval99.1%
times-frac99.1%
*-un-lft-identity99.1%
neg-mul-199.1%
distribute-neg-in99.1%
distribute-frac-neg99.1%
frac-2neg99.1%
metadata-eval99.1%
Applied egg-rr99.1%
*-commutative99.1%
associate-*l/99.1%
neg-mul-199.1%
distribute-frac-neg99.1%
Simplified99.1%
Taylor expanded in v around 0 95.4%
associate-*r/95.4%
+-commutative95.4%
times-frac99.1%
metadata-eval99.1%
associate-/r*99.1%
neg-mul-199.1%
associate-*l/99.1%
*-lft-identity99.1%
+-commutative99.1%
neg-sub099.1%
+-commutative99.1%
associate--r+99.1%
metadata-eval99.1%
Simplified99.1%
Final simplification99.1%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -4.7e+57) (not (<= t1 8e-47))) (/ v (- (* u -2.0) t1)) (/ (/ (- t1) u) (/ u v))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -4.7e+57) || !(t1 <= 8e-47)) {
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 <= (-4.7d+57)) .or. (.not. (t1 <= 8d-47))) 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 <= -4.7e+57) || !(t1 <= 8e-47)) {
tmp = v / ((u * -2.0) - t1);
} else {
tmp = (-t1 / u) / (u / v);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -4.7e+57) or not (t1 <= 8e-47): tmp = v / ((u * -2.0) - t1) else: tmp = (-t1 / u) / (u / v) return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -4.7e+57) || !(t1 <= 8e-47)) 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 <= -4.7e+57) || ~((t1 <= 8e-47))) 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, -4.7e+57], N[Not[LessEqual[t1, 8e-47]], $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 -4.7 \cdot 10^{+57} \lor \neg \left(t1 \leq 8 \cdot 10^{-47}\right):\\
\;\;\;\;\frac{v}{u \cdot -2 - t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{-t1}{u}}{\frac{u}{v}}\\
\end{array}
\end{array}
if t1 < -4.7000000000000003e57 or 7.9999999999999998e-47 < t1 Initial program 64.6%
associate-/r*79.3%
*-commutative79.3%
associate-/l*99.9%
associate-/l/97.7%
+-commutative97.7%
remove-double-neg97.7%
unsub-neg97.7%
div-sub97.7%
sub-neg97.7%
*-inverses97.7%
metadata-eval97.7%
Simplified97.7%
Taylor expanded in t1 around inf 83.6%
mul-1-neg83.6%
unsub-neg83.6%
*-commutative83.6%
Simplified83.6%
if -4.7000000000000003e57 < t1 < 7.9999999999999998e-47Initial program 85.7%
times-frac98.3%
Simplified98.3%
*-commutative98.3%
clear-num98.3%
frac-2neg98.3%
frac-times95.0%
*-un-lft-identity95.0%
remove-double-neg95.0%
distribute-neg-in95.0%
add-sqr-sqrt50.0%
sqrt-unprod88.0%
sqr-neg88.0%
sqrt-unprod37.2%
add-sqr-sqrt78.6%
sub-neg78.6%
Applied egg-rr78.6%
*-commutative78.6%
associate-/r*80.2%
Simplified80.2%
Taylor expanded in t1 around 0 82.7%
Taylor expanded in t1 around 0 86.9%
associate-*r/86.9%
mul-1-neg86.9%
Simplified86.9%
Final simplification85.2%
(FPCore (u v t1) :precision binary64 (if (or (<= u -3.9e+54) (not (<= u 5e+143))) (* (/ v u) (/ t1 u)) (/ (- v) t1)))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -3.9e+54) || !(u <= 5e+143)) {
tmp = (v / u) * (t1 / u);
} else {
tmp = -v / t1;
}
return tmp;
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: tmp
if ((u <= (-3.9d+54)) .or. (.not. (u <= 5d+143))) then
tmp = (v / u) * (t1 / u)
else
tmp = -v / t1
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((u <= -3.9e+54) || !(u <= 5e+143)) {
tmp = (v / u) * (t1 / u);
} else {
tmp = -v / t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -3.9e+54) or not (u <= 5e+143): tmp = (v / u) * (t1 / u) else: tmp = -v / t1 return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -3.9e+54) || !(u <= 5e+143)) tmp = Float64(Float64(v / u) * Float64(t1 / u)); else tmp = Float64(Float64(-v) / t1); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((u <= -3.9e+54) || ~((u <= 5e+143))) tmp = (v / u) * (t1 / u); else tmp = -v / t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -3.9e+54], N[Not[LessEqual[u, 5e+143]], $MachinePrecision]], N[(N[(v / u), $MachinePrecision] * N[(t1 / u), $MachinePrecision]), $MachinePrecision], N[((-v) / t1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -3.9 \cdot 10^{+54} \lor \neg \left(u \leq 5 \cdot 10^{+143}\right):\\
\;\;\;\;\frac{v}{u} \cdot \frac{t1}{u}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1}\\
\end{array}
\end{array}
if u < -3.9000000000000003e54 or 5.00000000000000012e143 < u Initial program 77.1%
times-frac98.8%
Simplified98.8%
*-commutative98.8%
clear-num98.8%
frac-2neg98.8%
frac-times86.7%
*-un-lft-identity86.7%
remove-double-neg86.7%
distribute-neg-in86.7%
add-sqr-sqrt40.6%
sqrt-unprod81.5%
sqr-neg81.5%
sqrt-unprod44.0%
add-sqr-sqrt83.1%
sub-neg83.1%
Applied egg-rr83.1%
*-commutative83.1%
associate-/r*89.0%
Simplified89.0%
Taylor expanded in t1 around 0 85.3%
Taylor expanded in t1 around 0 85.0%
associate-*r/85.0%
mul-1-neg85.0%
Simplified85.0%
clear-num85.0%
associate-/r/85.0%
clear-num85.1%
add-sqr-sqrt38.9%
sqrt-unprod63.8%
sqr-neg63.8%
sqrt-unprod37.7%
add-sqr-sqrt67.6%
Applied egg-rr67.6%
if -3.9000000000000003e54 < u < 5.00000000000000012e143Initial program 74.2%
times-frac99.3%
Simplified99.3%
Taylor expanded in t1 around inf 64.8%
associate-*r/64.8%
neg-mul-164.8%
Simplified64.8%
Final simplification65.8%
(FPCore (u v t1) :precision binary64 (if (or (<= u -2.6e+198) (not (<= u 1.2e+151))) (* (/ v u) (/ t1 u)) (/ v (- (* u -2.0) t1))))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -2.6e+198) || !(u <= 1.2e+151)) {
tmp = (v / u) * (t1 / 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 <= (-2.6d+198)) .or. (.not. (u <= 1.2d+151))) then
tmp = (v / u) * (t1 / 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 <= -2.6e+198) || !(u <= 1.2e+151)) {
tmp = (v / u) * (t1 / u);
} else {
tmp = v / ((u * -2.0) - t1);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -2.6e+198) or not (u <= 1.2e+151): tmp = (v / u) * (t1 / u) else: tmp = v / ((u * -2.0) - t1) return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -2.6e+198) || !(u <= 1.2e+151)) tmp = Float64(Float64(v / u) * Float64(t1 / 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 <= -2.6e+198) || ~((u <= 1.2e+151))) tmp = (v / u) * (t1 / u); else tmp = v / ((u * -2.0) - t1); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -2.6e+198], N[Not[LessEqual[u, 1.2e+151]], $MachinePrecision]], N[(N[(v / u), $MachinePrecision] * N[(t1 / u), $MachinePrecision]), $MachinePrecision], N[(v / N[(N[(u * -2.0), $MachinePrecision] - t1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -2.6 \cdot 10^{+198} \lor \neg \left(u \leq 1.2 \cdot 10^{+151}\right):\\
\;\;\;\;\frac{v}{u} \cdot \frac{t1}{u}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{u \cdot -2 - t1}\\
\end{array}
\end{array}
if u < -2.59999999999999981e198 or 1.20000000000000005e151 < u Initial program 76.4%
times-frac99.8%
Simplified99.8%
*-commutative99.8%
clear-num99.8%
frac-2neg99.8%
frac-times87.7%
*-un-lft-identity87.7%
remove-double-neg87.7%
distribute-neg-in87.7%
add-sqr-sqrt42.9%
sqrt-unprod83.0%
sqr-neg83.0%
sqrt-unprod44.8%
add-sqr-sqrt85.4%
sub-neg85.4%
Applied egg-rr85.4%
*-commutative85.4%
associate-/r*94.4%
Simplified94.4%
Taylor expanded in t1 around 0 94.6%
Taylor expanded in t1 around 0 94.7%
associate-*r/94.7%
mul-1-neg94.7%
Simplified94.7%
clear-num94.7%
associate-/r/94.6%
clear-num94.6%
add-sqr-sqrt43.6%
sqrt-unprod67.7%
sqr-neg67.7%
sqrt-unprod41.5%
add-sqr-sqrt76.3%
Applied egg-rr76.3%
if -2.59999999999999981e198 < u < 1.20000000000000005e151Initial program 74.9%
associate-/r*84.4%
*-commutative84.4%
associate-/l*97.5%
associate-/l/97.0%
+-commutative97.0%
remove-double-neg97.0%
unsub-neg97.0%
div-sub97.0%
sub-neg97.0%
*-inverses97.0%
metadata-eval97.0%
Simplified97.0%
Taylor expanded in t1 around inf 64.2%
mul-1-neg64.2%
unsub-neg64.2%
*-commutative64.2%
Simplified64.2%
Final simplification67.1%
(FPCore (u v t1) :precision binary64 (if (<= u -6.2e+193) (/ v u) (if (<= u 1.15e+168) (/ (- v) t1) (/ 1.0 (/ u v)))))
double code(double u, double v, double t1) {
double tmp;
if (u <= -6.2e+193) {
tmp = v / u;
} else if (u <= 1.15e+168) {
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 <= (-6.2d+193)) then
tmp = v / u
else if (u <= 1.15d+168) 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 <= -6.2e+193) {
tmp = v / u;
} else if (u <= 1.15e+168) {
tmp = -v / t1;
} else {
tmp = 1.0 / (u / v);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if u <= -6.2e+193: tmp = v / u elif u <= 1.15e+168: tmp = -v / t1 else: tmp = 1.0 / (u / v) return tmp
function code(u, v, t1) tmp = 0.0 if (u <= -6.2e+193) tmp = Float64(v / u); elseif (u <= 1.15e+168) 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 <= -6.2e+193) tmp = v / u; elseif (u <= 1.15e+168) tmp = -v / t1; else tmp = 1.0 / (u / v); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[u, -6.2e+193], N[(v / u), $MachinePrecision], If[LessEqual[u, 1.15e+168], N[((-v) / t1), $MachinePrecision], N[(1.0 / N[(u / v), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -6.2 \cdot 10^{+193}:\\
\;\;\;\;\frac{v}{u}\\
\mathbf{elif}\;u \leq 1.15 \cdot 10^{+168}:\\
\;\;\;\;\frac{-v}{t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{u}{v}}\\
\end{array}
\end{array}
if u < -6.19999999999999972e193Initial program 82.6%
times-frac99.9%
Simplified99.9%
*-commutative99.9%
clear-num99.8%
frac-2neg99.8%
frac-times89.9%
*-un-lft-identity89.9%
remove-double-neg89.9%
distribute-neg-in89.9%
add-sqr-sqrt53.6%
sqrt-unprod86.4%
sqr-neg86.4%
sqrt-unprod36.3%
add-sqr-sqrt89.9%
sub-neg89.9%
Applied egg-rr89.9%
*-commutative89.9%
associate-/r*96.5%
Simplified96.5%
Taylor expanded in t1 around 0 96.6%
Taylor expanded in t1 around inf 35.5%
if -6.19999999999999972e193 < u < 1.15e168Initial program 74.0%
times-frac98.9%
Simplified98.9%
Taylor expanded in t1 around inf 60.0%
associate-*r/60.0%
neg-mul-160.0%
Simplified60.0%
if 1.15e168 < u Initial program 76.4%
times-frac99.8%
Simplified99.8%
*-commutative99.8%
clear-num99.8%
frac-2neg99.8%
frac-times83.3%
*-un-lft-identity83.3%
remove-double-neg83.3%
distribute-neg-in83.3%
add-sqr-sqrt29.1%
sqrt-unprod83.3%
sqr-neg83.3%
sqrt-unprod54.2%
add-sqr-sqrt83.3%
sub-neg83.3%
Applied egg-rr83.3%
*-commutative83.3%
associate-/r*96.4%
Simplified96.4%
Taylor expanded in t1 around 0 96.4%
Taylor expanded in t1 around inf 42.4%
Final simplification55.4%
(FPCore (u v t1) :precision binary64 (if (or (<= u -7.2e+193) (not (<= u 2.35e+167))) (/ v u) (/ (- v) t1)))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -7.2e+193) || !(u <= 2.35e+167)) {
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 <= (-7.2d+193)) .or. (.not. (u <= 2.35d+167))) 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 <= -7.2e+193) || !(u <= 2.35e+167)) {
tmp = v / u;
} else {
tmp = -v / t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -7.2e+193) or not (u <= 2.35e+167): tmp = v / u else: tmp = -v / t1 return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -7.2e+193) || !(u <= 2.35e+167)) 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 <= -7.2e+193) || ~((u <= 2.35e+167))) tmp = v / u; else tmp = -v / t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -7.2e+193], N[Not[LessEqual[u, 2.35e+167]], $MachinePrecision]], N[(v / u), $MachinePrecision], N[((-v) / t1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -7.2 \cdot 10^{+193} \lor \neg \left(u \leq 2.35 \cdot 10^{+167}\right):\\
\;\;\;\;\frac{v}{u}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1}\\
\end{array}
\end{array}
if u < -7.2e193 or 2.35000000000000006e167 < u Initial program 79.5%
times-frac99.8%
Simplified99.8%
*-commutative99.8%
clear-num99.8%
frac-2neg99.8%
frac-times86.6%
*-un-lft-identity86.6%
remove-double-neg86.6%
distribute-neg-in86.6%
add-sqr-sqrt41.4%
sqrt-unprod84.9%
sqr-neg84.9%
sqrt-unprod45.3%
add-sqr-sqrt86.6%
sub-neg86.6%
Applied egg-rr86.6%
*-commutative86.6%
associate-/r*96.5%
Simplified96.5%
Taylor expanded in t1 around 0 96.5%
Taylor expanded in t1 around inf 38.0%
if -7.2e193 < u < 2.35000000000000006e167Initial program 74.0%
times-frac98.9%
Simplified98.9%
Taylor expanded in t1 around inf 60.0%
associate-*r/60.0%
neg-mul-160.0%
Simplified60.0%
Final simplification55.2%
(FPCore (u v t1) :precision binary64 (if (<= u -8.2e+192) (/ v u) (if (<= u 7.2e+167) (/ (- v) t1) (/ (- v) u))))
double code(double u, double v, double t1) {
double tmp;
if (u <= -8.2e+192) {
tmp = v / u;
} else if (u <= 7.2e+167) {
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 <= (-8.2d+192)) then
tmp = v / u
else if (u <= 7.2d+167) 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 <= -8.2e+192) {
tmp = v / u;
} else if (u <= 7.2e+167) {
tmp = -v / t1;
} else {
tmp = -v / u;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if u <= -8.2e+192: tmp = v / u elif u <= 7.2e+167: tmp = -v / t1 else: tmp = -v / u return tmp
function code(u, v, t1) tmp = 0.0 if (u <= -8.2e+192) tmp = Float64(v / u); elseif (u <= 7.2e+167) tmp = Float64(Float64(-v) / t1); else tmp = Float64(Float64(-v) / u); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (u <= -8.2e+192) tmp = v / u; elseif (u <= 7.2e+167) tmp = -v / t1; else tmp = -v / u; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[u, -8.2e+192], N[(v / u), $MachinePrecision], If[LessEqual[u, 7.2e+167], N[((-v) / t1), $MachinePrecision], N[((-v) / u), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -8.2 \cdot 10^{+192}:\\
\;\;\;\;\frac{v}{u}\\
\mathbf{elif}\;u \leq 7.2 \cdot 10^{+167}:\\
\;\;\;\;\frac{-v}{t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{u}\\
\end{array}
\end{array}
if u < -8.20000000000000006e192Initial program 82.6%
times-frac99.9%
Simplified99.9%
*-commutative99.9%
clear-num99.8%
frac-2neg99.8%
frac-times89.9%
*-un-lft-identity89.9%
remove-double-neg89.9%
distribute-neg-in89.9%
add-sqr-sqrt53.6%
sqrt-unprod86.4%
sqr-neg86.4%
sqrt-unprod36.3%
add-sqr-sqrt89.9%
sub-neg89.9%
Applied egg-rr89.9%
*-commutative89.9%
associate-/r*96.5%
Simplified96.5%
Taylor expanded in t1 around 0 96.6%
Taylor expanded in t1 around inf 35.5%
if -8.20000000000000006e192 < u < 7.20000000000000049e167Initial program 74.0%
times-frac98.9%
Simplified98.9%
Taylor expanded in t1 around inf 60.0%
associate-*r/60.0%
neg-mul-160.0%
Simplified60.0%
if 7.20000000000000049e167 < u Initial program 76.4%
times-frac99.8%
Simplified99.8%
Taylor expanded in t1 around 0 96.5%
associate-*r/96.5%
mul-1-neg96.5%
Simplified96.5%
Taylor expanded in t1 around inf 40.9%
associate-*r/40.9%
neg-mul-140.9%
Simplified40.9%
Final simplification55.2%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -4.2e+176) (not (<= t1 2.3e+119))) (/ v t1) (/ v u)))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -4.2e+176) || !(t1 <= 2.3e+119)) {
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 <= (-4.2d+176)) .or. (.not. (t1 <= 2.3d+119))) 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 <= -4.2e+176) || !(t1 <= 2.3e+119)) {
tmp = v / t1;
} else {
tmp = v / u;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -4.2e+176) or not (t1 <= 2.3e+119): tmp = v / t1 else: tmp = v / u return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -4.2e+176) || !(t1 <= 2.3e+119)) 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 <= -4.2e+176) || ~((t1 <= 2.3e+119))) tmp = v / t1; else tmp = v / u; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -4.2e+176], N[Not[LessEqual[t1, 2.3e+119]], $MachinePrecision]], N[(v / t1), $MachinePrecision], N[(v / u), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -4.2 \cdot 10^{+176} \lor \neg \left(t1 \leq 2.3 \cdot 10^{+119}\right):\\
\;\;\;\;\frac{v}{t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{u}\\
\end{array}
\end{array}
if t1 < -4.1999999999999998e176 or 2.3000000000000001e119 < t1 Initial program 50.9%
times-frac99.9%
Simplified99.9%
*-commutative99.9%
clear-num99.5%
frac-2neg99.5%
frac-times64.2%
*-un-lft-identity64.2%
remove-double-neg64.2%
distribute-neg-in64.2%
add-sqr-sqrt24.6%
sqrt-unprod49.5%
sqr-neg49.5%
sqrt-unprod30.1%
add-sqr-sqrt50.6%
sub-neg50.6%
Applied egg-rr50.6%
Taylor expanded in t1 around inf 48.6%
if -4.1999999999999998e176 < t1 < 2.3000000000000001e119Initial program 84.8%
times-frac98.8%
Simplified98.8%
*-commutative98.8%
clear-num98.3%
frac-2neg98.3%
frac-times91.0%
*-un-lft-identity91.0%
remove-double-neg91.0%
distribute-neg-in91.0%
add-sqr-sqrt43.0%
sqrt-unprod75.4%
sqr-neg75.4%
sqrt-unprod32.9%
add-sqr-sqrt65.6%
sub-neg65.6%
Applied egg-rr65.6%
*-commutative65.6%
associate-/r*68.6%
Simplified68.6%
Taylor expanded in t1 around 0 70.5%
Taylor expanded in t1 around inf 17.8%
Final simplification26.5%
(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 75.2%
times-frac99.1%
Simplified99.1%
*-commutative99.1%
clear-num98.6%
frac-2neg98.6%
frac-times83.4%
*-un-lft-identity83.4%
remove-double-neg83.4%
distribute-neg-in83.4%
add-sqr-sqrt37.8%
sqrt-unprod68.1%
sqr-neg68.1%
sqrt-unprod32.1%
add-sqr-sqrt61.4%
sub-neg61.4%
Applied egg-rr61.4%
Taylor expanded in t1 around inf 17.2%
Final simplification17.2%
herbie shell --seed 2023335
(FPCore (u v t1)
:name "Rosa's DopplerBench"
:precision binary64
(/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))