| Alternative 1 | |
|---|---|
| Error | 16.1 |
| Cost | 777 |
\[\begin{array}{l}
\mathbf{if}\;t1 \leq -0.0023 \lor \neg \left(t1 \leq 1.8 \cdot 10^{-61}\right):\\
\;\;\;\;\frac{-v}{t1 + u}\\
\mathbf{else}:\\
\;\;\;\;t1 \cdot \frac{-v}{u \cdot u}\\
\end{array}
\]
(FPCore (u v t1) :precision binary64 (/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))
(FPCore (u v t1) :precision binary64 (if (or (<= t1 -3e-265) (not (<= t1 -1.9e-298))) (/ (/ v (+ t1 u)) (- -1.0 (/ u t1))) (/ (* t1 (- v)) (* u u))))
double code(double u, double v, double t1) {
return (-t1 * v) / ((t1 + u) * (t1 + u));
}
double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -3e-265) || !(t1 <= -1.9e-298)) {
tmp = (v / (t1 + u)) / (-1.0 - (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
code = (-t1 * v) / ((t1 + u) * (t1 + u))
end function
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 <= (-3d-265)) .or. (.not. (t1 <= (-1.9d-298)))) then
tmp = (v / (t1 + u)) / ((-1.0d0) - (u / t1))
else
tmp = (t1 * -v) / (u * u)
end if
code = tmp
end function
public static double code(double u, double v, double t1) {
return (-t1 * v) / ((t1 + u) * (t1 + u));
}
public static double code(double u, double v, double t1) {
double tmp;
if ((t1 <= -3e-265) || !(t1 <= -1.9e-298)) {
tmp = (v / (t1 + u)) / (-1.0 - (u / t1));
} else {
tmp = (t1 * -v) / (u * u);
}
return tmp;
}
def code(u, v, t1): return (-t1 * v) / ((t1 + u) * (t1 + u))
def code(u, v, t1): tmp = 0 if (t1 <= -3e-265) or not (t1 <= -1.9e-298): tmp = (v / (t1 + u)) / (-1.0 - (u / t1)) else: tmp = (t1 * -v) / (u * u) return tmp
function code(u, v, t1) return Float64(Float64(Float64(-t1) * v) / Float64(Float64(t1 + u) * Float64(t1 + u))) end
function code(u, v, t1) tmp = 0.0 if ((t1 <= -3e-265) || !(t1 <= -1.9e-298)) tmp = Float64(Float64(v / Float64(t1 + u)) / Float64(-1.0 - Float64(u / t1))); else tmp = Float64(Float64(t1 * Float64(-v)) / Float64(u * u)); end return tmp end
function tmp = code(u, v, t1) tmp = (-t1 * v) / ((t1 + u) * (t1 + u)); end
function tmp_2 = code(u, v, t1) tmp = 0.0; if ((t1 <= -3e-265) || ~((t1 <= -1.9e-298))) tmp = (v / (t1 + u)) / (-1.0 - (u / t1)); else tmp = (t1 * -v) / (u * u); end tmp_2 = tmp; end
code[u_, v_, t1_] := N[(N[((-t1) * v), $MachinePrecision] / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[u_, v_, t1_] := If[Or[LessEqual[t1, -3e-265], N[Not[LessEqual[t1, -1.9e-298]], $MachinePrecision]], N[(N[(v / N[(t1 + u), $MachinePrecision]), $MachinePrecision] / N[(-1.0 - N[(u / t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t1 * (-v)), $MachinePrecision] / N[(u * u), $MachinePrecision]), $MachinePrecision]]
\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}
\begin{array}{l}
\mathbf{if}\;t1 \leq -3 \cdot 10^{-265} \lor \neg \left(t1 \leq -1.9 \cdot 10^{-298}\right):\\
\;\;\;\;\frac{\frac{v}{t1 + u}}{-1 - \frac{u}{t1}}\\
\mathbf{else}:\\
\;\;\;\;\frac{t1 \cdot \left(-v\right)}{u \cdot u}\\
\end{array}
Results
if t1 < -2.9999999999999998e-265 or -1.9e-298 < t1 Initial program 17.8
Simplified1.4
[Start]17.8 | \[ \frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}
\] |
|---|---|
*-commutative [=>]17.8 | \[ \frac{\color{blue}{v \cdot \left(-t1\right)}}{\left(t1 + u\right) \cdot \left(t1 + u\right)}
\] |
associate-/l* [=>]15.6 | \[ \color{blue}{\frac{v}{\frac{\left(t1 + u\right) \cdot \left(t1 + u\right)}{-t1}}}
\] |
associate-*r/ [<=]3.6 | \[ \frac{v}{\color{blue}{\left(t1 + u\right) \cdot \frac{t1 + u}{-t1}}}
\] |
associate-/r* [=>]1.4 | \[ \color{blue}{\frac{\frac{v}{t1 + u}}{\frac{t1 + u}{-t1}}}
\] |
neg-mul-1 [=>]1.4 | \[ \frac{\frac{v}{t1 + u}}{\frac{t1 + u}{\color{blue}{-1 \cdot t1}}}
\] |
associate-/l/ [<=]1.4 | \[ \frac{\frac{v}{t1 + u}}{\color{blue}{\frac{\frac{t1 + u}{t1}}{-1}}}
\] |
metadata-eval [<=]1.4 | \[ \frac{\frac{v}{t1 + u}}{\frac{\frac{t1 + u}{t1}}{\color{blue}{0 - 1}}}
\] |
mul0-lft [<=]8.7 | \[ \frac{\frac{v}{t1 + u}}{\frac{\frac{t1 + u}{t1}}{\color{blue}{0 \cdot \frac{t1 + u}{t1}} - 1}}
\] |
associate-*r/ [=>]1.4 | \[ \frac{\frac{v}{t1 + u}}{\frac{\frac{t1 + u}{t1}}{\color{blue}{\frac{0 \cdot \left(t1 + u\right)}{t1}} - 1}}
\] |
mul0-lft [=>]1.4 | \[ \frac{\frac{v}{t1 + u}}{\frac{\frac{t1 + u}{t1}}{\frac{\color{blue}{0}}{t1} - 1}}
\] |
*-inverses [<=]1.4 | \[ \frac{\frac{v}{t1 + u}}{\frac{\frac{t1 + u}{t1}}{\frac{0}{t1} - \color{blue}{\frac{t1}{t1}}}}
\] |
div-sub [<=]1.4 | \[ \frac{\frac{v}{t1 + u}}{\frac{\frac{t1 + u}{t1}}{\color{blue}{\frac{0 - t1}{t1}}}}
\] |
neg-sub0 [<=]1.4 | \[ \frac{\frac{v}{t1 + u}}{\frac{\frac{t1 + u}{t1}}{\frac{\color{blue}{-t1}}{t1}}}
\] |
neg-mul-1 [=>]1.4 | \[ \frac{\frac{v}{t1 + u}}{\frac{\frac{t1 + u}{t1}}{\frac{\color{blue}{-1 \cdot t1}}{t1}}}
\] |
*-commutative [=>]1.4 | \[ \frac{\frac{v}{t1 + u}}{\frac{\frac{t1 + u}{t1}}{\frac{\color{blue}{t1 \cdot -1}}{t1}}}
\] |
associate-/l* [=>]1.4 | \[ \frac{\frac{v}{t1 + u}}{\frac{\frac{t1 + u}{t1}}{\color{blue}{\frac{t1}{\frac{t1}{-1}}}}}
\] |
associate-/l* [<=]1.4 | \[ \frac{\frac{v}{t1 + u}}{\color{blue}{\frac{\frac{t1 + u}{t1} \cdot \frac{t1}{-1}}{t1}}}
\] |
*-commutative [=>]1.4 | \[ \frac{\frac{v}{t1 + u}}{\frac{\color{blue}{\frac{t1}{-1} \cdot \frac{t1 + u}{t1}}}{t1}}
\] |
times-frac [<=]15.4 | \[ \frac{\frac{v}{t1 + u}}{\frac{\color{blue}{\frac{t1 \cdot \left(t1 + u\right)}{-1 \cdot t1}}}{t1}}
\] |
neg-mul-1 [<=]15.4 | \[ \frac{\frac{v}{t1 + u}}{\frac{\frac{t1 \cdot \left(t1 + u\right)}{\color{blue}{-t1}}}{t1}}
\] |
associate-/l* [=>]1.5 | \[ \frac{\frac{v}{t1 + u}}{\frac{\color{blue}{\frac{t1}{\frac{-t1}{t1 + u}}}}{t1}}
\] |
if -2.9999999999999998e-265 < t1 < -1.9e-298Initial program 19.4
Taylor expanded in t1 around 0 19.4
Simplified19.4
[Start]19.4 | \[ \frac{\left(-t1\right) \cdot v}{{u}^{2}}
\] |
|---|---|
unpow2 [=>]19.4 | \[ \frac{\left(-t1\right) \cdot v}{\color{blue}{u \cdot u}}
\] |
Final simplification1.9
| Alternative 1 | |
|---|---|
| Error | 16.1 |
| Cost | 777 |
| Alternative 2 | |
|---|---|
| Error | 14.6 |
| Cost | 777 |
| Alternative 3 | |
|---|---|
| Error | 14.5 |
| Cost | 777 |
| Alternative 4 | |
|---|---|
| Error | 13.9 |
| Cost | 777 |
| Alternative 5 | |
|---|---|
| Error | 13.7 |
| Cost | 777 |
| Alternative 6 | |
|---|---|
| Error | 1.5 |
| Cost | 768 |
| Alternative 7 | |
|---|---|
| Error | 21.8 |
| Cost | 713 |
| Alternative 8 | |
|---|---|
| Error | 21.5 |
| Cost | 712 |
| Alternative 9 | |
|---|---|
| Error | 3.6 |
| Cost | 704 |
| Alternative 10 | |
|---|---|
| Error | 3.6 |
| Cost | 704 |
| Alternative 11 | |
|---|---|
| Error | 28.8 |
| Cost | 521 |
| Alternative 12 | |
|---|---|
| Error | 26.2 |
| Cost | 384 |
| Alternative 13 | |
|---|---|
| Error | 32.0 |
| Cost | 256 |
herbie shell --seed 2023073
(FPCore (u v t1)
:name "Rosa's DopplerBench"
:precision binary64
(/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))