
(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 8 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)) (/ t1 (- (- u) t1))))
double code(double u, double v, double t1) {
return (v / (u + t1)) * (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 / (u + t1)) * (t1 / (-u - t1))
end function
public static double code(double u, double v, double t1) {
return (v / (u + t1)) * (t1 / (-u - t1));
}
def code(u, v, t1): return (v / (u + t1)) * (t1 / (-u - t1))
function code(u, v, t1) return Float64(Float64(v / Float64(u + t1)) * Float64(t1 / Float64(Float64(-u) - t1))) end
function tmp = code(u, v, t1) tmp = (v / (u + t1)) * (t1 / (-u - t1)); end
code[u_, v_, t1_] := N[(N[(v / N[(u + t1), $MachinePrecision]), $MachinePrecision] * N[(t1 / N[((-u) - t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{v}{u + t1} \cdot \frac{t1}{\left(-u\right) - t1}
\end{array}
Initial program 69.5%
lift-/.f64N/A
frac-2negN/A
lift-*.f64N/A
distribute-rgt-neg-inN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
times-fracN/A
lift-neg.f64N/A
frac-2negN/A
lower-*.f64N/A
lower-/.f64N/A
lower-neg.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f6498.6
lift-+.f64N/A
+-commutativeN/A
lower-+.f6498.6
Applied rewrites98.6%
Final simplification98.6%
(FPCore (u v t1)
:precision binary64
(if (<= t1 -4.5e+70)
(/ (- v) (+ t1 u))
(if (<= t1 1.35e+134)
(* v (/ (- t1) (* (+ t1 u) (+ t1 u))))
(/ (* (- (/ u t1) 1.0) v) (+ t1 u)))))
double code(double u, double v, double t1) {
double tmp;
if (t1 <= -4.5e+70) {
tmp = -v / (t1 + u);
} else if (t1 <= 1.35e+134) {
tmp = v * (-t1 / ((t1 + u) * (t1 + u)));
} else {
tmp = (((u / t1) - 1.0) * v) / (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 <= (-4.5d+70)) then
tmp = -v / (t1 + u)
else if (t1 <= 1.35d+134) then
tmp = v * (-t1 / ((t1 + u) * (t1 + u)))
else
tmp = (((u / t1) - 1.0d0) * v) / (t1 + u)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if (t1 <= -4.5e+70) {
tmp = -v / (t1 + u);
} else if (t1 <= 1.35e+134) {
tmp = v * (-t1 / ((t1 + u) * (t1 + u)));
} else {
tmp = (((u / t1) - 1.0) * v) / (t1 + u);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if t1 <= -4.5e+70: tmp = -v / (t1 + u) elif t1 <= 1.35e+134: tmp = v * (-t1 / ((t1 + u) * (t1 + u))) else: tmp = (((u / t1) - 1.0) * v) / (t1 + u) return tmp
function code(u, v, t1) tmp = 0.0 if (t1 <= -4.5e+70) tmp = Float64(Float64(-v) / Float64(t1 + u)); elseif (t1 <= 1.35e+134) tmp = Float64(v * Float64(Float64(-t1) / Float64(Float64(t1 + u) * Float64(t1 + u)))); else tmp = Float64(Float64(Float64(Float64(u / t1) - 1.0) * v) / Float64(t1 + u)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (t1 <= -4.5e+70) tmp = -v / (t1 + u); elseif (t1 <= 1.35e+134) tmp = v * (-t1 / ((t1 + u) * (t1 + u))); else tmp = (((u / t1) - 1.0) * v) / (t1 + u); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[t1, -4.5e+70], N[((-v) / N[(t1 + u), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, 1.35e+134], N[(v * N[((-t1) / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(u / t1), $MachinePrecision] - 1.0), $MachinePrecision] * v), $MachinePrecision] / N[(t1 + u), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -4.5 \cdot 10^{+70}:\\
\;\;\;\;\frac{-v}{t1 + u}\\
\mathbf{elif}\;t1 \leq 1.35 \cdot 10^{+134}:\\
\;\;\;\;v \cdot \frac{-t1}{\left(t1 + u\right) \cdot \left(t1 + u\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\frac{u}{t1} - 1\right) \cdot v}{t1 + u}\\
\end{array}
\end{array}
if t1 < -4.4999999999999999e70Initial program 47.3%
lift-/.f64N/A
frac-2negN/A
lift-*.f64N/A
distribute-rgt-neg-inN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
times-fracN/A
lift-neg.f64N/A
frac-2negN/A
lower-*.f64N/A
lower-/.f64N/A
lower-neg.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64100.0
lift-+.f64N/A
+-commutativeN/A
lower-+.f64100.0
Applied rewrites100.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites100.0%
Taylor expanded in u around 0
mul-1-negN/A
lower-neg.f6498.0
Applied rewrites98.0%
if -4.4999999999999999e70 < t1 < 1.35e134Initial program 83.2%
lift-/.f64N/A
frac-2negN/A
lift-*.f64N/A
distribute-rgt-neg-inN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
times-fracN/A
lift-neg.f64N/A
frac-2negN/A
lower-*.f64N/A
lower-/.f64N/A
lower-neg.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f6497.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6497.9
Applied rewrites97.9%
Taylor expanded in t1 around inf
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-/.f6497.9
Applied rewrites97.9%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-*.f64N/A
lift-+.f6488.6
Applied rewrites88.6%
if 1.35e134 < t1 Initial program 30.8%
lift-/.f64N/A
frac-2negN/A
lift-*.f64N/A
distribute-rgt-neg-inN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
times-fracN/A
lift-neg.f64N/A
frac-2negN/A
lower-*.f64N/A
lower-/.f64N/A
lower-neg.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64100.0
lift-+.f64N/A
+-commutativeN/A
lower-+.f64100.0
Applied rewrites100.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites99.9%
Taylor expanded in u around 0
lower--.f64N/A
lower-/.f6494.3
Applied rewrites94.3%
Final simplification91.1%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -4.5e+70) (not (<= t1 1.55e+120))) (/ (- v) (+ t1 u)) (* v (/ (- t1) (* (+ t1 u) (+ t1 u))))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -4.5e+70) || !(t1 <= 1.55e+120)) {
tmp = -v / (t1 + u);
} else {
tmp = v * (-t1 / ((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 <= (-4.5d+70)) .or. (.not. (t1 <= 1.55d+120))) then
tmp = -v / (t1 + u)
else
tmp = v * (-t1 / ((t1 + u) * (t1 + u)))
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -4.5e+70) || !(t1 <= 1.55e+120)) {
tmp = -v / (t1 + u);
} else {
tmp = v * (-t1 / ((t1 + u) * (t1 + u)));
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -4.5e+70) or not (t1 <= 1.55e+120): tmp = -v / (t1 + u) else: tmp = v * (-t1 / ((t1 + u) * (t1 + u))) return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -4.5e+70) || !(t1 <= 1.55e+120)) tmp = Float64(Float64(-v) / Float64(t1 + u)); else tmp = Float64(v * Float64(Float64(-t1) / Float64(Float64(t1 + u) * Float64(t1 + u)))); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -4.5e+70) || ~((t1 <= 1.55e+120))) tmp = -v / (t1 + u); else tmp = v * (-t1 / ((t1 + u) * (t1 + u))); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -4.5e+70], N[Not[LessEqual[t1, 1.55e+120]], $MachinePrecision]], N[((-v) / N[(t1 + u), $MachinePrecision]), $MachinePrecision], N[(v * N[((-t1) / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -4.5 \cdot 10^{+70} \lor \neg \left(t1 \leq 1.55 \cdot 10^{+120}\right):\\
\;\;\;\;\frac{-v}{t1 + u}\\
\mathbf{else}:\\
\;\;\;\;v \cdot \frac{-t1}{\left(t1 + u\right) \cdot \left(t1 + u\right)}\\
\end{array}
\end{array}
if t1 < -4.4999999999999999e70 or 1.54999999999999987e120 < t1 Initial program 43.4%
lift-/.f64N/A
frac-2negN/A
lift-*.f64N/A
distribute-rgt-neg-inN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
times-fracN/A
lift-neg.f64N/A
frac-2negN/A
lower-*.f64N/A
lower-/.f64N/A
lower-neg.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64100.0
lift-+.f64N/A
+-commutativeN/A
lower-+.f64100.0
Applied rewrites100.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites100.0%
Taylor expanded in u around 0
mul-1-negN/A
lower-neg.f6495.6
Applied rewrites95.6%
if -4.4999999999999999e70 < t1 < 1.54999999999999987e120Initial program 83.2%
lift-/.f64N/A
frac-2negN/A
lift-*.f64N/A
distribute-rgt-neg-inN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
times-fracN/A
lift-neg.f64N/A
frac-2negN/A
lower-*.f64N/A
lower-/.f64N/A
lower-neg.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f6497.8
lift-+.f64N/A
+-commutativeN/A
lower-+.f6497.8
Applied rewrites97.8%
Taylor expanded in t1 around inf
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
lower-fma.f64N/A
lower-/.f6497.8
Applied rewrites97.8%
lift-*.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-timesN/A
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-*.f64N/A
lift-+.f6488.7
Applied rewrites88.8%
Final simplification91.1%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -1.9e-62) (not (<= t1 8e+14))) (/ (- v) (+ t1 u)) (/ (* (/ (- v) u) t1) u)))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -1.9e-62) || !(t1 <= 8e+14)) {
tmp = -v / (t1 + u);
} 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 <= (-1.9d-62)) .or. (.not. (t1 <= 8d+14))) then
tmp = -v / (t1 + u)
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 <= -1.9e-62) || !(t1 <= 8e+14)) {
tmp = -v / (t1 + u);
} else {
tmp = ((-v / u) * t1) / u;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -1.9e-62) or not (t1 <= 8e+14): tmp = -v / (t1 + u) else: tmp = ((-v / u) * t1) / u return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -1.9e-62) || !(t1 <= 8e+14)) tmp = Float64(Float64(-v) / Float64(t1 + u)); else tmp = Float64(Float64(Float64(Float64(-v) / u) * t1) / u); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -1.9e-62) || ~((t1 <= 8e+14))) tmp = -v / (t1 + u); else tmp = ((-v / u) * t1) / u; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -1.9e-62], N[Not[LessEqual[t1, 8e+14]], $MachinePrecision]], N[((-v) / N[(t1 + u), $MachinePrecision]), $MachinePrecision], N[(N[(N[((-v) / u), $MachinePrecision] * t1), $MachinePrecision] / u), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -1.9 \cdot 10^{-62} \lor \neg \left(t1 \leq 8 \cdot 10^{+14}\right):\\
\;\;\;\;\frac{-v}{t1 + u}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{-v}{u} \cdot t1}{u}\\
\end{array}
\end{array}
if t1 < -1.90000000000000003e-62 or 8e14 < t1 Initial program 60.6%
lift-/.f64N/A
frac-2negN/A
lift-*.f64N/A
distribute-rgt-neg-inN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
times-fracN/A
lift-neg.f64N/A
frac-2negN/A
lower-*.f64N/A
lower-/.f64N/A
lower-neg.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64100.0
lift-+.f64N/A
+-commutativeN/A
lower-+.f64100.0
Applied rewrites100.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites99.9%
Taylor expanded in u around 0
mul-1-negN/A
lower-neg.f6490.3
Applied rewrites90.3%
if -1.90000000000000003e-62 < t1 < 8e14Initial program 79.8%
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-/.f6480.8
Applied rewrites80.8%
Applied rewrites79.7%
Applied rewrites82.0%
Final simplification86.4%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -1.9e-62) (not (<= t1 8e+14))) (/ (- v) (+ t1 u)) (* (/ t1 u) (/ (- v) u))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -1.9e-62) || !(t1 <= 8e+14)) {
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 <= (-1.9d-62)) .or. (.not. (t1 <= 8d+14))) 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 <= -1.9e-62) || !(t1 <= 8e+14)) {
tmp = -v / (t1 + u);
} else {
tmp = (t1 / u) * (-v / u);
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -1.9e-62) or not (t1 <= 8e+14): tmp = -v / (t1 + u) else: tmp = (t1 / u) * (-v / u) return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -1.9e-62) || !(t1 <= 8e+14)) tmp = Float64(Float64(-v) / Float64(t1 + u)); else tmp = Float64(Float64(t1 / u) * Float64(Float64(-v) / u)); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -1.9e-62) || ~((t1 <= 8e+14))) tmp = -v / (t1 + u); else tmp = (t1 / u) * (-v / u); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -1.9e-62], N[Not[LessEqual[t1, 8e+14]], $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 -1.9 \cdot 10^{-62} \lor \neg \left(t1 \leq 8 \cdot 10^{+14}\right):\\
\;\;\;\;\frac{-v}{t1 + u}\\
\mathbf{else}:\\
\;\;\;\;\frac{t1}{u} \cdot \frac{-v}{u}\\
\end{array}
\end{array}
if t1 < -1.90000000000000003e-62 or 8e14 < t1 Initial program 60.6%
lift-/.f64N/A
frac-2negN/A
lift-*.f64N/A
distribute-rgt-neg-inN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
times-fracN/A
lift-neg.f64N/A
frac-2negN/A
lower-*.f64N/A
lower-/.f64N/A
lower-neg.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64100.0
lift-+.f64N/A
+-commutativeN/A
lower-+.f64100.0
Applied rewrites100.0%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites99.9%
Taylor expanded in u around 0
mul-1-negN/A
lower-neg.f6490.3
Applied rewrites90.3%
if -1.90000000000000003e-62 < t1 < 8e14Initial program 79.8%
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-/.f6480.8
Applied rewrites80.8%
Final simplification85.9%
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -1e-63) (not (<= t1 5.5e-136))) (/ (- v) (+ t1 u)) (* t1 (/ v (* (- u) u)))))
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -1e-63) || !(t1 <= 5.5e-136)) {
tmp = -v / (t1 + u);
} 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 <= (-1d-63)) .or. (.not. (t1 <= 5.5d-136))) then
tmp = -v / (t1 + u)
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 <= -1e-63) || !(t1 <= 5.5e-136)) {
tmp = -v / (t1 + u);
} else {
tmp = t1 * (v / (-u * u));
}
return tmp;
}
def code(u, v, t1): tmp = 0 if (t1 <= -1e-63) or not (t1 <= 5.5e-136): tmp = -v / (t1 + u) else: tmp = t1 * (v / (-u * u)) return tmp
function code(u, v, t1) tmp = 0.0 if ((t1 <= -1e-63) || !(t1 <= 5.5e-136)) tmp = Float64(Float64(-v) / Float64(t1 + u)); 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 <= -1e-63) || ~((t1 <= 5.5e-136))) tmp = -v / (t1 + u); else tmp = t1 * (v / (-u * u)); end tmp_2 = tmp; end
code[u_, v_, t1_] := If[Or[LessEqual[t1, -1e-63], N[Not[LessEqual[t1, 5.5e-136]], $MachinePrecision]], N[((-v) / N[(t1 + u), $MachinePrecision]), $MachinePrecision], N[(t1 * N[(v / N[((-u) * u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -1 \cdot 10^{-63} \lor \neg \left(t1 \leq 5.5 \cdot 10^{-136}\right):\\
\;\;\;\;\frac{-v}{t1 + u}\\
\mathbf{else}:\\
\;\;\;\;t1 \cdot \frac{v}{\left(-u\right) \cdot u}\\
\end{array}
\end{array}
if t1 < -1.00000000000000007e-63 or 5.4999999999999999e-136 < t1 Initial program 63.0%
lift-/.f64N/A
frac-2negN/A
lift-*.f64N/A
distribute-rgt-neg-inN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
times-fracN/A
lift-neg.f64N/A
frac-2negN/A
lower-*.f64N/A
lower-/.f64N/A
lower-neg.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f6499.9
lift-+.f64N/A
+-commutativeN/A
lower-+.f6499.9
Applied rewrites99.9%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites99.9%
Taylor expanded in u around 0
mul-1-negN/A
lower-neg.f6486.1
Applied rewrites86.1%
if -1.00000000000000007e-63 < t1 < 5.4999999999999999e-136Initial program 79.8%
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-/.f6485.5
Applied rewrites85.5%
Applied rewrites80.9%
Final simplification84.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 69.5%
lift-/.f64N/A
frac-2negN/A
lift-*.f64N/A
distribute-rgt-neg-inN/A
lift-*.f64N/A
*-commutativeN/A
distribute-lft-neg-inN/A
times-fracN/A
lift-neg.f64N/A
frac-2negN/A
lower-*.f64N/A
lower-/.f64N/A
lower-neg.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f6498.6
lift-+.f64N/A
+-commutativeN/A
lower-+.f6498.6
Applied rewrites98.6%
lift-*.f64N/A
lift-/.f64N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites98.6%
Taylor expanded in u around 0
mul-1-negN/A
lower-neg.f6466.2
Applied rewrites66.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(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 69.5%
Taylor expanded in u around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6456.8
Applied rewrites56.8%
herbie shell --seed 2024326
(FPCore (u v t1)
:name "Rosa's DopplerBench"
:precision binary64
(/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))