
(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 10 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)) (+ t1 u)))
double code(double u, double v, double t1) {
return (-v / ((t1 + u) / t1)) / (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) / t1)) / (t1 + u)
end function
public static double code(double u, double v, double t1) {
return (-v / ((t1 + u) / t1)) / (t1 + u);
}
def code(u, v, t1): return (-v / ((t1 + u) / t1)) / (t1 + u)
function code(u, v, t1) return Float64(Float64(Float64(-v) / Float64(Float64(t1 + u) / t1)) / Float64(t1 + u)) end
function tmp = code(u, v, t1) tmp = (-v / ((t1 + u) / t1)) / (t1 + u); end
code[u_, v_, t1_] := N[(N[((-v) / N[(N[(t1 + u), $MachinePrecision] / t1), $MachinePrecision]), $MachinePrecision] / N[(t1 + u), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{-v}{\frac{t1 + u}{t1}}}{t1 + u}
\end{array}
Initial program 75.5%
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.7
lift-+.f64N/A
+-commutativeN/A
lower-+.f6497.7
lift-+.f64N/A
+-commutativeN/A
lower-+.f6497.7
Applied rewrites97.7%
lift-*.f64N/A
lift-/.f64N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
lower-/.f6497.7
Applied rewrites97.7%
Final simplification97.7%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (/ (- v) (+ t1 u))))
(if (<= t1 -1.5e+166)
t_1
(if (<= t1 4.7e+58) (/ (- t1) (* (/ (+ t1 u) v) (+ t1 u))) t_1))))
double code(double u, double v, double t1) {
double t_1 = -v / (t1 + u);
double tmp;
if (t1 <= -1.5e+166) {
tmp = t_1;
} else if (t1 <= 4.7e+58) {
tmp = -t1 / (((t1 + u) / v) * (t1 + u));
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: tmp
t_1 = -v / (t1 + u)
if (t1 <= (-1.5d+166)) then
tmp = t_1
else if (t1 <= 4.7d+58) then
tmp = -t1 / (((t1 + u) / v) * (t1 + u))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double t_1 = -v / (t1 + u);
double tmp;
if (t1 <= -1.5e+166) {
tmp = t_1;
} else if (t1 <= 4.7e+58) {
tmp = -t1 / (((t1 + u) / v) * (t1 + u));
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = -v / (t1 + u) tmp = 0 if t1 <= -1.5e+166: tmp = t_1 elif t1 <= 4.7e+58: tmp = -t1 / (((t1 + u) / v) * (t1 + u)) else: tmp = t_1 return tmp
function code(u, v, t1) t_1 = Float64(Float64(-v) / Float64(t1 + u)) tmp = 0.0 if (t1 <= -1.5e+166) tmp = t_1; elseif (t1 <= 4.7e+58) tmp = Float64(Float64(-t1) / Float64(Float64(Float64(t1 + u) / v) * Float64(t1 + u))); else tmp = t_1; end return tmp end
function tmp_2 = code(u, v, t1) t_1 = -v / (t1 + u); tmp = 0.0; if (t1 <= -1.5e+166) tmp = t_1; elseif (t1 <= 4.7e+58) tmp = -t1 / (((t1 + u) / v) * (t1 + u)); else tmp = t_1; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[((-v) / N[(t1 + u), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t1, -1.5e+166], t$95$1, If[LessEqual[t1, 4.7e+58], N[((-t1) / N[(N[(N[(t1 + u), $MachinePrecision] / v), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-v}{t1 + u}\\
\mathbf{if}\;t1 \leq -1.5 \cdot 10^{+166}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 4.7 \cdot 10^{+58}:\\
\;\;\;\;\frac{-t1}{\frac{t1 + u}{v} \cdot \left(t1 + u\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t1 < -1.49999999999999999e166 or 4.69999999999999972e58 < t1 Initial program 53.3%
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.2
Applied rewrites92.2%
if -1.49999999999999999e166 < t1 < 4.69999999999999972e58Initial program 87.5%
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.f6491.5
lift-+.f64N/A
+-commutativeN/A
lower-+.f6491.5
Applied rewrites91.5%
Final simplification91.7%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (/ (- v) (+ t1 u))))
(if (<= t1 -2.8e+152)
t_1
(if (<= t1 1.52e+113) (/ (* (- t1) v) (* (+ t1 u) (+ t1 u))) t_1))))
double code(double u, double v, double t1) {
double t_1 = -v / (t1 + u);
double tmp;
if (t1 <= -2.8e+152) {
tmp = t_1;
} else if (t1 <= 1.52e+113) {
tmp = (-t1 * v) / ((t1 + u) * (t1 + u));
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: tmp
t_1 = -v / (t1 + u)
if (t1 <= (-2.8d+152)) then
tmp = t_1
else if (t1 <= 1.52d+113) then
tmp = (-t1 * v) / ((t1 + u) * (t1 + u))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double t_1 = -v / (t1 + u);
double tmp;
if (t1 <= -2.8e+152) {
tmp = t_1;
} else if (t1 <= 1.52e+113) {
tmp = (-t1 * v) / ((t1 + u) * (t1 + u));
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = -v / (t1 + u) tmp = 0 if t1 <= -2.8e+152: tmp = t_1 elif t1 <= 1.52e+113: tmp = (-t1 * v) / ((t1 + u) * (t1 + u)) else: tmp = t_1 return tmp
function code(u, v, t1) t_1 = Float64(Float64(-v) / Float64(t1 + u)) tmp = 0.0 if (t1 <= -2.8e+152) tmp = t_1; elseif (t1 <= 1.52e+113) tmp = Float64(Float64(Float64(-t1) * v) / Float64(Float64(t1 + u) * Float64(t1 + u))); else tmp = t_1; end return tmp end
function tmp_2 = code(u, v, t1) t_1 = -v / (t1 + u); tmp = 0.0; if (t1 <= -2.8e+152) tmp = t_1; elseif (t1 <= 1.52e+113) tmp = (-t1 * v) / ((t1 + u) * (t1 + u)); else tmp = t_1; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[((-v) / N[(t1 + u), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t1, -2.8e+152], t$95$1, If[LessEqual[t1, 1.52e+113], N[(N[((-t1) * v), $MachinePrecision] / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-v}{t1 + u}\\
\mathbf{if}\;t1 \leq -2.8 \cdot 10^{+152}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 1.52 \cdot 10^{+113}:\\
\;\;\;\;\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t1 < -2.8000000000000002e152 or 1.52000000000000003e113 < t1 Initial program 46.3%
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.f6491.4
Applied rewrites91.4%
if -2.8000000000000002e152 < t1 < 1.52000000000000003e113Initial program 89.2%
Final simplification89.9%
(FPCore (u v t1) :precision binary64 (let* ((t_1 (/ (- v) (+ t1 u)))) (if (<= t1 -1.4e-49) t_1 (if (<= t1 7000.0) (/ (* (/ (- t1) u) v) u) t_1))))
double code(double u, double v, double t1) {
double t_1 = -v / (t1 + u);
double tmp;
if (t1 <= -1.4e-49) {
tmp = t_1;
} else if (t1 <= 7000.0) {
tmp = ((-t1 / u) * v) / u;
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: tmp
t_1 = -v / (t1 + u)
if (t1 <= (-1.4d-49)) then
tmp = t_1
else if (t1 <= 7000.0d0) then
tmp = ((-t1 / u) * v) / u
else
tmp = t_1
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double t_1 = -v / (t1 + u);
double tmp;
if (t1 <= -1.4e-49) {
tmp = t_1;
} else if (t1 <= 7000.0) {
tmp = ((-t1 / u) * v) / u;
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = -v / (t1 + u) tmp = 0 if t1 <= -1.4e-49: tmp = t_1 elif t1 <= 7000.0: tmp = ((-t1 / u) * v) / u else: tmp = t_1 return tmp
function code(u, v, t1) t_1 = Float64(Float64(-v) / Float64(t1 + u)) tmp = 0.0 if (t1 <= -1.4e-49) tmp = t_1; elseif (t1 <= 7000.0) tmp = Float64(Float64(Float64(Float64(-t1) / u) * v) / u); else tmp = t_1; end return tmp end
function tmp_2 = code(u, v, t1) t_1 = -v / (t1 + u); tmp = 0.0; if (t1 <= -1.4e-49) tmp = t_1; elseif (t1 <= 7000.0) tmp = ((-t1 / u) * v) / u; else tmp = t_1; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[((-v) / N[(t1 + u), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t1, -1.4e-49], t$95$1, If[LessEqual[t1, 7000.0], N[(N[(N[((-t1) / u), $MachinePrecision] * v), $MachinePrecision] / u), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-v}{t1 + u}\\
\mathbf{if}\;t1 \leq -1.4 \cdot 10^{-49}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 7000:\\
\;\;\;\;\frac{\frac{-t1}{u} \cdot v}{u}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t1 < -1.39999999999999999e-49 or 7e3 < t1 Initial program 65.0%
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.4
Applied rewrites85.4%
if -1.39999999999999999e-49 < t1 < 7e3Initial program 89.2%
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-/.f6476.6
Applied rewrites76.6%
Applied rewrites79.2%
Final simplification82.7%
(FPCore (u v t1)
:precision binary64
(let* ((t_1 (/ (- v) (+ t1 u))))
(if (<= t1 -1.4e-49)
t_1
(if (<= t1 17.5) (* (/ -1.0 (* u u)) (* t1 v)) t_1))))
double code(double u, double v, double t1) {
double t_1 = -v / (t1 + u);
double tmp;
if (t1 <= -1.4e-49) {
tmp = t_1;
} else if (t1 <= 17.5) {
tmp = (-1.0 / (u * u)) * (t1 * v);
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: tmp
t_1 = -v / (t1 + u)
if (t1 <= (-1.4d-49)) then
tmp = t_1
else if (t1 <= 17.5d0) then
tmp = ((-1.0d0) / (u * u)) * (t1 * v)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double t_1 = -v / (t1 + u);
double tmp;
if (t1 <= -1.4e-49) {
tmp = t_1;
} else if (t1 <= 17.5) {
tmp = (-1.0 / (u * u)) * (t1 * v);
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = -v / (t1 + u) tmp = 0 if t1 <= -1.4e-49: tmp = t_1 elif t1 <= 17.5: tmp = (-1.0 / (u * u)) * (t1 * v) else: tmp = t_1 return tmp
function code(u, v, t1) t_1 = Float64(Float64(-v) / Float64(t1 + u)) tmp = 0.0 if (t1 <= -1.4e-49) tmp = t_1; elseif (t1 <= 17.5) tmp = Float64(Float64(-1.0 / Float64(u * u)) * Float64(t1 * v)); else tmp = t_1; end return tmp end
function tmp_2 = code(u, v, t1) t_1 = -v / (t1 + u); tmp = 0.0; if (t1 <= -1.4e-49) tmp = t_1; elseif (t1 <= 17.5) tmp = (-1.0 / (u * u)) * (t1 * v); else tmp = t_1; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[((-v) / N[(t1 + u), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t1, -1.4e-49], t$95$1, If[LessEqual[t1, 17.5], N[(N[(-1.0 / N[(u * u), $MachinePrecision]), $MachinePrecision] * N[(t1 * v), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-v}{t1 + u}\\
\mathbf{if}\;t1 \leq -1.4 \cdot 10^{-49}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 17.5:\\
\;\;\;\;\frac{-1}{u \cdot u} \cdot \left(t1 \cdot v\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t1 < -1.39999999999999999e-49 or 17.5 < t1 Initial program 65.0%
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.4
Applied rewrites85.4%
if -1.39999999999999999e-49 < t1 < 17.5Initial program 89.2%
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-/.f6476.6
Applied rewrites76.6%
Applied rewrites76.9%
Final simplification81.7%
(FPCore (u v t1) :precision binary64 (let* ((t_1 (/ (- v) (+ t1 u)))) (if (<= t1 -1.4e-49) t_1 (if (<= t1 17.5) (/ (* (- t1) v) (* u u)) t_1))))
double code(double u, double v, double t1) {
double t_1 = -v / (t1 + u);
double tmp;
if (t1 <= -1.4e-49) {
tmp = t_1;
} else if (t1 <= 17.5) {
tmp = (-t1 * v) / (u * u);
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: tmp
t_1 = -v / (t1 + u)
if (t1 <= (-1.4d-49)) then
tmp = t_1
else if (t1 <= 17.5d0) then
tmp = (-t1 * v) / (u * u)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double t_1 = -v / (t1 + u);
double tmp;
if (t1 <= -1.4e-49) {
tmp = t_1;
} else if (t1 <= 17.5) {
tmp = (-t1 * v) / (u * u);
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = -v / (t1 + u) tmp = 0 if t1 <= -1.4e-49: tmp = t_1 elif t1 <= 17.5: tmp = (-t1 * v) / (u * u) else: tmp = t_1 return tmp
function code(u, v, t1) t_1 = Float64(Float64(-v) / Float64(t1 + u)) tmp = 0.0 if (t1 <= -1.4e-49) tmp = t_1; elseif (t1 <= 17.5) tmp = Float64(Float64(Float64(-t1) * v) / Float64(u * u)); else tmp = t_1; end return tmp end
function tmp_2 = code(u, v, t1) t_1 = -v / (t1 + u); tmp = 0.0; if (t1 <= -1.4e-49) tmp = t_1; elseif (t1 <= 17.5) tmp = (-t1 * v) / (u * u); else tmp = t_1; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[((-v) / N[(t1 + u), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t1, -1.4e-49], t$95$1, If[LessEqual[t1, 17.5], N[(N[((-t1) * v), $MachinePrecision] / N[(u * u), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-v}{t1 + u}\\
\mathbf{if}\;t1 \leq -1.4 \cdot 10^{-49}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 17.5:\\
\;\;\;\;\frac{\left(-t1\right) \cdot v}{u \cdot u}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t1 < -1.39999999999999999e-49 or 17.5 < t1 Initial program 65.0%
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.4
Applied rewrites85.4%
if -1.39999999999999999e-49 < t1 < 17.5Initial program 89.2%
Taylor expanded in u around inf
unpow2N/A
lower-*.f6476.9
Applied rewrites76.9%
Final simplification81.7%
(FPCore (u v t1) :precision binary64 (let* ((t_1 (/ (- v) (+ t1 u)))) (if (<= t1 -1.4e-49) t_1 (if (<= t1 7000.0) (* (/ v (* (- u) u)) t1) t_1))))
double code(double u, double v, double t1) {
double t_1 = -v / (t1 + u);
double tmp;
if (t1 <= -1.4e-49) {
tmp = t_1;
} else if (t1 <= 7000.0) {
tmp = (v / (-u * u)) * t1;
} else {
tmp = t_1;
}
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) :: t_1
real(8) :: tmp
t_1 = -v / (t1 + u)
if (t1 <= (-1.4d-49)) then
tmp = t_1
else if (t1 <= 7000.0d0) then
tmp = (v / (-u * u)) * t1
else
tmp = t_1
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
double t_1 = -v / (t1 + u);
double tmp;
if (t1 <= -1.4e-49) {
tmp = t_1;
} else if (t1 <= 7000.0) {
tmp = (v / (-u * u)) * t1;
} else {
tmp = t_1;
}
return tmp;
}
def code(u, v, t1): t_1 = -v / (t1 + u) tmp = 0 if t1 <= -1.4e-49: tmp = t_1 elif t1 <= 7000.0: tmp = (v / (-u * u)) * t1 else: tmp = t_1 return tmp
function code(u, v, t1) t_1 = Float64(Float64(-v) / Float64(t1 + u)) tmp = 0.0 if (t1 <= -1.4e-49) tmp = t_1; elseif (t1 <= 7000.0) tmp = Float64(Float64(v / Float64(Float64(-u) * u)) * t1); else tmp = t_1; end return tmp end
function tmp_2 = code(u, v, t1) t_1 = -v / (t1 + u); tmp = 0.0; if (t1 <= -1.4e-49) tmp = t_1; elseif (t1 <= 7000.0) tmp = (v / (-u * u)) * t1; else tmp = t_1; end tmp_2 = tmp; end
code[u_, v_, t1_] := Block[{t$95$1 = N[((-v) / N[(t1 + u), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t1, -1.4e-49], t$95$1, If[LessEqual[t1, 7000.0], N[(N[(v / N[((-u) * u), $MachinePrecision]), $MachinePrecision] * t1), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{-v}{t1 + u}\\
\mathbf{if}\;t1 \leq -1.4 \cdot 10^{-49}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t1 \leq 7000:\\
\;\;\;\;\frac{v}{\left(-u\right) \cdot u} \cdot t1\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t1 < -1.39999999999999999e-49 or 7e3 < t1 Initial program 65.0%
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.4
Applied rewrites85.4%
if -1.39999999999999999e-49 < t1 < 7e3Initial program 89.2%
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-/.f6476.6
Applied rewrites76.6%
Applied rewrites75.5%
Final simplification81.1%
(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[(N[(t1 / N[(t1 + u), $MachinePrecision]), $MachinePrecision] * (-v)), $MachinePrecision] / N[(t1 + u), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{t1}{t1 + u} \cdot \left(-v\right)}{t1 + u}
\end{array}
Initial program 75.5%
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.7
lift-+.f64N/A
+-commutativeN/A
lower-+.f6497.7
lift-+.f64N/A
+-commutativeN/A
lower-+.f6497.7
Applied rewrites97.7%
Final simplification97.7%
(FPCore (u v t1) :precision binary64 (if (<= v 5.2e+109) (/ (- v) (+ t1 u)) (/ (- v) t1)))
double code(double u, double v, double t1) {
double tmp;
if (v <= 5.2e+109) {
tmp = -v / (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 (v <= 5.2d+109) then
tmp = -v / (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 (v <= 5.2e+109) {
tmp = -v / (t1 + u);
} else {
tmp = -v / t1;
}
return tmp;
}
def code(u, v, t1): tmp = 0 if v <= 5.2e+109: tmp = -v / (t1 + u) else: tmp = -v / t1 return tmp
function code(u, v, t1) tmp = 0.0 if (v <= 5.2e+109) tmp = Float64(Float64(-v) / Float64(t1 + u)); else tmp = Float64(Float64(-v) / t1); end return tmp end
function tmp_2 = code(u, v, t1) tmp = 0.0; if (v <= 5.2e+109) tmp = -v / (t1 + u); else tmp = -v / t1; end tmp_2 = tmp; end
code[u_, v_, t1_] := If[LessEqual[v, 5.2e+109], N[((-v) / N[(t1 + u), $MachinePrecision]), $MachinePrecision], N[((-v) / t1), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;v \leq 5.2 \cdot 10^{+109}:\\
\;\;\;\;\frac{-v}{t1 + u}\\
\mathbf{else}:\\
\;\;\;\;\frac{-v}{t1}\\
\end{array}
\end{array}
if v < 5.1999999999999997e109Initial program 79.0%
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-/.f6498.7
lift-+.f64N/A
+-commutativeN/A
lower-+.f6498.7
lift-+.f64N/A
+-commutativeN/A
lower-+.f6498.7
Applied rewrites98.7%
Taylor expanded in u around 0
mul-1-negN/A
lower-neg.f6467.0
Applied rewrites67.0%
if 5.1999999999999997e109 < v Initial program 56.7%
Taylor expanded in u around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6456.0
Applied rewrites56.0%
Final simplification65.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 75.5%
Taylor expanded in u around 0
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6458.3
Applied rewrites58.3%
herbie shell --seed 2024268
(FPCore (u v t1)
:name "Rosa's DopplerBench"
:precision binary64
(/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))