?

Average Error: 18.0 → 8.1
Time: 20.8s
Precision: binary64
Cost: 1032

?

\[\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
\[\begin{array}{l} t_1 := \frac{-v}{t1}\\ \mathbf{if}\;t1 \leq -2.9 \cdot 10^{+180}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t1 \leq 3.35 \cdot 10^{+155}:\\ \;\;\;\;\left(-v\right) \cdot \frac{t1}{\left(t1 + u\right) \cdot \left(t1 + u\right)}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
(FPCore (u v t1) :precision binary64 (/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))
(FPCore (u v t1)
 :precision binary64
 (let* ((t_1 (/ (- v) t1)))
   (if (<= t1 -2.9e+180)
     t_1
     (if (<= t1 3.35e+155) (* (- v) (/ t1 (* (+ t1 u) (+ t1 u)))) t_1))))
double code(double u, double v, double t1) {
	return (-t1 * v) / ((t1 + u) * (t1 + u));
}
double code(double u, double v, double t1) {
	double t_1 = -v / t1;
	double tmp;
	if (t1 <= -2.9e+180) {
		tmp = t_1;
	} else if (t1 <= 3.35e+155) {
		tmp = -v * (t1 / ((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
    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) :: t_1
    real(8) :: tmp
    t_1 = -v / t1
    if (t1 <= (-2.9d+180)) then
        tmp = t_1
    else if (t1 <= 3.35d+155) then
        tmp = -v * (t1 / ((t1 + u) * (t1 + u)))
    else
        tmp = t_1
    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 t_1 = -v / t1;
	double tmp;
	if (t1 <= -2.9e+180) {
		tmp = t_1;
	} else if (t1 <= 3.35e+155) {
		tmp = -v * (t1 / ((t1 + u) * (t1 + u)));
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(u, v, t1):
	return (-t1 * v) / ((t1 + u) * (t1 + u))
def code(u, v, t1):
	t_1 = -v / t1
	tmp = 0
	if t1 <= -2.9e+180:
		tmp = t_1
	elif t1 <= 3.35e+155:
		tmp = -v * (t1 / ((t1 + u) * (t1 + u)))
	else:
		tmp = t_1
	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)
	t_1 = Float64(Float64(-v) / t1)
	tmp = 0.0
	if (t1 <= -2.9e+180)
		tmp = t_1;
	elseif (t1 <= 3.35e+155)
		tmp = Float64(Float64(-v) * Float64(t1 / Float64(Float64(t1 + u) * Float64(t1 + u))));
	else
		tmp = t_1;
	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)
	t_1 = -v / t1;
	tmp = 0.0;
	if (t1 <= -2.9e+180)
		tmp = t_1;
	elseif (t1 <= 3.35e+155)
		tmp = -v * (t1 / ((t1 + u) * (t1 + u)));
	else
		tmp = t_1;
	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_] := Block[{t$95$1 = N[((-v) / t1), $MachinePrecision]}, If[LessEqual[t1, -2.9e+180], t$95$1, If[LessEqual[t1, 3.35e+155], N[((-v) * N[(t1 / N[(N[(t1 + u), $MachinePrecision] * N[(t1 + u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}
\begin{array}{l}
t_1 := \frac{-v}{t1}\\
\mathbf{if}\;t1 \leq -2.9 \cdot 10^{+180}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;t1 \leq 3.35 \cdot 10^{+155}:\\
\;\;\;\;\left(-v\right) \cdot \frac{t1}{\left(t1 + u\right) \cdot \left(t1 + u\right)}\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Split input into 2 regimes
  2. if t1 < -2.90000000000000007e180 or 3.35e155 < t1

    1. Initial program 38.6

      \[\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
    2. Taylor expanded in t1 around inf 4.5

      \[\leadsto \color{blue}{-1 \cdot \frac{v}{t1}} \]
    3. Simplified4.5

      \[\leadsto \color{blue}{\frac{-v}{t1}} \]
      Proof

      [Start]4.5

      \[ -1 \cdot \frac{v}{t1} \]

      rational_best-simplify-47 [<=]4.5

      \[ \color{blue}{\frac{v \cdot -1}{t1}} \]

      rational_best-simplify-13 [<=]4.5

      \[ \frac{\color{blue}{-v}}{t1} \]

    if -2.90000000000000007e180 < t1 < 3.35e155

    1. Initial program 11.6

      \[\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
    2. Simplified9.3

      \[\leadsto \color{blue}{\left(-v\right) \cdot \frac{t1}{\left(t1 + u\right) \cdot \left(t1 + u\right)}} \]
      Proof

      [Start]11.6

      \[ \frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]

      rational_best-simplify-2 [=>]11.6

      \[ \frac{\color{blue}{v \cdot \left(-t1\right)}}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]

      rational_best-simplify-13 [=>]11.6

      \[ \frac{v \cdot \color{blue}{\left(t1 \cdot -1\right)}}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]

      rational_best-simplify-44 [=>]11.6

      \[ \frac{\color{blue}{t1 \cdot \left(v \cdot -1\right)}}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]

      rational_best-simplify-47 [=>]9.3

      \[ \color{blue}{\left(v \cdot -1\right) \cdot \frac{t1}{\left(t1 + u\right) \cdot \left(t1 + u\right)}} \]

      rational_best-simplify-12 [=>]9.3

      \[ \color{blue}{\left(-v\right)} \cdot \frac{t1}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification8.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;t1 \leq -2.9 \cdot 10^{+180}:\\ \;\;\;\;\frac{-v}{t1}\\ \mathbf{elif}\;t1 \leq 3.35 \cdot 10^{+155}:\\ \;\;\;\;\left(-v\right) \cdot \frac{t1}{\left(t1 + u\right) \cdot \left(t1 + u\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{-v}{t1}\\ \end{array} \]

Alternatives

Alternative 1
Error9.3
Cost1032
\[\begin{array}{l} t_1 := \frac{-v}{t1}\\ \mathbf{if}\;t1 \leq -3.7 \cdot 10^{+96}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t1 \leq 3.35 \cdot 10^{+155}:\\ \;\;\;\;\left(-t1\right) \cdot \frac{v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 2
Error27.9
Cost776
\[\begin{array}{l} t_1 := \left(1 + \frac{v}{-t1}\right) - 1\\ \mathbf{if}\;u \leq -3.6 \cdot 10^{+38}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;u \leq 1.02 \cdot 10^{+161}:\\ \;\;\;\;\frac{-v}{t1}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 3
Error30.5
Cost256
\[\frac{-v}{t1} \]

Error

Reproduce?

herbie shell --seed 2023096 
(FPCore (u v t1)
  :name "Rosa's DopplerBench"
  :precision binary64
  (/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))