
(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 12 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 70.9%
times-frac97.3%
Simplified97.3%
Final simplification97.3%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -2.8e-21) (not (<= t1 9.8e+56))) (/ v (- (* u -2.0) t1)) (* (/ v u) (/ (- t1) u))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -2.8e-21) || !(t1 <= 9.8e+56)) {
tmp = v / ((u * -2.0) - t1);
} else {
tmp = (v / u) * (-t1 / u);
}
return tmp;
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: tmp
if ((t1 <= (-2.8d-21)) .or. (.not. (t1 <= 9.8d+56))) then
tmp = v / ((u * (-2.0d0)) - t1)
else
tmp = (v / u) * (-t1 / u)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -2.8e-21) || !(t1 <= 9.8e+56)) {
tmp = v / ((u * -2.0) - t1);
} else {
tmp = (v / u) * (-t1 / u);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -2.8e-21) or not (t1 <= 9.8e+56): tmp = v / ((u * -2.0) - t1) else: tmp = (v / u) * (-t1 / u) return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -2.8e-21) || !(t1 <= 9.8e+56)) tmp = Float64(v / Float64(Float64(u * -2.0) - t1)); else tmp = Float64(Float64(v / u) * Float64(Float64(-t1) / u)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -2.8e-21) || ~((t1 <= 9.8e+56))) tmp = v / ((u * -2.0) - t1); else tmp = (v / u) * (-t1 / u); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -2.8e-21], N[Not[LessEqual[t1, 9.8e+56]], $MachinePrecision]], N[(v / N[(N[(u * -2.0), $MachinePrecision] - t1), $MachinePrecision]), $MachinePrecision], N[(N[(v / u), $MachinePrecision] * N[((-t1) / u), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -2.8 \cdot 10^{-21} \lor \neg \left(t1 \leq 9.8 \cdot 10^{+56}\right):\\
\;\;\;\;\frac{v}{u \cdot -2 - t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{u} \cdot \frac{-t1}{u}\\
\end{array}
\end{array}
if t1 < -2.80000000000000004e-21 or 9.8000000000000005e56 < t1 Initial program 58.2%
*-commutative58.2%
times-frac99.9%
neg-mul-199.9%
associate-/l*99.9%
associate-*r/99.9%
associate-/l*99.9%
associate-/l/99.9%
neg-mul-199.9%
*-lft-identity99.9%
metadata-eval99.9%
times-frac99.9%
neg-mul-199.9%
remove-double-neg99.9%
neg-mul-199.9%
sub0-neg99.9%
associate--r+99.9%
neg-sub099.9%
div-sub99.9%
distribute-frac-neg99.9%
*-inverses99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in v around 0 98.3%
associate-*r/98.3%
neg-mul-198.3%
+-commutative98.3%
Simplified98.3%
frac-2neg98.3%
div-inv98.0%
add-sqr-sqrt60.3%
sqrt-unprod58.1%
sqr-neg58.1%
sqrt-unprod12.0%
add-sqr-sqrt32.5%
add-sqr-sqrt20.6%
sqrt-unprod48.2%
sqr-neg48.2%
sqrt-unprod37.5%
add-sqr-sqrt98.0%
Applied egg-rr98.0%
associate-*r/98.3%
*-rgt-identity98.3%
distribute-rgt-neg-in98.3%
+-commutative98.3%
distribute-neg-in98.3%
metadata-eval98.3%
sub-neg98.3%
Simplified98.3%
Taylor expanded in t1 around inf 86.3%
+-commutative86.3%
mul-1-neg86.3%
unsub-neg86.3%
*-commutative86.3%
Simplified86.3%
if -2.80000000000000004e-21 < t1 < 9.8000000000000005e56Initial program 81.1%
Taylor expanded in t1 around 0 72.2%
unpow272.2%
Simplified72.2%
expm1-log1p-u63.0%
expm1-udef50.8%
div-inv50.4%
associate-*l*49.3%
add-sqr-sqrt23.0%
sqrt-unprod45.3%
sqr-neg45.3%
sqrt-unprod22.4%
add-sqr-sqrt44.6%
pow244.6%
pow-flip44.6%
metadata-eval44.6%
Applied egg-rr44.6%
expm1-def44.3%
expm1-log1p44.3%
associate-*r*44.4%
*-commutative44.4%
metadata-eval44.4%
pow-sqr44.4%
unpow-144.4%
unpow-144.4%
associate-*r*44.6%
associate-*r/44.6%
associate-*l/44.6%
*-rgt-identity44.6%
associate-*r/44.6%
*-rgt-identity44.6%
associate-*r/44.4%
associate-*r/44.5%
associate-/r*44.4%
Simplified44.4%
add-sqr-sqrt18.6%
sqrt-unprod50.4%
sqr-neg50.4%
sqrt-unprod40.7%
add-sqr-sqrt72.8%
distribute-lft-neg-out72.8%
associate-*r/72.2%
times-frac80.0%
Applied egg-rr80.0%
Final simplification82.8%
(FPCore (u v t1) :precision binary64 (if (or (<= u -1.5e-14) (not (<= u 1.2e+116))) (* v (/ t1 (* u u))) (/ (- v) t1)))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -1.5e-14) || !(u <= 1.2e+116)) {
tmp = v * (t1 / (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.5d-14)) .or. (.not. (u <= 1.2d+116))) then
tmp = v * (t1 / (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.5e-14) || !(u <= 1.2e+116)) {
tmp = v * (t1 / (u * u));
} else {
tmp = -v / t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -1.5e-14) or not (u <= 1.2e+116): tmp = v * (t1 / (u * u)) else: tmp = -v / t1 return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -1.5e-14) || !(u <= 1.2e+116)) tmp = Float64(v * Float64(t1 / Float64(u * u))); else tmp = Float64(Float64(-v) / t1); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((u <= -1.5e-14) || ~((u <= 1.2e+116))) tmp = v * (t1 / (u * u)); else tmp = -v / t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -1.5e-14], N[Not[LessEqual[u, 1.2e+116]], $MachinePrecision]], N[(v * N[(t1 / N[(u * u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-v) / t1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -1.5 \cdot 10^{-14} \lor \neg \left(u \leq 1.2 \cdot 10^{+116}\right):\\
\;\;\;\;v \cdot \frac{t1}{u \cdot u}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1}\\
\end{array}
\end{array}
if u < -1.4999999999999999e-14 or 1.2e116 < u Initial program 74.6%
Taylor expanded in t1 around 0 71.3%
unpow271.3%
Simplified71.3%
expm1-log1p-u70.4%
expm1-udef63.6%
div-inv63.6%
associate-*l*64.1%
add-sqr-sqrt31.5%
sqrt-unprod58.6%
sqr-neg58.6%
sqrt-unprod32.4%
add-sqr-sqrt63.8%
pow263.8%
pow-flip63.8%
metadata-eval63.8%
Applied egg-rr63.8%
expm1-def63.6%
expm1-log1p63.6%
associate-*r*63.2%
*-commutative63.2%
metadata-eval63.2%
pow-sqr63.2%
unpow-163.2%
unpow-163.2%
associate-*r*63.0%
associate-*r/63.0%
associate-*l/63.0%
*-rgt-identity63.0%
associate-*r/63.0%
*-rgt-identity63.0%
associate-*r/63.1%
associate-*r/63.3%
associate-/r*63.7%
Simplified63.7%
if -1.4999999999999999e-14 < u < 1.2e116Initial program 68.1%
times-frac95.4%
Simplified95.4%
Taylor expanded in t1 around inf 68.7%
associate-*r/68.7%
neg-mul-168.7%
Simplified68.7%
Final simplification66.5%
(FPCore (u v t1) :precision binary64 (if (<= u -1.4e-14) (* v (/ t1 (* u u))) (if (<= u 6.2e+114) (/ (- v) t1) (/ v (/ (* u u) t1)))))
double code(double u, double v, double t1) {
double tmp;
if (u <= -1.4e-14) {
tmp = v * (t1 / (u * u));
} else if (u <= 6.2e+114) {
tmp = -v / t1;
} else {
tmp = v / ((u * u) / t1);
}
return tmp;
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: tmp
if (u <= (-1.4d-14)) then
tmp = v * (t1 / (u * u))
else if (u <= 6.2d+114) then
tmp = -v / t1
else
tmp = v / ((u * u) / t1)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if (u <= -1.4e-14) {
tmp = v * (t1 / (u * u));
} else if (u <= 6.2e+114) {
tmp = -v / t1;
} else {
tmp = v / ((u * u) / t1);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if u <= -1.4e-14: tmp = v * (t1 / (u * u)) elif u <= 6.2e+114: tmp = -v / t1 else: tmp = v / ((u * u) / t1) return tmp
function code(u, v, t1) tmp = 0.0 if (u <= -1.4e-14) tmp = Float64(v * Float64(t1 / Float64(u * u))); elseif (u <= 6.2e+114) tmp = Float64(Float64(-v) / t1); else tmp = Float64(v / Float64(Float64(u * u) / t1)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (u <= -1.4e-14) tmp = v * (t1 / (u * u)); elseif (u <= 6.2e+114) tmp = -v / t1; else tmp = v / ((u * u) / t1); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[u, -1.4e-14], N[(v * N[(t1 / N[(u * u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[u, 6.2e+114], N[((-v) / t1), $MachinePrecision], N[(v / N[(N[(u * u), $MachinePrecision] / t1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -1.4 \cdot 10^{-14}:\\
\;\;\;\;v \cdot \frac{t1}{u \cdot u}\\
\mathbf{elif}\;u \leq 6.2 \cdot 10^{+114}:\\
\;\;\;\;\frac{-v}{t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{\frac{u \cdot u}{t1}}\\
\end{array}
\end{array}
if u < -1.4e-14Initial program 75.7%
Taylor expanded in t1 around 0 69.3%
unpow269.3%
Simplified69.3%
expm1-log1p-u67.8%
expm1-udef58.2%
div-inv58.2%
associate-*l*58.5%
add-sqr-sqrt35.0%
sqrt-unprod53.6%
sqr-neg53.6%
sqrt-unprod22.9%
add-sqr-sqrt57.9%
pow257.9%
pow-flip57.9%
metadata-eval57.9%
Applied egg-rr57.9%
expm1-def57.5%
expm1-log1p57.6%
associate-*r*57.3%
*-commutative57.3%
metadata-eval57.3%
pow-sqr57.3%
unpow-157.3%
unpow-157.3%
associate-*r*56.9%
associate-*r/56.9%
associate-*l/56.9%
*-rgt-identity56.9%
associate-*r/56.9%
*-rgt-identity56.9%
associate-*r/57.0%
associate-*r/57.2%
associate-/r*57.8%
Simplified57.8%
if -1.4e-14 < u < 6.2000000000000001e114Initial program 68.1%
times-frac95.4%
Simplified95.4%
Taylor expanded in t1 around inf 68.7%
associate-*r/68.7%
neg-mul-168.7%
Simplified68.7%
if 6.2000000000000001e114 < u Initial program 73.4%
Taylor expanded in t1 around 0 73.5%
unpow273.5%
Simplified73.5%
expm1-log1p-u73.4%
expm1-udef69.8%
div-inv69.8%
associate-*l*70.5%
add-sqr-sqrt27.4%
sqrt-unprod64.2%
sqr-neg64.2%
sqrt-unprod43.1%
add-sqr-sqrt70.6%
pow270.6%
pow-flip70.5%
metadata-eval70.5%
Applied egg-rr70.5%
expm1-def70.4%
expm1-log1p70.5%
associate-*r*69.8%
*-commutative69.8%
metadata-eval69.8%
pow-sqr69.8%
unpow-169.8%
unpow-169.8%
associate-*r*69.8%
associate-*r/69.8%
associate-*l/69.8%
*-rgt-identity69.8%
associate-*r/69.8%
*-rgt-identity69.8%
associate-*r/70.1%
associate-*r/70.1%
associate-/r*70.5%
Simplified70.5%
Taylor expanded in v around 0 69.8%
unpow269.8%
*-commutative69.8%
associate-/l*70.5%
Simplified70.5%
Final simplification66.5%
(FPCore (u v t1) :precision binary64 (/ v (* (+ t1 u) (- -1.0 (/ u t1)))))
double code(double u, double v, double t1) {
return v / ((t1 + u) * (-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 / ((t1 + u) * ((-1.0d0) - (u / t1)))
end function
public static double code(double u, double v, double t1) {
return v / ((t1 + u) * (-1.0 - (u / t1)));
}
def code(u, v, t1): return v / ((t1 + u) * (-1.0 - (u / t1)))
function code(u, v, t1) return Float64(v / Float64(Float64(t1 + u) * Float64(-1.0 - Float64(u / t1)))) end
function tmp = code(u, v, t1) tmp = v / ((t1 + u) * (-1.0 - (u / t1))); end
code[u_, v_, t1_] := N[(v / N[(N[(t1 + u), $MachinePrecision] * N[(-1.0 - N[(u / t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{v}{\left(t1 + u\right) \cdot \left(-1 - \frac{u}{t1}\right)}
\end{array}
Initial program 70.9%
*-commutative70.9%
times-frac97.3%
neg-mul-197.3%
associate-/l*97.3%
associate-*r/97.3%
associate-/l*97.3%
associate-/l/97.3%
neg-mul-197.3%
*-lft-identity97.3%
metadata-eval97.3%
times-frac97.3%
neg-mul-197.3%
remove-double-neg97.3%
neg-mul-197.3%
sub0-neg97.3%
associate--r+97.3%
neg-sub097.3%
div-sub97.3%
distribute-frac-neg97.3%
*-inverses97.3%
metadata-eval97.3%
Simplified97.3%
Taylor expanded in v around 0 95.5%
associate-*r/95.5%
neg-mul-195.5%
+-commutative95.5%
Simplified95.5%
frac-2neg95.5%
div-inv95.3%
add-sqr-sqrt53.8%
sqrt-unprod56.5%
sqr-neg56.5%
sqrt-unprod15.7%
add-sqr-sqrt39.2%
add-sqr-sqrt23.5%
sqrt-unprod53.1%
sqr-neg53.1%
sqrt-unprod41.3%
add-sqr-sqrt95.3%
Applied egg-rr95.3%
associate-*r/95.5%
*-rgt-identity95.5%
distribute-rgt-neg-in95.5%
+-commutative95.5%
distribute-neg-in95.5%
metadata-eval95.5%
sub-neg95.5%
Simplified95.5%
Final simplification95.5%
(FPCore (u v t1) :precision binary64 (/ (/ v (+ t1 u)) (- -1.0 (/ u t1))))
double code(double u, double v, double t1) {
return (v / (t1 + u)) / (-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 / (t1 + u)) / ((-1.0d0) - (u / t1))
end function
public static double code(double u, double v, double t1) {
return (v / (t1 + u)) / (-1.0 - (u / t1));
}
def code(u, v, t1): return (v / (t1 + u)) / (-1.0 - (u / t1))
function code(u, v, t1) return Float64(Float64(v / Float64(t1 + u)) / Float64(-1.0 - Float64(u / t1))) end
function tmp = code(u, v, t1) tmp = (v / (t1 + u)) / (-1.0 - (u / t1)); end
code[u_, v_, t1_] := N[(N[(v / N[(t1 + u), $MachinePrecision]), $MachinePrecision] / N[(-1.0 - N[(u / t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{v}{t1 + u}}{-1 - \frac{u}{t1}}
\end{array}
Initial program 70.9%
*-commutative70.9%
times-frac97.3%
neg-mul-197.3%
associate-/l*97.3%
associate-*r/97.3%
associate-/l*97.3%
associate-/l/97.3%
neg-mul-197.3%
*-lft-identity97.3%
metadata-eval97.3%
times-frac97.3%
neg-mul-197.3%
remove-double-neg97.3%
neg-mul-197.3%
sub0-neg97.3%
associate--r+97.3%
neg-sub097.3%
div-sub97.3%
distribute-frac-neg97.3%
*-inverses97.3%
metadata-eval97.3%
Simplified97.3%
Final simplification97.3%
(FPCore (u v t1) :precision binary64 (if (<= u -4.9e+192) (/ (- v) u) (if (<= u 9.5e+99) (/ (- v) t1) (/ 1.0 (/ u v)))))
double code(double u, double v, double t1) {
double tmp;
if (u <= -4.9e+192) {
tmp = -v / u;
} else if (u <= 9.5e+99) {
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 <= (-4.9d+192)) then
tmp = -v / u
else if (u <= 9.5d+99) 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 <= -4.9e+192) {
tmp = -v / u;
} else if (u <= 9.5e+99) {
tmp = -v / t1;
} else {
tmp = 1.0 / (u / v);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if u <= -4.9e+192: tmp = -v / u elif u <= 9.5e+99: tmp = -v / t1 else: tmp = 1.0 / (u / v) return tmp
function code(u, v, t1) tmp = 0.0 if (u <= -4.9e+192) tmp = Float64(Float64(-v) / u); elseif (u <= 9.5e+99) 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 <= -4.9e+192) tmp = -v / u; elseif (u <= 9.5e+99) tmp = -v / t1; else tmp = 1.0 / (u / v); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[u, -4.9e+192], N[((-v) / u), $MachinePrecision], If[LessEqual[u, 9.5e+99], N[((-v) / t1), $MachinePrecision], N[(1.0 / N[(u / v), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -4.9 \cdot 10^{+192}:\\
\;\;\;\;\frac{-v}{u}\\
\mathbf{elif}\;u \leq 9.5 \cdot 10^{+99}:\\
\;\;\;\;\frac{-v}{t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{u}{v}}\\
\end{array}
\end{array}
if u < -4.90000000000000047e192Initial program 78.2%
*-commutative78.2%
times-frac99.9%
neg-mul-199.9%
associate-/l*99.9%
associate-*r/99.9%
associate-/l*99.9%
associate-/l/99.9%
neg-mul-199.9%
*-lft-identity99.9%
metadata-eval99.9%
times-frac99.9%
neg-mul-199.9%
remove-double-neg99.9%
neg-mul-199.9%
sub0-neg99.9%
associate--r+99.9%
neg-sub099.9%
div-sub99.9%
distribute-frac-neg99.9%
*-inverses99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in t1 around inf 56.8%
Taylor expanded in t1 around 0 40.6%
associate-*r/40.6%
neg-mul-140.6%
Simplified40.6%
if -4.90000000000000047e192 < u < 9.49999999999999908e99Initial program 68.8%
times-frac96.2%
Simplified96.2%
Taylor expanded in t1 around inf 62.4%
associate-*r/62.4%
neg-mul-162.4%
Simplified62.4%
if 9.49999999999999908e99 < u Initial program 74.9%
associate-/l*75.6%
associate-/l*91.2%
Simplified91.2%
Taylor expanded in t1 around inf 40.9%
clear-num44.1%
inv-pow44.1%
div-inv44.1%
clear-num44.1%
add-sqr-sqrt15.5%
sqrt-unprod37.4%
sqr-neg37.4%
sqrt-unprod24.7%
add-sqr-sqrt40.5%
Applied egg-rr40.5%
unpow-140.5%
associate-/l*40.5%
associate-/r/40.7%
*-inverses40.7%
*-lft-identity40.7%
Simplified40.7%
Taylor expanded in t1 around 0 40.7%
Final simplification55.9%
(FPCore (u v t1) :precision binary64 (if (or (<= u -2.6e+192) (not (<= u 6e+116))) (/ (- v) u) (/ (- v) t1)))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -2.6e+192) || !(u <= 6e+116)) {
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.6d+192)) .or. (.not. (u <= 6d+116))) 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.6e+192) || !(u <= 6e+116)) {
tmp = -v / u;
} else {
tmp = -v / t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -2.6e+192) or not (u <= 6e+116): tmp = -v / u else: tmp = -v / t1 return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -2.6e+192) || !(u <= 6e+116)) tmp = Float64(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 <= -2.6e+192) || ~((u <= 6e+116))) tmp = -v / u; else tmp = -v / t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -2.6e+192], N[Not[LessEqual[u, 6e+116]], $MachinePrecision]], N[((-v) / u), $MachinePrecision], N[((-v) / t1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -2.6 \cdot 10^{+192} \lor \neg \left(u \leq 6 \cdot 10^{+116}\right):\\
\;\;\;\;\frac{-v}{u}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1}\\
\end{array}
\end{array}
if u < -2.60000000000000003e192 or 5.9999999999999997e116 < u Initial program 74.9%
*-commutative74.9%
times-frac99.9%
neg-mul-199.9%
associate-/l*99.9%
associate-*r/99.8%
associate-/l*99.8%
associate-/l/99.8%
neg-mul-199.8%
*-lft-identity99.8%
metadata-eval99.8%
times-frac99.8%
neg-mul-199.8%
remove-double-neg99.8%
neg-mul-199.8%
sub0-neg99.8%
associate--r+99.8%
neg-sub099.8%
div-sub99.8%
distribute-frac-neg99.8%
*-inverses99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in t1 around inf 56.7%
Taylor expanded in t1 around 0 38.9%
associate-*r/38.9%
neg-mul-138.9%
Simplified38.9%
if -2.60000000000000003e192 < u < 5.9999999999999997e116Initial program 69.3%
times-frac96.3%
Simplified96.3%
Taylor expanded in t1 around inf 62.0%
associate-*r/62.0%
neg-mul-162.0%
Simplified62.0%
Final simplification55.3%
(FPCore (u v t1) :precision binary64 (if (<= u -7.5e+192) (/ v u) (if (<= u 1.1e+100) (/ (- v) t1) (/ v u))))
double code(double u, double v, double t1) {
double tmp;
if (u <= -7.5e+192) {
tmp = v / u;
} else if (u <= 1.1e+100) {
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.5d+192)) then
tmp = v / u
else if (u <= 1.1d+100) 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.5e+192) {
tmp = v / u;
} else if (u <= 1.1e+100) {
tmp = -v / t1;
} else {
tmp = v / u;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if u <= -7.5e+192: tmp = v / u elif u <= 1.1e+100: tmp = -v / t1 else: tmp = v / u return tmp
function code(u, v, t1) tmp = 0.0 if (u <= -7.5e+192) tmp = Float64(v / u); elseif (u <= 1.1e+100) 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.5e+192) tmp = v / u; elseif (u <= 1.1e+100) tmp = -v / t1; else tmp = v / u; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[u, -7.5e+192], N[(v / u), $MachinePrecision], If[LessEqual[u, 1.1e+100], N[((-v) / t1), $MachinePrecision], N[(v / u), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -7.5 \cdot 10^{+192}:\\
\;\;\;\;\frac{v}{u}\\
\mathbf{elif}\;u \leq 1.1 \cdot 10^{+100}:\\
\;\;\;\;\frac{-v}{t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{u}\\
\end{array}
\end{array}
if u < -7.5e192 or 1.1e100 < u Initial program 75.8%
associate-/l*76.5%
associate-/l*91.3%
Simplified91.3%
Taylor expanded in t1 around inf 40.6%
clear-num42.9%
inv-pow42.9%
div-inv42.9%
clear-num42.9%
add-sqr-sqrt18.0%
sqrt-unprod40.2%
sqr-neg40.2%
sqrt-unprod22.1%
add-sqr-sqrt40.4%
Applied egg-rr40.4%
unpow-140.4%
associate-/l*40.3%
associate-/r/40.6%
*-inverses40.6%
*-lft-identity40.6%
Simplified40.6%
Taylor expanded in t1 around 0 38.2%
if -7.5e192 < u < 1.1e100Initial program 68.8%
times-frac96.2%
Simplified96.2%
Taylor expanded in t1 around inf 62.4%
associate-*r/62.4%
neg-mul-162.4%
Simplified62.4%
Final simplification55.1%
(FPCore (u v t1) :precision binary64 (if (<= t1 -1.2e+158) (/ v t1) (if (<= t1 2.85e+215) (/ v u) (/ v t1))))
double code(double u, double v, double t1) {
double tmp;
if (t1 <= -1.2e+158) {
tmp = v / t1;
} else if (t1 <= 2.85e+215) {
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 (t1 <= (-1.2d+158)) then
tmp = v / t1
else if (t1 <= 2.85d+215) 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 (t1 <= -1.2e+158) {
tmp = v / t1;
} else if (t1 <= 2.85e+215) {
tmp = v / u;
} else {
tmp = v / t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if t1 <= -1.2e+158: tmp = v / t1 elif t1 <= 2.85e+215: tmp = v / u else: tmp = v / t1 return tmp
function code(u, v, t1) tmp = 0.0 if (t1 <= -1.2e+158) tmp = Float64(v / t1); elseif (t1 <= 2.85e+215) tmp = Float64(v / u); else tmp = Float64(v / t1); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (t1 <= -1.2e+158) tmp = v / t1; elseif (t1 <= 2.85e+215) tmp = v / u; else tmp = v / t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[t1, -1.2e+158], N[(v / t1), $MachinePrecision], If[LessEqual[t1, 2.85e+215], N[(v / u), $MachinePrecision], N[(v / t1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -1.2 \cdot 10^{+158}:\\
\;\;\;\;\frac{v}{t1}\\
\mathbf{elif}\;t1 \leq 2.85 \cdot 10^{+215}:\\
\;\;\;\;\frac{v}{u}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{t1}\\
\end{array}
\end{array}
if t1 < -1.20000000000000004e158 or 2.85e215 < t1 Initial program 45.8%
associate-/l*47.3%
associate-/l*62.6%
Simplified62.6%
frac-2neg62.6%
div-inv62.6%
distribute-neg-in62.6%
add-sqr-sqrt40.5%
sqrt-unprod47.3%
sqr-neg47.3%
sqrt-unprod13.5%
add-sqr-sqrt47.1%
sub-neg47.1%
distribute-neg-frac47.1%
Applied egg-rr47.1%
associate-/r/47.1%
Simplified47.1%
Taylor expanded in t1 around inf 46.4%
if -1.20000000000000004e158 < t1 < 2.85e215Initial program 78.1%
associate-/l*78.4%
associate-/l*88.2%
Simplified88.2%
Taylor expanded in t1 around inf 41.2%
clear-num42.4%
inv-pow42.4%
div-inv42.4%
clear-num42.3%
add-sqr-sqrt19.5%
sqrt-unprod37.2%
sqr-neg37.2%
sqrt-unprod11.2%
add-sqr-sqrt19.8%
Applied egg-rr19.8%
unpow-119.8%
associate-/l*19.8%
associate-/r/20.0%
*-inverses20.0%
*-lft-identity20.0%
Simplified20.0%
Taylor expanded in t1 around 0 20.2%
Final simplification26.1%
(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 70.9%
associate-/l*71.5%
associate-/l*82.5%
Simplified82.5%
Taylor expanded in t1 around inf 45.9%
Taylor expanded in v around 0 57.2%
associate-*r/57.2%
neg-mul-157.2%
Simplified57.2%
Final simplification57.2%
(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 70.9%
associate-/l*71.5%
associate-/l*82.5%
Simplified82.5%
frac-2neg82.5%
div-inv82.5%
distribute-neg-in82.5%
add-sqr-sqrt38.2%
sqrt-unprod68.2%
sqr-neg68.2%
sqrt-unprod32.3%
add-sqr-sqrt59.9%
sub-neg59.9%
distribute-neg-frac59.9%
Applied egg-rr59.9%
associate-/r/59.9%
Simplified59.9%
Taylor expanded in t1 around inf 14.0%
Final simplification14.0%
herbie shell --seed 2023182
(FPCore (u v t1)
:name "Rosa's DopplerBench"
:precision binary64
(/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))