
(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 (* (/ (- 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 75.5%
times-frac99.8%
distribute-frac-neg99.8%
distribute-neg-frac299.8%
+-commutative99.8%
distribute-neg-in99.8%
unsub-neg99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -5.6e+140) (not (<= t1 3.9e+80))) (/ v (- (- t1) (* u 2.0))) (* t1 (/ (/ (- v) (+ t1 u)) (+ t1 u)))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -5.6e+140) || !(t1 <= 3.9e+80)) {
tmp = v / (-t1 - (u * 2.0));
} else {
tmp = t1 * ((-v / (t1 + 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 <= (-5.6d+140)) .or. (.not. (t1 <= 3.9d+80))) then
tmp = v / (-t1 - (u * 2.0d0))
else
tmp = t1 * ((-v / (t1 + u)) / (t1 + u))
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -5.6e+140) || !(t1 <= 3.9e+80)) {
tmp = v / (-t1 - (u * 2.0));
} else {
tmp = t1 * ((-v / (t1 + u)) / (t1 + u));
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -5.6e+140) or not (t1 <= 3.9e+80): tmp = v / (-t1 - (u * 2.0)) else: tmp = t1 * ((-v / (t1 + u)) / (t1 + u)) return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -5.6e+140) || !(t1 <= 3.9e+80)) tmp = Float64(v / Float64(Float64(-t1) - Float64(u * 2.0))); else tmp = Float64(t1 * Float64(Float64(Float64(-v) / Float64(t1 + u)) / Float64(t1 + u))); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -5.6e+140) || ~((t1 <= 3.9e+80))) tmp = v / (-t1 - (u * 2.0)); else tmp = t1 * ((-v / (t1 + u)) / (t1 + u)); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -5.6e+140], N[Not[LessEqual[t1, 3.9e+80]], $MachinePrecision]], N[(v / N[((-t1) - N[(u * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t1 * N[(N[((-v) / N[(t1 + u), $MachinePrecision]), $MachinePrecision] / N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -5.6 \cdot 10^{+140} \lor \neg \left(t1 \leq 3.9 \cdot 10^{+80}\right):\\
\;\;\;\;\frac{v}{\left(-t1\right) - u \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;t1 \cdot \frac{\frac{-v}{t1 + u}}{t1 + u}\\
\end{array}
\end{array}
if t1 < -5.59999999999999966e140 or 3.89999999999999999e80 < t1 Initial program 53.1%
associate-/l*55.2%
distribute-lft-neg-out55.2%
distribute-rgt-neg-in55.2%
associate-/r*70.2%
distribute-neg-frac270.2%
Simplified70.2%
associate-*r/99.9%
+-commutative99.9%
distribute-neg-in99.9%
sub-neg99.9%
associate-*l/99.9%
clear-num99.9%
frac-2neg99.9%
frac-times95.9%
*-un-lft-identity95.9%
frac-2neg95.9%
sub-neg95.9%
distribute-neg-in95.9%
+-commutative95.9%
remove-double-neg95.9%
add-sqr-sqrt42.3%
sqrt-unprod7.5%
sqr-neg7.5%
sqrt-unprod20.5%
add-sqr-sqrt42.9%
add-sqr-sqrt21.0%
sqrt-unprod55.9%
Applied egg-rr95.9%
Taylor expanded in u around 0 93.5%
*-commutative93.5%
Simplified93.5%
if -5.59999999999999966e140 < t1 < 3.89999999999999999e80Initial program 84.1%
associate-/l*86.9%
distribute-lft-neg-out86.9%
distribute-rgt-neg-in86.9%
associate-/r*91.9%
distribute-neg-frac291.9%
Simplified91.9%
Final simplification92.3%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -5.6e-104) (not (<= t1 6e-55))) (/ (- v) (+ t1 u)) (* (/ t1 (- u)) (/ v u))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -5.6e-104) || !(t1 <= 6e-55)) {
tmp = -v / (t1 + u);
} 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.6d-104)) .or. (.not. (t1 <= 6d-55))) then
tmp = -v / (t1 + u)
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.6e-104) || !(t1 <= 6e-55)) {
tmp = -v / (t1 + u);
} else {
tmp = (t1 / -u) * (v / u);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -5.6e-104) or not (t1 <= 6e-55): tmp = -v / (t1 + u) else: tmp = (t1 / -u) * (v / u) return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -5.6e-104) || !(t1 <= 6e-55)) tmp = Float64(Float64(-v) / Float64(t1 + u)); else tmp = Float64(Float64(t1 / Float64(-u)) * Float64(v / u)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -5.6e-104) || ~((t1 <= 6e-55))) tmp = -v / (t1 + u); else tmp = (t1 / -u) * (v / u); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -5.6e-104], N[Not[LessEqual[t1, 6e-55]], $MachinePrecision]], N[((-v) / N[(t1 + u), $MachinePrecision]), $MachinePrecision], N[(N[(t1 / (-u)), $MachinePrecision] * N[(v / u), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -5.6 \cdot 10^{-104} \lor \neg \left(t1 \leq 6 \cdot 10^{-55}\right):\\
\;\;\;\;\frac{-v}{t1 + u}\\
\mathbf{else}:\\
\;\;\;\;\frac{t1}{-u} \cdot \frac{v}{u}\\
\end{array}
\end{array}
if t1 < -5.6e-104 or 6.00000000000000033e-55 < t1 Initial program 73.7%
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 inf 81.7%
if -5.6e-104 < t1 < 6.00000000000000033e-55Initial program 78.4%
times-frac99.7%
distribute-frac-neg99.7%
distribute-neg-frac299.7%
+-commutative99.7%
distribute-neg-in99.7%
unsub-neg99.7%
Simplified99.7%
Taylor expanded in t1 around 0 83.9%
associate-*r/83.9%
mul-1-neg83.9%
Simplified83.9%
Taylor expanded in t1 around 0 85.2%
Final simplification83.1%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -6.5e-103) (not (<= t1 1.8e-58))) (/ v (- (- t1) (* u 2.0))) (* (/ t1 (- u)) (/ v u))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -6.5e-103) || !(t1 <= 1.8e-58)) {
tmp = v / (-t1 - (u * 2.0));
} 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 <= (-6.5d-103)) .or. (.not. (t1 <= 1.8d-58))) then
tmp = v / (-t1 - (u * 2.0d0))
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 <= -6.5e-103) || !(t1 <= 1.8e-58)) {
tmp = v / (-t1 - (u * 2.0));
} else {
tmp = (t1 / -u) * (v / u);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -6.5e-103) or not (t1 <= 1.8e-58): tmp = v / (-t1 - (u * 2.0)) else: tmp = (t1 / -u) * (v / u) return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -6.5e-103) || !(t1 <= 1.8e-58)) tmp = Float64(v / Float64(Float64(-t1) - Float64(u * 2.0))); else tmp = Float64(Float64(t1 / Float64(-u)) * Float64(v / u)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -6.5e-103) || ~((t1 <= 1.8e-58))) tmp = v / (-t1 - (u * 2.0)); else tmp = (t1 / -u) * (v / u); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -6.5e-103], N[Not[LessEqual[t1, 1.8e-58]], $MachinePrecision]], N[(v / N[((-t1) - N[(u * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t1 / (-u)), $MachinePrecision] * N[(v / u), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -6.5 \cdot 10^{-103} \lor \neg \left(t1 \leq 1.8 \cdot 10^{-58}\right):\\
\;\;\;\;\frac{v}{\left(-t1\right) - u \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{t1}{-u} \cdot \frac{v}{u}\\
\end{array}
\end{array}
if t1 < -6.49999999999999966e-103 or 1.80000000000000005e-58 < t1 Initial program 73.7%
associate-/l*74.9%
distribute-lft-neg-out74.9%
distribute-rgt-neg-in74.9%
associate-/r*84.3%
distribute-neg-frac284.3%
Simplified84.3%
associate-*r/99.9%
+-commutative99.9%
distribute-neg-in99.9%
sub-neg99.9%
associate-*l/99.9%
clear-num99.9%
frac-2neg99.9%
frac-times95.1%
*-un-lft-identity95.1%
frac-2neg95.1%
sub-neg95.1%
distribute-neg-in95.1%
+-commutative95.1%
remove-double-neg95.1%
add-sqr-sqrt52.2%
sqrt-unprod40.7%
sqr-neg40.7%
sqrt-unprod13.4%
add-sqr-sqrt33.7%
add-sqr-sqrt17.8%
sqrt-unprod55.9%
Applied egg-rr95.1%
Taylor expanded in u around 0 81.8%
*-commutative81.8%
Simplified81.8%
if -6.49999999999999966e-103 < t1 < 1.80000000000000005e-58Initial program 78.4%
times-frac99.7%
distribute-frac-neg99.7%
distribute-neg-frac299.7%
+-commutative99.7%
distribute-neg-in99.7%
unsub-neg99.7%
Simplified99.7%
Taylor expanded in t1 around 0 83.9%
associate-*r/83.9%
mul-1-neg83.9%
Simplified83.9%
Taylor expanded in t1 around 0 85.2%
Final simplification83.2%
(FPCore (u v t1) :precision binary64 (if (or (<= u -2.2e+125) (not (<= u 7.2e+22))) (/ t1 (* u (/ u v))) (/ v (- t1))))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -2.2e+125) || !(u <= 7.2e+22)) {
tmp = t1 / (u * (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 <= (-2.2d+125)) .or. (.not. (u <= 7.2d+22))) then
tmp = t1 / (u * (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 <= -2.2e+125) || !(u <= 7.2e+22)) {
tmp = t1 / (u * (u / v));
} else {
tmp = v / -t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -2.2e+125) or not (u <= 7.2e+22): tmp = t1 / (u * (u / v)) else: tmp = v / -t1 return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -2.2e+125) || !(u <= 7.2e+22)) tmp = Float64(t1 / Float64(u * 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 <= -2.2e+125) || ~((u <= 7.2e+22))) tmp = t1 / (u * (u / v)); else tmp = v / -t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -2.2e+125], N[Not[LessEqual[u, 7.2e+22]], $MachinePrecision]], N[(t1 / N[(u * N[(u / v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(v / (-t1)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -2.2 \cdot 10^{+125} \lor \neg \left(u \leq 7.2 \cdot 10^{+22}\right):\\
\;\;\;\;\frac{t1}{u \cdot \frac{u}{v}}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{-t1}\\
\end{array}
\end{array}
if u < -2.19999999999999991e125 or 7.2e22 < u Initial program 86.3%
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 95.0%
associate-*r/95.0%
mul-1-neg95.0%
Simplified95.0%
Taylor expanded in t1 around 0 91.9%
*-commutative91.9%
clear-num92.9%
frac-times89.0%
*-un-lft-identity89.0%
add-sqr-sqrt44.6%
sqrt-unprod65.5%
sqr-neg65.5%
sqrt-unprod35.0%
add-sqr-sqrt72.3%
Applied egg-rr72.3%
if -2.19999999999999991e125 < u < 7.2e22Initial program 69.4%
associate-/l*73.7%
distribute-lft-neg-out73.7%
distribute-rgt-neg-in73.7%
associate-/r*82.5%
distribute-neg-frac282.5%
Simplified82.5%
Taylor expanded in t1 around inf 75.4%
associate-*r/75.4%
neg-mul-175.4%
Simplified75.4%
Final simplification74.3%
(FPCore (u v t1) :precision binary64 (if (or (<= u -2.8e+155) (not (<= u 2.3e+83))) (/ (* v -0.5) u) (/ v (- t1))))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -2.8e+155) || !(u <= 2.3e+83)) {
tmp = (v * -0.5) / 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.8d+155)) .or. (.not. (u <= 2.3d+83))) then
tmp = (v * (-0.5d0)) / 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.8e+155) || !(u <= 2.3e+83)) {
tmp = (v * -0.5) / u;
} else {
tmp = v / -t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -2.8e+155) or not (u <= 2.3e+83): tmp = (v * -0.5) / u else: tmp = v / -t1 return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -2.8e+155) || !(u <= 2.3e+83)) tmp = Float64(Float64(v * -0.5) / u); else tmp = Float64(v / Float64(-t1)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((u <= -2.8e+155) || ~((u <= 2.3e+83))) tmp = (v * -0.5) / u; else tmp = v / -t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -2.8e+155], N[Not[LessEqual[u, 2.3e+83]], $MachinePrecision]], N[(N[(v * -0.5), $MachinePrecision] / u), $MachinePrecision], N[(v / (-t1)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -2.8 \cdot 10^{+155} \lor \neg \left(u \leq 2.3 \cdot 10^{+83}\right):\\
\;\;\;\;\frac{v \cdot -0.5}{u}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{-t1}\\
\end{array}
\end{array}
if u < -2.80000000000000016e155 or 2.29999999999999995e83 < u Initial program 85.5%
associate-/l*85.8%
distribute-lft-neg-out85.8%
distribute-rgt-neg-in85.8%
associate-/r*92.2%
distribute-neg-frac292.2%
Simplified92.2%
associate-*r/99.9%
+-commutative99.9%
distribute-neg-in99.9%
sub-neg99.9%
associate-*l/99.9%
clear-num99.9%
frac-2neg99.9%
frac-times89.7%
*-un-lft-identity89.7%
frac-2neg89.7%
sub-neg89.7%
distribute-neg-in89.7%
+-commutative89.7%
remove-double-neg89.7%
add-sqr-sqrt39.4%
sqrt-unprod70.0%
sqr-neg70.0%
sqrt-unprod43.9%
add-sqr-sqrt79.4%
add-sqr-sqrt43.7%
sqrt-unprod85.9%
Applied egg-rr89.7%
Taylor expanded in u around 0 46.6%
*-commutative46.6%
Simplified46.6%
Taylor expanded in t1 around 0 44.0%
associate-*r/44.0%
*-commutative44.0%
Simplified44.0%
if -2.80000000000000016e155 < u < 2.29999999999999995e83Initial program 71.5%
associate-/l*74.9%
distribute-lft-neg-out74.9%
distribute-rgt-neg-in74.9%
associate-/r*83.3%
distribute-neg-frac283.3%
Simplified83.3%
Taylor expanded in t1 around inf 70.7%
associate-*r/70.7%
neg-mul-170.7%
Simplified70.7%
Final simplification63.0%
(FPCore (u v t1) :precision binary64 (if (or (<= u -1.02e+157) (not (<= u 4.8e+83))) (/ v (- u)) (/ v (- t1))))
double code(double u, double v, double t1) {
double tmp;
if ((u <= -1.02e+157) || !(u <= 4.8e+83)) {
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.02d+157)) .or. (.not. (u <= 4.8d+83))) 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.02e+157) || !(u <= 4.8e+83)) {
tmp = v / -u;
} else {
tmp = v / -t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (u <= -1.02e+157) or not (u <= 4.8e+83): tmp = v / -u else: tmp = v / -t1 return tmp
function code(u, v, t1) tmp = 0.0 if ((u <= -1.02e+157) || !(u <= 4.8e+83)) 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 <= -1.02e+157) || ~((u <= 4.8e+83))) tmp = v / -u; else tmp = v / -t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[u, -1.02e+157], N[Not[LessEqual[u, 4.8e+83]], $MachinePrecision]], N[(v / (-u)), $MachinePrecision], N[(v / (-t1)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;u \leq -1.02 \cdot 10^{+157} \lor \neg \left(u \leq 4.8 \cdot 10^{+83}\right):\\
\;\;\;\;\frac{v}{-u}\\
\mathbf{else}:\\
\;\;\;\;\frac{v}{-t1}\\
\end{array}
\end{array}
if u < -1.02000000000000003e157 or 4.79999999999999982e83 < u Initial program 85.5%
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 97.6%
associate-*r/97.6%
mul-1-neg97.6%
Simplified97.6%
Taylor expanded in t1 around inf 44.0%
associate-*r/44.0%
mul-1-neg44.0%
Simplified44.0%
if -1.02000000000000003e157 < u < 4.79999999999999982e83Initial program 71.5%
associate-/l*74.9%
distribute-lft-neg-out74.9%
distribute-rgt-neg-in74.9%
associate-/r*83.3%
distribute-neg-frac283.3%
Simplified83.3%
Taylor expanded in t1 around inf 70.7%
associate-*r/70.7%
neg-mul-170.7%
Simplified70.7%
Final simplification63.0%
(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 75.5%
times-frac99.8%
distribute-frac-neg99.8%
distribute-neg-frac299.8%
+-commutative99.8%
distribute-neg-in99.8%
unsub-neg99.8%
Simplified99.8%
Taylor expanded in t1 around inf 63.9%
Final simplification63.9%
(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 / Float64(-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.5%
associate-/l*78.1%
distribute-lft-neg-out78.1%
distribute-rgt-neg-in78.1%
associate-/r*85.9%
distribute-neg-frac285.9%
Simplified85.9%
Taylor expanded in t1 around inf 55.0%
associate-*r/55.0%
neg-mul-155.0%
Simplified55.0%
Final simplification55.0%
herbie shell --seed 2024055
(FPCore (u v t1)
:name "Rosa's DopplerBench"
:precision binary64
(/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))