
(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) (/ t1 (+ u t1))) (+ u t1)))
double code(double u, double v, double t1) {
return (-v * (t1 / (u + t1))) / (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 + t1))) / (u + t1)
end function
public static double code(double u, double v, double t1) {
return (-v * (t1 / (u + t1))) / (u + t1);
}
def code(u, v, t1): return (-v * (t1 / (u + t1))) / (u + t1)
function code(u, v, t1) return Float64(Float64(Float64(-v) * Float64(t1 / Float64(u + t1))) / Float64(u + t1)) end
function tmp = code(u, v, t1) tmp = (-v * (t1 / (u + t1))) / (u + t1); end
code[u_, v_, t1_] := N[(N[((-v) * N[(t1 / N[(u + t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(u + t1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(-v\right) \cdot \frac{t1}{u + t1}}{u + t1}
\end{array}
Initial program 70.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
frac-2negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
associate-/l*N/A
lift-neg.f64N/A
frac-2negN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-/.f6497.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6497.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6497.8
Applied rewrites97.8%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -5.4e+130) (not (<= t1 1.65e+146))) (/ (- v) (+ u t1)) (/ (- t1) (* (/ (+ u t1) v) (+ u t1)))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -5.4e+130) || !(t1 <= 1.65e+146)) {
tmp = -v / (u + t1);
} else {
tmp = -t1 / (((u + t1) / 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 ((t1 <= (-5.4d+130)) .or. (.not. (t1 <= 1.65d+146))) then
tmp = -v / (u + t1)
else
tmp = -t1 / (((u + t1) / v) * (u + t1))
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -5.4e+130) || !(t1 <= 1.65e+146)) {
tmp = -v / (u + t1);
} else {
tmp = -t1 / (((u + t1) / v) * (u + t1));
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -5.4e+130) or not (t1 <= 1.65e+146): tmp = -v / (u + t1) else: tmp = -t1 / (((u + t1) / v) * (u + t1)) return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -5.4e+130) || !(t1 <= 1.65e+146)) tmp = Float64(Float64(-v) / Float64(u + t1)); else tmp = Float64(Float64(-t1) / Float64(Float64(Float64(u + t1) / v) * Float64(u + t1))); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -5.4e+130) || ~((t1 <= 1.65e+146))) tmp = -v / (u + t1); else tmp = -t1 / (((u + t1) / v) * (u + t1)); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -5.4e+130], N[Not[LessEqual[t1, 1.65e+146]], $MachinePrecision]], N[((-v) / N[(u + t1), $MachinePrecision]), $MachinePrecision], N[((-t1) / N[(N[(N[(u + t1), $MachinePrecision] / v), $MachinePrecision] * N[(u + t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -5.4 \cdot 10^{+130} \lor \neg \left(t1 \leq 1.65 \cdot 10^{+146}\right):\\
\;\;\;\;\frac{-v}{u + t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{-t1}{\frac{u + t1}{v} \cdot \left(u + t1\right)}\\
\end{array}
\end{array}
if t1 < -5.3999999999999997e130 or 1.65000000000000008e146 < t1 Initial program 45.7%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
frac-2negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
associate-/l*N/A
lift-neg.f64N/A
frac-2negN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-/.f64100.0
lift-+.f64N/A
+-commutativeN/A
lower-+.f64100.0
lift-+.f64N/A
+-commutativeN/A
lower-+.f64100.0
Applied rewrites100.0%
Taylor expanded in u around 0
mul-1-negN/A
lower-neg.f6495.6
Applied rewrites95.6%
if -5.3999999999999997e130 < t1 < 1.65000000000000008e146Initial program 83.2%
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
times-fracN/A
clear-numN/A
frac-2negN/A
frac-timesN/A
metadata-evalN/A
lift-neg.f64N/A
remove-double-negN/A
distribute-lft-neg-inN/A
neg-mul-1N/A
remove-double-negN/A
lower-/.f64N/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-neg.f6492.1
lift-+.f64N/A
+-commutativeN/A
lower-+.f6492.1
Applied rewrites92.1%
Final simplification93.3%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -8e+104) (not (<= t1 1.12e+69))) (/ (- v) (+ u t1)) (/ (* (- t1) v) (* (+ t1 u) (+ t1 u)))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -8e+104) || !(t1 <= 1.12e+69)) {
tmp = -v / (u + t1);
} 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 <= (-8d+104)) .or. (.not. (t1 <= 1.12d+69))) then
tmp = -v / (u + t1)
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 <= -8e+104) || !(t1 <= 1.12e+69)) {
tmp = -v / (u + t1);
} else {
tmp = (-t1 * v) / ((t1 + u) * (t1 + u));
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -8e+104) or not (t1 <= 1.12e+69): tmp = -v / (u + t1) else: tmp = (-t1 * v) / ((t1 + u) * (t1 + u)) return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -8e+104) || !(t1 <= 1.12e+69)) tmp = Float64(Float64(-v) / Float64(u + t1)); else tmp = Float64(Float64(Float64(-t1) * v) / Float64(Float64(t1 + u) * Float64(t1 + u))); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -8e+104) || ~((t1 <= 1.12e+69))) tmp = -v / (u + t1); else tmp = (-t1 * v) / ((t1 + u) * (t1 + u)); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -8e+104], N[Not[LessEqual[t1, 1.12e+69]], $MachinePrecision]], N[((-v) / N[(u + t1), $MachinePrecision]), $MachinePrecision], N[(N[((-t1) * v), $MachinePrecision] / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -8 \cdot 10^{+104} \lor \neg \left(t1 \leq 1.12 \cdot 10^{+69}\right):\\
\;\;\;\;\frac{-v}{u + t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}\\
\end{array}
\end{array}
if t1 < -8e104 or 1.12e69 < t1 Initial program 48.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
frac-2negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
associate-/l*N/A
lift-neg.f64N/A
frac-2negN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-/.f6499.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
Applied rewrites99.9%
Taylor expanded in u around 0
mul-1-negN/A
lower-neg.f6492.1
Applied rewrites92.1%
if -8e104 < t1 < 1.12e69Initial program 87.1%
Final simplification89.2%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -5e-108) (not (<= t1 440000000000.0))) (/ (- v) (+ u t1)) (/ (* (/ (- t1) u) v) u)))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -5e-108) || !(t1 <= 440000000000.0)) {
tmp = -v / (u + t1);
} else {
tmp = ((-t1 / u) * v) / u;
}
return tmp;
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: tmp
if ((t1 <= (-5d-108)) .or. (.not. (t1 <= 440000000000.0d0))) then
tmp = -v / (u + t1)
else
tmp = ((-t1 / u) * v) / u
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -5e-108) || !(t1 <= 440000000000.0)) {
tmp = -v / (u + t1);
} else {
tmp = ((-t1 / u) * v) / u;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -5e-108) or not (t1 <= 440000000000.0): tmp = -v / (u + t1) else: tmp = ((-t1 / u) * v) / u return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -5e-108) || !(t1 <= 440000000000.0)) tmp = Float64(Float64(-v) / Float64(u + t1)); else tmp = Float64(Float64(Float64(Float64(-t1) / u) * v) / u); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -5e-108) || ~((t1 <= 440000000000.0))) tmp = -v / (u + t1); else tmp = ((-t1 / u) * v) / u; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -5e-108], N[Not[LessEqual[t1, 440000000000.0]], $MachinePrecision]], N[((-v) / N[(u + t1), $MachinePrecision]), $MachinePrecision], N[(N[(N[((-t1) / u), $MachinePrecision] * v), $MachinePrecision] / u), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -5 \cdot 10^{-108} \lor \neg \left(t1 \leq 440000000000\right):\\
\;\;\;\;\frac{-v}{u + t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{-t1}{u} \cdot v}{u}\\
\end{array}
\end{array}
if t1 < -5e-108 or 4.4e11 < t1 Initial program 62.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
frac-2negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
associate-/l*N/A
lift-neg.f64N/A
frac-2negN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-/.f6499.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
Applied rewrites99.9%
Taylor expanded in u around 0
mul-1-negN/A
lower-neg.f6485.9
Applied rewrites85.9%
if -5e-108 < t1 < 4.4e11Initial program 84.1%
Taylor expanded in u around inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
unpow2N/A
associate-*r*N/A
times-fracN/A
neg-mul-1N/A
lower-*.f64N/A
lower-/.f64N/A
lower-neg.f64N/A
lower-/.f6478.6
Applied rewrites78.6%
Applied rewrites79.5%
Final simplification83.4%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -5e-108) (not (<= t1 130000000000.0))) (/ (- v) (+ u t1)) (* (- v) (/ (/ t1 u) u))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -5e-108) || !(t1 <= 130000000000.0)) {
tmp = -v / (u + t1);
} else {
tmp = -v * ((t1 / u) / 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-108)) .or. (.not. (t1 <= 130000000000.0d0))) then
tmp = -v / (u + t1)
else
tmp = -v * ((t1 / u) / u)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -5e-108) || !(t1 <= 130000000000.0)) {
tmp = -v / (u + t1);
} else {
tmp = -v * ((t1 / u) / u);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -5e-108) or not (t1 <= 130000000000.0): tmp = -v / (u + t1) else: tmp = -v * ((t1 / u) / u) return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -5e-108) || !(t1 <= 130000000000.0)) tmp = Float64(Float64(-v) / Float64(u + t1)); else tmp = Float64(Float64(-v) * Float64(Float64(t1 / u) / u)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -5e-108) || ~((t1 <= 130000000000.0))) tmp = -v / (u + t1); else tmp = -v * ((t1 / u) / u); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -5e-108], N[Not[LessEqual[t1, 130000000000.0]], $MachinePrecision]], N[((-v) / N[(u + t1), $MachinePrecision]), $MachinePrecision], N[((-v) * N[(N[(t1 / u), $MachinePrecision] / u), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -5 \cdot 10^{-108} \lor \neg \left(t1 \leq 130000000000\right):\\
\;\;\;\;\frac{-v}{u + t1}\\
\mathbf{else}:\\
\;\;\;\;\left(-v\right) \cdot \frac{\frac{t1}{u}}{u}\\
\end{array}
\end{array}
if t1 < -5e-108 or 1.3e11 < t1 Initial program 62.2%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
frac-2negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
associate-/l*N/A
lift-neg.f64N/A
frac-2negN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-/.f6499.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
Applied rewrites99.9%
Taylor expanded in u around 0
mul-1-negN/A
lower-neg.f6485.9
Applied rewrites85.9%
if -5e-108 < t1 < 1.3e11Initial program 84.1%
Taylor expanded in u around inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
unpow2N/A
associate-*r*N/A
times-fracN/A
neg-mul-1N/A
lower-*.f64N/A
lower-/.f64N/A
lower-neg.f64N/A
lower-/.f6478.6
Applied rewrites78.6%
Applied rewrites75.1%
Applied rewrites79.3%
Final simplification83.4%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -1.28e-146) (not (<= t1 130000000000.0))) (/ (- v) (+ u t1)) (* (/ t1 (* u u)) (- v))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -1.28e-146) || !(t1 <= 130000000000.0)) {
tmp = -v / (u + 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 <= (-1.28d-146)) .or. (.not. (t1 <= 130000000000.0d0))) then
tmp = -v / (u + 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 <= -1.28e-146) || !(t1 <= 130000000000.0)) {
tmp = -v / (u + t1);
} else {
tmp = (t1 / (u * u)) * -v;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -1.28e-146) or not (t1 <= 130000000000.0): tmp = -v / (u + t1) else: tmp = (t1 / (u * u)) * -v return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -1.28e-146) || !(t1 <= 130000000000.0)) tmp = Float64(Float64(-v) / Float64(u + t1)); else tmp = Float64(Float64(t1 / Float64(u * u)) * Float64(-v)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -1.28e-146) || ~((t1 <= 130000000000.0))) tmp = -v / (u + t1); else tmp = (t1 / (u * u)) * -v; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -1.28e-146], N[Not[LessEqual[t1, 130000000000.0]], $MachinePrecision]], N[((-v) / N[(u + t1), $MachinePrecision]), $MachinePrecision], N[(N[(t1 / N[(u * u), $MachinePrecision]), $MachinePrecision] * (-v)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -1.28 \cdot 10^{-146} \lor \neg \left(t1 \leq 130000000000\right):\\
\;\;\;\;\frac{-v}{u + t1}\\
\mathbf{else}:\\
\;\;\;\;\frac{t1}{u \cdot u} \cdot \left(-v\right)\\
\end{array}
\end{array}
if t1 < -1.27999999999999992e-146 or 1.3e11 < t1 Initial program 62.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
frac-2negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
associate-/l*N/A
lift-neg.f64N/A
frac-2negN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-/.f6499.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
Applied rewrites99.9%
Taylor expanded in u around 0
mul-1-negN/A
lower-neg.f6485.2
Applied rewrites85.2%
if -1.27999999999999992e-146 < t1 < 1.3e11Initial program 84.3%
Taylor expanded in u around inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
unpow2N/A
associate-*r*N/A
times-fracN/A
neg-mul-1N/A
lower-*.f64N/A
lower-/.f64N/A
lower-neg.f64N/A
lower-/.f6479.5
Applied rewrites79.5%
Applied rewrites75.8%
Applied rewrites77.4%
Final simplification82.3%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -1.28e-146) (not (<= t1 130000000000.0))) (/ (- v) (+ u t1)) (* t1 (/ v (* (- u) u)))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -1.28e-146) || !(t1 <= 130000000000.0)) {
tmp = -v / (u + t1);
} else {
tmp = t1 * (v / (-u * u));
}
return tmp;
}
real(8) function code(u, v, t1)
real(8), intent (in) :: u
real(8), intent (in) :: v
real(8), intent (in) :: t1
real(8) :: tmp
if ((t1 <= (-1.28d-146)) .or. (.not. (t1 <= 130000000000.0d0))) then
tmp = -v / (u + t1)
else
tmp = t1 * (v / (-u * u))
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -1.28e-146) || !(t1 <= 130000000000.0)) {
tmp = -v / (u + t1);
} else {
tmp = t1 * (v / (-u * u));
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -1.28e-146) or not (t1 <= 130000000000.0): tmp = -v / (u + t1) else: tmp = t1 * (v / (-u * u)) return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -1.28e-146) || !(t1 <= 130000000000.0)) tmp = Float64(Float64(-v) / Float64(u + t1)); else tmp = Float64(t1 * Float64(v / Float64(Float64(-u) * u))); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -1.28e-146) || ~((t1 <= 130000000000.0))) tmp = -v / (u + t1); else tmp = t1 * (v / (-u * u)); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -1.28e-146], N[Not[LessEqual[t1, 130000000000.0]], $MachinePrecision]], N[((-v) / N[(u + t1), $MachinePrecision]), $MachinePrecision], N[(t1 * N[(v / N[((-u) * u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -1.28 \cdot 10^{-146} \lor \neg \left(t1 \leq 130000000000\right):\\
\;\;\;\;\frac{-v}{u + t1}\\
\mathbf{else}:\\
\;\;\;\;t1 \cdot \frac{v}{\left(-u\right) \cdot u}\\
\end{array}
\end{array}
if t1 < -1.27999999999999992e-146 or 1.3e11 < t1 Initial program 62.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
frac-2negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
associate-/l*N/A
lift-neg.f64N/A
frac-2negN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-/.f6499.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
Applied rewrites99.9%
Taylor expanded in u around 0
mul-1-negN/A
lower-neg.f6485.2
Applied rewrites85.2%
if -1.27999999999999992e-146 < t1 < 1.3e11Initial program 84.3%
Taylor expanded in u around inf
mul-1-negN/A
distribute-neg-frac2N/A
mul-1-negN/A
unpow2N/A
associate-*r*N/A
times-fracN/A
neg-mul-1N/A
lower-*.f64N/A
lower-/.f64N/A
lower-neg.f64N/A
lower-/.f6479.5
Applied rewrites79.5%
Applied rewrites75.1%
Final simplification81.4%
(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(Float64(-v) / 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}{u + t1}
\end{array}
Initial program 70.8%
lift-/.f64N/A
lift-*.f64N/A
associate-/r*N/A
lower-/.f64N/A
frac-2negN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
associate-/l*N/A
lift-neg.f64N/A
frac-2negN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-/.f6497.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6497.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6497.8
Applied rewrites97.8%
Taylor expanded in u around 0
mul-1-negN/A
lower-neg.f6469.6
Applied rewrites69.6%
(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(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.8%
Taylor expanded in u around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6461.2
Applied rewrites61.2%
herbie shell --seed 2024307
(FPCore (u v t1)
:name "Rosa's DopplerBench"
:precision binary64
(/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))