Rosa's DopplerBench

Percentage Accurate: 72.6% → 99.1%
Time: 4.3s
Alternatives: 10
Speedup: 1.0×

Specification

?
\[\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 (/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))
double code(double u, double v, double t1) {
	return (-t1 * v) / ((t1 + u) * (t1 + u));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(u, v, t1)
use fmin_fmax_functions
    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}

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 10 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 72.6% accurate, 1.0× speedup?

\[\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 (/ (* (- t1) v) (* (+ t1 u) (+ t1 u))))
double code(double u, double v, double t1) {
	return (-t1 * v) / ((t1 + u) * (t1 + u));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(u, v, t1)
use fmin_fmax_functions
    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}

Alternative 1: 99.1% accurate, 0.8× speedup?

\[\begin{array}{l} v\_m = \left|v\right| \\ v\_s = \mathsf{copysign}\left(1, v\right) \\ \begin{array}{l} t_1 := \left(-t1\right) - u\\ v\_s \cdot \begin{array}{l} \mathbf{if}\;v\_m \leq 3.4 \cdot 10^{+125}:\\ \;\;\;\;\frac{v\_m}{t\_1} \cdot \frac{t1}{u + t1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{t1}{t\_1} \cdot v\_m}{u + t1}\\ \end{array} \end{array} \end{array} \]
v\_m = (fabs.f64 v)
v\_s = (copysign.f64 #s(literal 1 binary64) v)
(FPCore (v_s u v_m t1)
 :precision binary64
 (let* ((t_1 (- (- t1) u)))
   (*
    v_s
    (if (<= v_m 3.4e+125)
      (* (/ v_m t_1) (/ t1 (+ u t1)))
      (/ (* (/ t1 t_1) v_m) (+ u t1))))))
v\_m = fabs(v);
v\_s = copysign(1.0, v);
double code(double v_s, double u, double v_m, double t1) {
	double t_1 = -t1 - u;
	double tmp;
	if (v_m <= 3.4e+125) {
		tmp = (v_m / t_1) * (t1 / (u + t1));
	} else {
		tmp = ((t1 / t_1) * v_m) / (u + t1);
	}
	return v_s * tmp;
}
v\_m =     private
v\_s =     private
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(v_s, u, v_m, t1)
use fmin_fmax_functions
    real(8), intent (in) :: v_s
    real(8), intent (in) :: u
    real(8), intent (in) :: v_m
    real(8), intent (in) :: t1
    real(8) :: t_1
    real(8) :: tmp
    t_1 = -t1 - u
    if (v_m <= 3.4d+125) then
        tmp = (v_m / t_1) * (t1 / (u + t1))
    else
        tmp = ((t1 / t_1) * v_m) / (u + t1)
    end if
    code = v_s * tmp
end function
v\_m = Math.abs(v);
v\_s = Math.copySign(1.0, v);
public static double code(double v_s, double u, double v_m, double t1) {
	double t_1 = -t1 - u;
	double tmp;
	if (v_m <= 3.4e+125) {
		tmp = (v_m / t_1) * (t1 / (u + t1));
	} else {
		tmp = ((t1 / t_1) * v_m) / (u + t1);
	}
	return v_s * tmp;
}
v\_m = math.fabs(v)
v\_s = math.copysign(1.0, v)
def code(v_s, u, v_m, t1):
	t_1 = -t1 - u
	tmp = 0
	if v_m <= 3.4e+125:
		tmp = (v_m / t_1) * (t1 / (u + t1))
	else:
		tmp = ((t1 / t_1) * v_m) / (u + t1)
	return v_s * tmp
v\_m = abs(v)
v\_s = copysign(1.0, v)
function code(v_s, u, v_m, t1)
	t_1 = Float64(Float64(-t1) - u)
	tmp = 0.0
	if (v_m <= 3.4e+125)
		tmp = Float64(Float64(v_m / t_1) * Float64(t1 / Float64(u + t1)));
	else
		tmp = Float64(Float64(Float64(t1 / t_1) * v_m) / Float64(u + t1));
	end
	return Float64(v_s * tmp)
end
v\_m = abs(v);
v\_s = sign(v) * abs(1.0);
function tmp_2 = code(v_s, u, v_m, t1)
	t_1 = -t1 - u;
	tmp = 0.0;
	if (v_m <= 3.4e+125)
		tmp = (v_m / t_1) * (t1 / (u + t1));
	else
		tmp = ((t1 / t_1) * v_m) / (u + t1);
	end
	tmp_2 = v_s * tmp;
end
v\_m = N[Abs[v], $MachinePrecision]
v\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[v]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[v$95$s_, u_, v$95$m_, t1_] := Block[{t$95$1 = N[((-t1) - u), $MachinePrecision]}, N[(v$95$s * If[LessEqual[v$95$m, 3.4e+125], N[(N[(v$95$m / t$95$1), $MachinePrecision] * N[(t1 / N[(u + t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t1 / t$95$1), $MachinePrecision] * v$95$m), $MachinePrecision] / N[(u + t1), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]]
\begin{array}{l}
v\_m = \left|v\right|
\\
v\_s = \mathsf{copysign}\left(1, v\right)

\\
\begin{array}{l}
t_1 := \left(-t1\right) - u\\
v\_s \cdot \begin{array}{l}
\mathbf{if}\;v\_m \leq 3.4 \cdot 10^{+125}:\\
\;\;\;\;\frac{v\_m}{t\_1} \cdot \frac{t1}{u + t1}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{t1}{t\_1} \cdot v\_m}{u + t1}\\


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if v < 3.3999999999999999e125

    1. Initial program 72.6%

      \[\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{\left(-t1\right) \cdot v}}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
      3. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{v \cdot \left(-t1\right)}}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
      4. lift-*.f64N/A

        \[\leadsto \frac{v \cdot \left(-t1\right)}{\color{blue}{\left(t1 + u\right) \cdot \left(t1 + u\right)}} \]
      5. sqr-neg-revN/A

        \[\leadsto \frac{v \cdot \left(-t1\right)}{\color{blue}{\left(\mathsf{neg}\left(\left(t1 + u\right)\right)\right) \cdot \left(\mathsf{neg}\left(\left(t1 + u\right)\right)\right)}} \]
      6. times-fracN/A

        \[\leadsto \color{blue}{\frac{v}{\mathsf{neg}\left(\left(t1 + u\right)\right)} \cdot \frac{-t1}{\mathsf{neg}\left(\left(t1 + u\right)\right)}} \]
      7. lower-*.f64N/A

        \[\leadsto \color{blue}{\frac{v}{\mathsf{neg}\left(\left(t1 + u\right)\right)} \cdot \frac{-t1}{\mathsf{neg}\left(\left(t1 + u\right)\right)}} \]
      8. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{v}{\mathsf{neg}\left(\left(t1 + u\right)\right)}} \cdot \frac{-t1}{\mathsf{neg}\left(\left(t1 + u\right)\right)} \]
      9. lift-+.f64N/A

        \[\leadsto \frac{v}{\mathsf{neg}\left(\color{blue}{\left(t1 + u\right)}\right)} \cdot \frac{-t1}{\mathsf{neg}\left(\left(t1 + u\right)\right)} \]
      10. distribute-neg-inN/A

        \[\leadsto \frac{v}{\color{blue}{\left(\mathsf{neg}\left(t1\right)\right) + \left(\mathsf{neg}\left(u\right)\right)}} \cdot \frac{-t1}{\mathsf{neg}\left(\left(t1 + u\right)\right)} \]
      11. lift-neg.f64N/A

        \[\leadsto \frac{v}{\color{blue}{\left(-t1\right)} + \left(\mathsf{neg}\left(u\right)\right)} \cdot \frac{-t1}{\mathsf{neg}\left(\left(t1 + u\right)\right)} \]
      12. sub-flip-reverseN/A

        \[\leadsto \frac{v}{\color{blue}{\left(-t1\right) - u}} \cdot \frac{-t1}{\mathsf{neg}\left(\left(t1 + u\right)\right)} \]
      13. lower--.f64N/A

        \[\leadsto \frac{v}{\color{blue}{\left(-t1\right) - u}} \cdot \frac{-t1}{\mathsf{neg}\left(\left(t1 + u\right)\right)} \]
      14. lift-neg.f64N/A

        \[\leadsto \frac{v}{\left(-t1\right) - u} \cdot \frac{\color{blue}{\mathsf{neg}\left(t1\right)}}{\mathsf{neg}\left(\left(t1 + u\right)\right)} \]
      15. frac-2neg-revN/A

        \[\leadsto \frac{v}{\left(-t1\right) - u} \cdot \color{blue}{\frac{t1}{t1 + u}} \]
      16. lower-/.f6498.2

        \[\leadsto \frac{v}{\left(-t1\right) - u} \cdot \color{blue}{\frac{t1}{t1 + u}} \]
      17. lift-+.f64N/A

        \[\leadsto \frac{v}{\left(-t1\right) - u} \cdot \frac{t1}{\color{blue}{t1 + u}} \]
      18. +-commutativeN/A

        \[\leadsto \frac{v}{\left(-t1\right) - u} \cdot \frac{t1}{\color{blue}{u + t1}} \]
      19. lower-+.f6498.2

        \[\leadsto \frac{v}{\left(-t1\right) - u} \cdot \frac{t1}{\color{blue}{u + t1}} \]
    3. Applied rewrites98.2%

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

    if 3.3999999999999999e125 < v

    1. Initial program 72.6%

      \[\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\left(-t1\right) \cdot v}{\color{blue}{\left(t1 + u\right) \cdot \left(t1 + u\right)}} \]
      3. associate-/r*N/A

        \[\leadsto \color{blue}{\frac{\frac{\left(-t1\right) \cdot v}{t1 + u}}{t1 + u}} \]
      4. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\frac{\left(-t1\right) \cdot v}{t1 + u}}{t1 + u}} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{\frac{\color{blue}{\left(-t1\right) \cdot v}}{t1 + u}}{t1 + u} \]
      6. associate-*l/N/A

        \[\leadsto \frac{\color{blue}{\frac{-t1}{t1 + u} \cdot v}}{t1 + u} \]
      7. lower-*.f64N/A

        \[\leadsto \frac{\color{blue}{\frac{-t1}{t1 + u} \cdot v}}{t1 + u} \]
      8. frac-2negN/A

        \[\leadsto \frac{\color{blue}{\frac{\mathsf{neg}\left(\left(-t1\right)\right)}{\mathsf{neg}\left(\left(t1 + u\right)\right)}} \cdot v}{t1 + u} \]
      9. lift-neg.f64N/A

        \[\leadsto \frac{\frac{\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(t1\right)\right)}\right)}{\mathsf{neg}\left(\left(t1 + u\right)\right)} \cdot v}{t1 + u} \]
      10. remove-double-negN/A

        \[\leadsto \frac{\frac{\color{blue}{t1}}{\mathsf{neg}\left(\left(t1 + u\right)\right)} \cdot v}{t1 + u} \]
      11. lower-/.f64N/A

        \[\leadsto \frac{\color{blue}{\frac{t1}{\mathsf{neg}\left(\left(t1 + u\right)\right)}} \cdot v}{t1 + u} \]
      12. lift-+.f64N/A

        \[\leadsto \frac{\frac{t1}{\mathsf{neg}\left(\color{blue}{\left(t1 + u\right)}\right)} \cdot v}{t1 + u} \]
      13. distribute-neg-inN/A

        \[\leadsto \frac{\frac{t1}{\color{blue}{\left(\mathsf{neg}\left(t1\right)\right) + \left(\mathsf{neg}\left(u\right)\right)}} \cdot v}{t1 + u} \]
      14. lift-neg.f64N/A

        \[\leadsto \frac{\frac{t1}{\color{blue}{\left(-t1\right)} + \left(\mathsf{neg}\left(u\right)\right)} \cdot v}{t1 + u} \]
      15. sub-flip-reverseN/A

        \[\leadsto \frac{\frac{t1}{\color{blue}{\left(-t1\right) - u}} \cdot v}{t1 + u} \]
      16. lower--.f6498.3

        \[\leadsto \frac{\frac{t1}{\color{blue}{\left(-t1\right) - u}} \cdot v}{t1 + u} \]
      17. lift-+.f64N/A

        \[\leadsto \frac{\frac{t1}{\left(-t1\right) - u} \cdot v}{\color{blue}{t1 + u}} \]
      18. +-commutativeN/A

        \[\leadsto \frac{\frac{t1}{\left(-t1\right) - u} \cdot v}{\color{blue}{u + t1}} \]
      19. lower-+.f6498.3

        \[\leadsto \frac{\frac{t1}{\left(-t1\right) - u} \cdot v}{\color{blue}{u + t1}} \]
    3. Applied rewrites98.3%

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

Alternative 2: 98.2% accurate, 1.0× speedup?

\[\begin{array}{l} v\_m = \left|v\right| \\ v\_s = \mathsf{copysign}\left(1, v\right) \\ v\_s \cdot \left(\frac{v\_m}{\left(-t1\right) - u} \cdot \frac{t1}{u + t1}\right) \end{array} \]
v\_m = (fabs.f64 v)
v\_s = (copysign.f64 #s(literal 1 binary64) v)
(FPCore (v_s u v_m t1)
 :precision binary64
 (* v_s (* (/ v_m (- (- t1) u)) (/ t1 (+ u t1)))))
v\_m = fabs(v);
v\_s = copysign(1.0, v);
double code(double v_s, double u, double v_m, double t1) {
	return v_s * ((v_m / (-t1 - u)) * (t1 / (u + t1)));
}
v\_m =     private
v\_s =     private
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(v_s, u, v_m, t1)
use fmin_fmax_functions
    real(8), intent (in) :: v_s
    real(8), intent (in) :: u
    real(8), intent (in) :: v_m
    real(8), intent (in) :: t1
    code = v_s * ((v_m / (-t1 - u)) * (t1 / (u + t1)))
end function
v\_m = Math.abs(v);
v\_s = Math.copySign(1.0, v);
public static double code(double v_s, double u, double v_m, double t1) {
	return v_s * ((v_m / (-t1 - u)) * (t1 / (u + t1)));
}
v\_m = math.fabs(v)
v\_s = math.copysign(1.0, v)
def code(v_s, u, v_m, t1):
	return v_s * ((v_m / (-t1 - u)) * (t1 / (u + t1)))
v\_m = abs(v)
v\_s = copysign(1.0, v)
function code(v_s, u, v_m, t1)
	return Float64(v_s * Float64(Float64(v_m / Float64(Float64(-t1) - u)) * Float64(t1 / Float64(u + t1))))
end
v\_m = abs(v);
v\_s = sign(v) * abs(1.0);
function tmp = code(v_s, u, v_m, t1)
	tmp = v_s * ((v_m / (-t1 - u)) * (t1 / (u + t1)));
end
v\_m = N[Abs[v], $MachinePrecision]
v\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[v]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[v$95$s_, u_, v$95$m_, t1_] := N[(v$95$s * N[(N[(v$95$m / N[((-t1) - u), $MachinePrecision]), $MachinePrecision] * N[(t1 / N[(u + t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
v\_m = \left|v\right|
\\
v\_s = \mathsf{copysign}\left(1, v\right)

\\
v\_s \cdot \left(\frac{v\_m}{\left(-t1\right) - u} \cdot \frac{t1}{u + t1}\right)
\end{array}
Derivation
  1. Initial program 72.6%

    \[\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
  2. Step-by-step derivation
    1. lift-/.f64N/A

      \[\leadsto \color{blue}{\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}} \]
    2. lift-*.f64N/A

      \[\leadsto \frac{\color{blue}{\left(-t1\right) \cdot v}}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
    3. *-commutativeN/A

      \[\leadsto \frac{\color{blue}{v \cdot \left(-t1\right)}}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
    4. lift-*.f64N/A

      \[\leadsto \frac{v \cdot \left(-t1\right)}{\color{blue}{\left(t1 + u\right) \cdot \left(t1 + u\right)}} \]
    5. sqr-neg-revN/A

      \[\leadsto \frac{v \cdot \left(-t1\right)}{\color{blue}{\left(\mathsf{neg}\left(\left(t1 + u\right)\right)\right) \cdot \left(\mathsf{neg}\left(\left(t1 + u\right)\right)\right)}} \]
    6. times-fracN/A

      \[\leadsto \color{blue}{\frac{v}{\mathsf{neg}\left(\left(t1 + u\right)\right)} \cdot \frac{-t1}{\mathsf{neg}\left(\left(t1 + u\right)\right)}} \]
    7. lower-*.f64N/A

      \[\leadsto \color{blue}{\frac{v}{\mathsf{neg}\left(\left(t1 + u\right)\right)} \cdot \frac{-t1}{\mathsf{neg}\left(\left(t1 + u\right)\right)}} \]
    8. lower-/.f64N/A

      \[\leadsto \color{blue}{\frac{v}{\mathsf{neg}\left(\left(t1 + u\right)\right)}} \cdot \frac{-t1}{\mathsf{neg}\left(\left(t1 + u\right)\right)} \]
    9. lift-+.f64N/A

      \[\leadsto \frac{v}{\mathsf{neg}\left(\color{blue}{\left(t1 + u\right)}\right)} \cdot \frac{-t1}{\mathsf{neg}\left(\left(t1 + u\right)\right)} \]
    10. distribute-neg-inN/A

      \[\leadsto \frac{v}{\color{blue}{\left(\mathsf{neg}\left(t1\right)\right) + \left(\mathsf{neg}\left(u\right)\right)}} \cdot \frac{-t1}{\mathsf{neg}\left(\left(t1 + u\right)\right)} \]
    11. lift-neg.f64N/A

      \[\leadsto \frac{v}{\color{blue}{\left(-t1\right)} + \left(\mathsf{neg}\left(u\right)\right)} \cdot \frac{-t1}{\mathsf{neg}\left(\left(t1 + u\right)\right)} \]
    12. sub-flip-reverseN/A

      \[\leadsto \frac{v}{\color{blue}{\left(-t1\right) - u}} \cdot \frac{-t1}{\mathsf{neg}\left(\left(t1 + u\right)\right)} \]
    13. lower--.f64N/A

      \[\leadsto \frac{v}{\color{blue}{\left(-t1\right) - u}} \cdot \frac{-t1}{\mathsf{neg}\left(\left(t1 + u\right)\right)} \]
    14. lift-neg.f64N/A

      \[\leadsto \frac{v}{\left(-t1\right) - u} \cdot \frac{\color{blue}{\mathsf{neg}\left(t1\right)}}{\mathsf{neg}\left(\left(t1 + u\right)\right)} \]
    15. frac-2neg-revN/A

      \[\leadsto \frac{v}{\left(-t1\right) - u} \cdot \color{blue}{\frac{t1}{t1 + u}} \]
    16. lower-/.f6498.2

      \[\leadsto \frac{v}{\left(-t1\right) - u} \cdot \color{blue}{\frac{t1}{t1 + u}} \]
    17. lift-+.f64N/A

      \[\leadsto \frac{v}{\left(-t1\right) - u} \cdot \frac{t1}{\color{blue}{t1 + u}} \]
    18. +-commutativeN/A

      \[\leadsto \frac{v}{\left(-t1\right) - u} \cdot \frac{t1}{\color{blue}{u + t1}} \]
    19. lower-+.f6498.2

      \[\leadsto \frac{v}{\left(-t1\right) - u} \cdot \frac{t1}{\color{blue}{u + t1}} \]
  3. Applied rewrites98.2%

    \[\leadsto \color{blue}{\frac{v}{\left(-t1\right) - u} \cdot \frac{t1}{u + t1}} \]
  4. Add Preprocessing

Alternative 3: 98.1% accurate, 1.0× speedup?

\[\begin{array}{l} v\_m = \left|v\right| \\ v\_s = \mathsf{copysign}\left(1, v\right) \\ v\_s \cdot \frac{\frac{v\_m}{u + t1}}{-1 - \frac{u}{t1}} \end{array} \]
v\_m = (fabs.f64 v)
v\_s = (copysign.f64 #s(literal 1 binary64) v)
(FPCore (v_s u v_m t1)
 :precision binary64
 (* v_s (/ (/ v_m (+ u t1)) (- -1.0 (/ u t1)))))
v\_m = fabs(v);
v\_s = copysign(1.0, v);
double code(double v_s, double u, double v_m, double t1) {
	return v_s * ((v_m / (u + t1)) / (-1.0 - (u / t1)));
}
v\_m =     private
v\_s =     private
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(v_s, u, v_m, t1)
use fmin_fmax_functions
    real(8), intent (in) :: v_s
    real(8), intent (in) :: u
    real(8), intent (in) :: v_m
    real(8), intent (in) :: t1
    code = v_s * ((v_m / (u + t1)) / ((-1.0d0) - (u / t1)))
end function
v\_m = Math.abs(v);
v\_s = Math.copySign(1.0, v);
public static double code(double v_s, double u, double v_m, double t1) {
	return v_s * ((v_m / (u + t1)) / (-1.0 - (u / t1)));
}
v\_m = math.fabs(v)
v\_s = math.copysign(1.0, v)
def code(v_s, u, v_m, t1):
	return v_s * ((v_m / (u + t1)) / (-1.0 - (u / t1)))
v\_m = abs(v)
v\_s = copysign(1.0, v)
function code(v_s, u, v_m, t1)
	return Float64(v_s * Float64(Float64(v_m / Float64(u + t1)) / Float64(-1.0 - Float64(u / t1))))
end
v\_m = abs(v);
v\_s = sign(v) * abs(1.0);
function tmp = code(v_s, u, v_m, t1)
	tmp = v_s * ((v_m / (u + t1)) / (-1.0 - (u / t1)));
end
v\_m = N[Abs[v], $MachinePrecision]
v\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[v]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[v$95$s_, u_, v$95$m_, t1_] := N[(v$95$s * N[(N[(v$95$m / N[(u + t1), $MachinePrecision]), $MachinePrecision] / N[(-1.0 - N[(u / t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
v\_m = \left|v\right|
\\
v\_s = \mathsf{copysign}\left(1, v\right)

\\
v\_s \cdot \frac{\frac{v\_m}{u + t1}}{-1 - \frac{u}{t1}}
\end{array}
Derivation
  1. Initial program 72.6%

    \[\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
  2. Step-by-step derivation
    1. lift-/.f64N/A

      \[\leadsto \color{blue}{\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}} \]
    2. div-flipN/A

      \[\leadsto \color{blue}{\frac{1}{\frac{\left(t1 + u\right) \cdot \left(t1 + u\right)}{\left(-t1\right) \cdot v}}} \]
    3. lift-*.f64N/A

      \[\leadsto \frac{1}{\frac{\left(t1 + u\right) \cdot \left(t1 + u\right)}{\color{blue}{\left(-t1\right) \cdot v}}} \]
    4. associate-/r*N/A

      \[\leadsto \frac{1}{\color{blue}{\frac{\frac{\left(t1 + u\right) \cdot \left(t1 + u\right)}{-t1}}{v}}} \]
    5. div-flip-revN/A

      \[\leadsto \color{blue}{\frac{v}{\frac{\left(t1 + u\right) \cdot \left(t1 + u\right)}{-t1}}} \]
    6. lower-/.f64N/A

      \[\leadsto \color{blue}{\frac{v}{\frac{\left(t1 + u\right) \cdot \left(t1 + u\right)}{-t1}}} \]
    7. lift-*.f64N/A

      \[\leadsto \frac{v}{\frac{\color{blue}{\left(t1 + u\right) \cdot \left(t1 + u\right)}}{-t1}} \]
    8. sqr-neg-revN/A

      \[\leadsto \frac{v}{\frac{\color{blue}{\left(\mathsf{neg}\left(\left(t1 + u\right)\right)\right) \cdot \left(\mathsf{neg}\left(\left(t1 + u\right)\right)\right)}}{-t1}} \]
    9. associate-/l*N/A

      \[\leadsto \frac{v}{\color{blue}{\left(\mathsf{neg}\left(\left(t1 + u\right)\right)\right) \cdot \frac{\mathsf{neg}\left(\left(t1 + u\right)\right)}{-t1}}} \]
    10. frac-2negN/A

      \[\leadsto \frac{v}{\left(\mathsf{neg}\left(\left(t1 + u\right)\right)\right) \cdot \color{blue}{\frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(t1 + u\right)\right)\right)\right)}{\mathsf{neg}\left(\left(-t1\right)\right)}}} \]
  3. Applied rewrites95.3%

    \[\leadsto \color{blue}{\frac{v}{\left(\left(-t1\right) - u\right) \cdot \left(\frac{u}{t1} - -1\right)}} \]
  4. Step-by-step derivation
    1. lift--.f64N/A

      \[\leadsto \frac{v}{\left(\left(-t1\right) - u\right) \cdot \color{blue}{\left(\frac{u}{t1} - -1\right)}} \]
    2. sub-flipN/A

      \[\leadsto \frac{v}{\left(\left(-t1\right) - u\right) \cdot \color{blue}{\left(\frac{u}{t1} + \left(\mathsf{neg}\left(-1\right)\right)\right)}} \]
    3. lift-/.f64N/A

      \[\leadsto \frac{v}{\left(\left(-t1\right) - u\right) \cdot \left(\color{blue}{\frac{u}{t1}} + \left(\mathsf{neg}\left(-1\right)\right)\right)} \]
    4. mult-flipN/A

      \[\leadsto \frac{v}{\left(\left(-t1\right) - u\right) \cdot \left(\color{blue}{u \cdot \frac{1}{t1}} + \left(\mathsf{neg}\left(-1\right)\right)\right)} \]
    5. *-commutativeN/A

      \[\leadsto \frac{v}{\left(\left(-t1\right) - u\right) \cdot \left(\color{blue}{\frac{1}{t1} \cdot u} + \left(\mathsf{neg}\left(-1\right)\right)\right)} \]
    6. mul-1-negN/A

      \[\leadsto \frac{v}{\left(\left(-t1\right) - u\right) \cdot \left(\frac{1}{t1} \cdot u + \color{blue}{-1 \cdot -1}\right)} \]
    7. lower-fma.f64N/A

      \[\leadsto \frac{v}{\left(\left(-t1\right) - u\right) \cdot \color{blue}{\mathsf{fma}\left(\frac{1}{t1}, u, -1 \cdot -1\right)}} \]
    8. metadata-evalN/A

      \[\leadsto \frac{v}{\left(\left(-t1\right) - u\right) \cdot \mathsf{fma}\left(\frac{\color{blue}{-1 \cdot -1}}{t1}, u, -1 \cdot -1\right)} \]
    9. lower-/.f64N/A

      \[\leadsto \frac{v}{\left(\left(-t1\right) - u\right) \cdot \mathsf{fma}\left(\color{blue}{\frac{-1 \cdot -1}{t1}}, u, -1 \cdot -1\right)} \]
    10. metadata-evalN/A

      \[\leadsto \frac{v}{\left(\left(-t1\right) - u\right) \cdot \mathsf{fma}\left(\frac{\color{blue}{1}}{t1}, u, -1 \cdot -1\right)} \]
    11. metadata-eval95.3

      \[\leadsto \frac{v}{\left(\left(-t1\right) - u\right) \cdot \mathsf{fma}\left(\frac{1}{t1}, u, \color{blue}{1}\right)} \]
  5. Applied rewrites95.3%

    \[\leadsto \frac{v}{\left(\left(-t1\right) - u\right) \cdot \color{blue}{\mathsf{fma}\left(\frac{1}{t1}, u, 1\right)}} \]
  6. Step-by-step derivation
    1. lift-/.f64N/A

      \[\leadsto \color{blue}{\frac{v}{\left(\left(-t1\right) - u\right) \cdot \mathsf{fma}\left(\frac{1}{t1}, u, 1\right)}} \]
    2. lift-*.f64N/A

      \[\leadsto \frac{v}{\color{blue}{\left(\left(-t1\right) - u\right) \cdot \mathsf{fma}\left(\frac{1}{t1}, u, 1\right)}} \]
    3. associate-/r*N/A

      \[\leadsto \color{blue}{\frac{\frac{v}{\left(-t1\right) - u}}{\mathsf{fma}\left(\frac{1}{t1}, u, 1\right)}} \]
    4. frac-2neg-revN/A

      \[\leadsto \frac{\color{blue}{\frac{\mathsf{neg}\left(v\right)}{\mathsf{neg}\left(\left(\left(-t1\right) - u\right)\right)}}}{\mathsf{fma}\left(\frac{1}{t1}, u, 1\right)} \]
    5. lift--.f64N/A

      \[\leadsto \frac{\frac{\mathsf{neg}\left(v\right)}{\mathsf{neg}\left(\color{blue}{\left(\left(-t1\right) - u\right)}\right)}}{\mathsf{fma}\left(\frac{1}{t1}, u, 1\right)} \]
    6. sub-negate-revN/A

      \[\leadsto \frac{\frac{\mathsf{neg}\left(v\right)}{\color{blue}{u - \left(-t1\right)}}}{\mathsf{fma}\left(\frac{1}{t1}, u, 1\right)} \]
    7. lift-neg.f64N/A

      \[\leadsto \frac{\frac{\mathsf{neg}\left(v\right)}{u - \color{blue}{\left(\mathsf{neg}\left(t1\right)\right)}}}{\mathsf{fma}\left(\frac{1}{t1}, u, 1\right)} \]
    8. add-flipN/A

      \[\leadsto \frac{\frac{\mathsf{neg}\left(v\right)}{\color{blue}{u + t1}}}{\mathsf{fma}\left(\frac{1}{t1}, u, 1\right)} \]
    9. +-commutativeN/A

      \[\leadsto \frac{\frac{\mathsf{neg}\left(v\right)}{\color{blue}{t1 + u}}}{\mathsf{fma}\left(\frac{1}{t1}, u, 1\right)} \]
    10. distribute-frac-negN/A

      \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(\frac{v}{t1 + u}\right)}}{\mathsf{fma}\left(\frac{1}{t1}, u, 1\right)} \]
    11. lift-fma.f64N/A

      \[\leadsto \frac{\mathsf{neg}\left(\frac{v}{t1 + u}\right)}{\color{blue}{\frac{1}{t1} \cdot u + 1}} \]
    12. add-flipN/A

      \[\leadsto \frac{\mathsf{neg}\left(\frac{v}{t1 + u}\right)}{\color{blue}{\frac{1}{t1} \cdot u - \left(\mathsf{neg}\left(1\right)\right)}} \]
    13. metadata-evalN/A

      \[\leadsto \frac{\mathsf{neg}\left(\frac{v}{t1 + u}\right)}{\frac{1}{t1} \cdot u - \color{blue}{-1}} \]
    14. sub-negate-revN/A

      \[\leadsto \frac{\mathsf{neg}\left(\frac{v}{t1 + u}\right)}{\color{blue}{\mathsf{neg}\left(\left(-1 - \frac{1}{t1} \cdot u\right)\right)}} \]
    15. frac-2neg-revN/A

      \[\leadsto \color{blue}{\frac{\frac{v}{t1 + u}}{-1 - \frac{1}{t1} \cdot u}} \]
    16. lower-/.f64N/A

      \[\leadsto \color{blue}{\frac{\frac{v}{t1 + u}}{-1 - \frac{1}{t1} \cdot u}} \]
    17. lower-/.f64N/A

      \[\leadsto \frac{\color{blue}{\frac{v}{t1 + u}}}{-1 - \frac{1}{t1} \cdot u} \]
    18. +-commutativeN/A

      \[\leadsto \frac{\frac{v}{\color{blue}{u + t1}}}{-1 - \frac{1}{t1} \cdot u} \]
    19. lift-+.f64N/A

      \[\leadsto \frac{\frac{v}{\color{blue}{u + t1}}}{-1 - \frac{1}{t1} \cdot u} \]
    20. lower--.f64N/A

      \[\leadsto \frac{\frac{v}{u + t1}}{\color{blue}{-1 - \frac{1}{t1} \cdot u}} \]
    21. *-commutativeN/A

      \[\leadsto \frac{\frac{v}{u + t1}}{-1 - \color{blue}{u \cdot \frac{1}{t1}}} \]
    22. lift-/.f64N/A

      \[\leadsto \frac{\frac{v}{u + t1}}{-1 - u \cdot \color{blue}{\frac{1}{t1}}} \]
    23. mult-flip-revN/A

      \[\leadsto \frac{\frac{v}{u + t1}}{-1 - \color{blue}{\frac{u}{t1}}} \]
    24. lower-/.f6498.1

      \[\leadsto \frac{\frac{v}{u + t1}}{-1 - \color{blue}{\frac{u}{t1}}} \]
  7. Applied rewrites98.1%

    \[\leadsto \color{blue}{\frac{\frac{v}{u + t1}}{-1 - \frac{u}{t1}}} \]
  8. Add Preprocessing

Alternative 4: 79.7% accurate, 0.8× speedup?

\[\begin{array}{l} v\_m = \left|v\right| \\ v\_s = \mathsf{copysign}\left(1, v\right) \\ v\_s \cdot \begin{array}{l} \mathbf{if}\;t1 \leq -2.2 \cdot 10^{-45}:\\ \;\;\;\;\frac{v\_m}{t1 \cdot \left(-2 \cdot \frac{u}{t1} - 1\right)}\\ \mathbf{elif}\;t1 \leq 1500000000000:\\ \;\;\;\;\left(-1 \cdot \frac{v\_m}{u}\right) \cdot \frac{t1}{u}\\ \mathbf{else}:\\ \;\;\;\;\frac{v\_m}{\mathsf{fma}\left(-2, u, -1 \cdot t1\right)}\\ \end{array} \end{array} \]
v\_m = (fabs.f64 v)
v\_s = (copysign.f64 #s(literal 1 binary64) v)
(FPCore (v_s u v_m t1)
 :precision binary64
 (*
  v_s
  (if (<= t1 -2.2e-45)
    (/ v_m (* t1 (- (* -2.0 (/ u t1)) 1.0)))
    (if (<= t1 1500000000000.0)
      (* (* -1.0 (/ v_m u)) (/ t1 u))
      (/ v_m (fma -2.0 u (* -1.0 t1)))))))
v\_m = fabs(v);
v\_s = copysign(1.0, v);
double code(double v_s, double u, double v_m, double t1) {
	double tmp;
	if (t1 <= -2.2e-45) {
		tmp = v_m / (t1 * ((-2.0 * (u / t1)) - 1.0));
	} else if (t1 <= 1500000000000.0) {
		tmp = (-1.0 * (v_m / u)) * (t1 / u);
	} else {
		tmp = v_m / fma(-2.0, u, (-1.0 * t1));
	}
	return v_s * tmp;
}
v\_m = abs(v)
v\_s = copysign(1.0, v)
function code(v_s, u, v_m, t1)
	tmp = 0.0
	if (t1 <= -2.2e-45)
		tmp = Float64(v_m / Float64(t1 * Float64(Float64(-2.0 * Float64(u / t1)) - 1.0)));
	elseif (t1 <= 1500000000000.0)
		tmp = Float64(Float64(-1.0 * Float64(v_m / u)) * Float64(t1 / u));
	else
		tmp = Float64(v_m / fma(-2.0, u, Float64(-1.0 * t1)));
	end
	return Float64(v_s * tmp)
end
v\_m = N[Abs[v], $MachinePrecision]
v\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[v]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[v$95$s_, u_, v$95$m_, t1_] := N[(v$95$s * If[LessEqual[t1, -2.2e-45], N[(v$95$m / N[(t1 * N[(N[(-2.0 * N[(u / t1), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t1, 1500000000000.0], N[(N[(-1.0 * N[(v$95$m / u), $MachinePrecision]), $MachinePrecision] * N[(t1 / u), $MachinePrecision]), $MachinePrecision], N[(v$95$m / N[(-2.0 * u + N[(-1.0 * t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
v\_m = \left|v\right|
\\
v\_s = \mathsf{copysign}\left(1, v\right)

\\
v\_s \cdot \begin{array}{l}
\mathbf{if}\;t1 \leq -2.2 \cdot 10^{-45}:\\
\;\;\;\;\frac{v\_m}{t1 \cdot \left(-2 \cdot \frac{u}{t1} - 1\right)}\\

\mathbf{elif}\;t1 \leq 1500000000000:\\
\;\;\;\;\left(-1 \cdot \frac{v\_m}{u}\right) \cdot \frac{t1}{u}\\

\mathbf{else}:\\
\;\;\;\;\frac{v\_m}{\mathsf{fma}\left(-2, u, -1 \cdot t1\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t1 < -2.19999999999999993e-45

    1. Initial program 72.6%

      \[\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}} \]
      2. div-flipN/A

        \[\leadsto \color{blue}{\frac{1}{\frac{\left(t1 + u\right) \cdot \left(t1 + u\right)}{\left(-t1\right) \cdot v}}} \]
      3. lift-*.f64N/A

        \[\leadsto \frac{1}{\frac{\left(t1 + u\right) \cdot \left(t1 + u\right)}{\color{blue}{\left(-t1\right) \cdot v}}} \]
      4. associate-/r*N/A

        \[\leadsto \frac{1}{\color{blue}{\frac{\frac{\left(t1 + u\right) \cdot \left(t1 + u\right)}{-t1}}{v}}} \]
      5. div-flip-revN/A

        \[\leadsto \color{blue}{\frac{v}{\frac{\left(t1 + u\right) \cdot \left(t1 + u\right)}{-t1}}} \]
      6. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{v}{\frac{\left(t1 + u\right) \cdot \left(t1 + u\right)}{-t1}}} \]
      7. lift-*.f64N/A

        \[\leadsto \frac{v}{\frac{\color{blue}{\left(t1 + u\right) \cdot \left(t1 + u\right)}}{-t1}} \]
      8. sqr-neg-revN/A

        \[\leadsto \frac{v}{\frac{\color{blue}{\left(\mathsf{neg}\left(\left(t1 + u\right)\right)\right) \cdot \left(\mathsf{neg}\left(\left(t1 + u\right)\right)\right)}}{-t1}} \]
      9. associate-/l*N/A

        \[\leadsto \frac{v}{\color{blue}{\left(\mathsf{neg}\left(\left(t1 + u\right)\right)\right) \cdot \frac{\mathsf{neg}\left(\left(t1 + u\right)\right)}{-t1}}} \]
      10. frac-2negN/A

        \[\leadsto \frac{v}{\left(\mathsf{neg}\left(\left(t1 + u\right)\right)\right) \cdot \color{blue}{\frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(t1 + u\right)\right)\right)\right)}{\mathsf{neg}\left(\left(-t1\right)\right)}}} \]
    3. Applied rewrites95.3%

      \[\leadsto \color{blue}{\frac{v}{\left(\left(-t1\right) - u\right) \cdot \left(\frac{u}{t1} - -1\right)}} \]
    4. Taylor expanded in t1 around inf

      \[\leadsto \frac{v}{\color{blue}{t1 \cdot \left(-2 \cdot \frac{u}{t1} - 1\right)}} \]
    5. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \frac{v}{t1 \cdot \color{blue}{\left(-2 \cdot \frac{u}{t1} - 1\right)}} \]
      2. lower--.f64N/A

        \[\leadsto \frac{v}{t1 \cdot \left(-2 \cdot \frac{u}{t1} - \color{blue}{1}\right)} \]
      3. lower-*.f64N/A

        \[\leadsto \frac{v}{t1 \cdot \left(-2 \cdot \frac{u}{t1} - 1\right)} \]
      4. lower-/.f6469.3

        \[\leadsto \frac{v}{t1 \cdot \left(-2 \cdot \frac{u}{t1} - 1\right)} \]
    6. Applied rewrites69.3%

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

    if -2.19999999999999993e-45 < t1 < 1.5e12

    1. Initial program 72.6%

      \[\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{\left(-t1\right) \cdot v}}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
      3. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{v \cdot \left(-t1\right)}}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
      4. lift-*.f64N/A

        \[\leadsto \frac{v \cdot \left(-t1\right)}{\color{blue}{\left(t1 + u\right) \cdot \left(t1 + u\right)}} \]
      5. sqr-neg-revN/A

        \[\leadsto \frac{v \cdot \left(-t1\right)}{\color{blue}{\left(\mathsf{neg}\left(\left(t1 + u\right)\right)\right) \cdot \left(\mathsf{neg}\left(\left(t1 + u\right)\right)\right)}} \]
      6. times-fracN/A

        \[\leadsto \color{blue}{\frac{v}{\mathsf{neg}\left(\left(t1 + u\right)\right)} \cdot \frac{-t1}{\mathsf{neg}\left(\left(t1 + u\right)\right)}} \]
      7. lower-*.f64N/A

        \[\leadsto \color{blue}{\frac{v}{\mathsf{neg}\left(\left(t1 + u\right)\right)} \cdot \frac{-t1}{\mathsf{neg}\left(\left(t1 + u\right)\right)}} \]
      8. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{v}{\mathsf{neg}\left(\left(t1 + u\right)\right)}} \cdot \frac{-t1}{\mathsf{neg}\left(\left(t1 + u\right)\right)} \]
      9. lift-+.f64N/A

        \[\leadsto \frac{v}{\mathsf{neg}\left(\color{blue}{\left(t1 + u\right)}\right)} \cdot \frac{-t1}{\mathsf{neg}\left(\left(t1 + u\right)\right)} \]
      10. distribute-neg-inN/A

        \[\leadsto \frac{v}{\color{blue}{\left(\mathsf{neg}\left(t1\right)\right) + \left(\mathsf{neg}\left(u\right)\right)}} \cdot \frac{-t1}{\mathsf{neg}\left(\left(t1 + u\right)\right)} \]
      11. lift-neg.f64N/A

        \[\leadsto \frac{v}{\color{blue}{\left(-t1\right)} + \left(\mathsf{neg}\left(u\right)\right)} \cdot \frac{-t1}{\mathsf{neg}\left(\left(t1 + u\right)\right)} \]
      12. sub-flip-reverseN/A

        \[\leadsto \frac{v}{\color{blue}{\left(-t1\right) - u}} \cdot \frac{-t1}{\mathsf{neg}\left(\left(t1 + u\right)\right)} \]
      13. lower--.f64N/A

        \[\leadsto \frac{v}{\color{blue}{\left(-t1\right) - u}} \cdot \frac{-t1}{\mathsf{neg}\left(\left(t1 + u\right)\right)} \]
      14. lift-neg.f64N/A

        \[\leadsto \frac{v}{\left(-t1\right) - u} \cdot \frac{\color{blue}{\mathsf{neg}\left(t1\right)}}{\mathsf{neg}\left(\left(t1 + u\right)\right)} \]
      15. frac-2neg-revN/A

        \[\leadsto \frac{v}{\left(-t1\right) - u} \cdot \color{blue}{\frac{t1}{t1 + u}} \]
      16. lower-/.f6498.2

        \[\leadsto \frac{v}{\left(-t1\right) - u} \cdot \color{blue}{\frac{t1}{t1 + u}} \]
      17. lift-+.f64N/A

        \[\leadsto \frac{v}{\left(-t1\right) - u} \cdot \frac{t1}{\color{blue}{t1 + u}} \]
      18. +-commutativeN/A

        \[\leadsto \frac{v}{\left(-t1\right) - u} \cdot \frac{t1}{\color{blue}{u + t1}} \]
      19. lower-+.f6498.2

        \[\leadsto \frac{v}{\left(-t1\right) - u} \cdot \frac{t1}{\color{blue}{u + t1}} \]
    3. Applied rewrites98.2%

      \[\leadsto \color{blue}{\frac{v}{\left(-t1\right) - u} \cdot \frac{t1}{u + t1}} \]
    4. Taylor expanded in u around inf

      \[\leadsto \frac{v}{\left(-t1\right) - u} \cdot \color{blue}{\frac{t1}{u}} \]
    5. Step-by-step derivation
      1. lower-/.f6454.6

        \[\leadsto \frac{v}{\left(-t1\right) - u} \cdot \frac{t1}{\color{blue}{u}} \]
    6. Applied rewrites54.6%

      \[\leadsto \frac{v}{\left(-t1\right) - u} \cdot \color{blue}{\frac{t1}{u}} \]
    7. Taylor expanded in u around inf

      \[\leadsto \color{blue}{\left(-1 \cdot \frac{v}{u}\right)} \cdot \frac{t1}{u} \]
    8. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \left(-1 \cdot \color{blue}{\frac{v}{u}}\right) \cdot \frac{t1}{u} \]
      2. lower-/.f6452.3

        \[\leadsto \left(-1 \cdot \frac{v}{\color{blue}{u}}\right) \cdot \frac{t1}{u} \]
    9. Applied rewrites52.3%

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

    if 1.5e12 < t1

    1. Initial program 72.6%

      \[\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}} \]
      2. div-flipN/A

        \[\leadsto \color{blue}{\frac{1}{\frac{\left(t1 + u\right) \cdot \left(t1 + u\right)}{\left(-t1\right) \cdot v}}} \]
      3. lift-*.f64N/A

        \[\leadsto \frac{1}{\frac{\left(t1 + u\right) \cdot \left(t1 + u\right)}{\color{blue}{\left(-t1\right) \cdot v}}} \]
      4. associate-/r*N/A

        \[\leadsto \frac{1}{\color{blue}{\frac{\frac{\left(t1 + u\right) \cdot \left(t1 + u\right)}{-t1}}{v}}} \]
      5. div-flip-revN/A

        \[\leadsto \color{blue}{\frac{v}{\frac{\left(t1 + u\right) \cdot \left(t1 + u\right)}{-t1}}} \]
      6. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{v}{\frac{\left(t1 + u\right) \cdot \left(t1 + u\right)}{-t1}}} \]
      7. lift-*.f64N/A

        \[\leadsto \frac{v}{\frac{\color{blue}{\left(t1 + u\right) \cdot \left(t1 + u\right)}}{-t1}} \]
      8. sqr-neg-revN/A

        \[\leadsto \frac{v}{\frac{\color{blue}{\left(\mathsf{neg}\left(\left(t1 + u\right)\right)\right) \cdot \left(\mathsf{neg}\left(\left(t1 + u\right)\right)\right)}}{-t1}} \]
      9. associate-/l*N/A

        \[\leadsto \frac{v}{\color{blue}{\left(\mathsf{neg}\left(\left(t1 + u\right)\right)\right) \cdot \frac{\mathsf{neg}\left(\left(t1 + u\right)\right)}{-t1}}} \]
      10. frac-2negN/A

        \[\leadsto \frac{v}{\left(\mathsf{neg}\left(\left(t1 + u\right)\right)\right) \cdot \color{blue}{\frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(t1 + u\right)\right)\right)\right)}{\mathsf{neg}\left(\left(-t1\right)\right)}}} \]
    3. Applied rewrites95.3%

      \[\leadsto \color{blue}{\frac{v}{\left(\left(-t1\right) - u\right) \cdot \left(\frac{u}{t1} - -1\right)}} \]
    4. Taylor expanded in u around 0

      \[\leadsto \frac{v}{\color{blue}{-2 \cdot u + -1 \cdot t1}} \]
    5. Step-by-step derivation
      1. lower-fma.f64N/A

        \[\leadsto \frac{v}{\mathsf{fma}\left(-2, \color{blue}{u}, -1 \cdot t1\right)} \]
      2. lower-*.f6462.7

        \[\leadsto \frac{v}{\mathsf{fma}\left(-2, u, -1 \cdot t1\right)} \]
    6. Applied rewrites62.7%

      \[\leadsto \frac{v}{\color{blue}{\mathsf{fma}\left(-2, u, -1 \cdot t1\right)}} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 5: 79.6% accurate, 0.8× speedup?

\[\begin{array}{l} v\_m = \left|v\right| \\ v\_s = \mathsf{copysign}\left(1, v\right) \\ \begin{array}{l} t_1 := \frac{v\_m}{\mathsf{fma}\left(-2, u, -1 \cdot t1\right)}\\ v\_s \cdot \begin{array}{l} \mathbf{if}\;t1 \leq -3.3 \cdot 10^{-45}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t1 \leq 1500000000000:\\ \;\;\;\;\left(-1 \cdot \frac{v\_m}{u}\right) \cdot \frac{t1}{u}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \end{array} \]
v\_m = (fabs.f64 v)
v\_s = (copysign.f64 #s(literal 1 binary64) v)
(FPCore (v_s u v_m t1)
 :precision binary64
 (let* ((t_1 (/ v_m (fma -2.0 u (* -1.0 t1)))))
   (*
    v_s
    (if (<= t1 -3.3e-45)
      t_1
      (if (<= t1 1500000000000.0) (* (* -1.0 (/ v_m u)) (/ t1 u)) t_1)))))
v\_m = fabs(v);
v\_s = copysign(1.0, v);
double code(double v_s, double u, double v_m, double t1) {
	double t_1 = v_m / fma(-2.0, u, (-1.0 * t1));
	double tmp;
	if (t1 <= -3.3e-45) {
		tmp = t_1;
	} else if (t1 <= 1500000000000.0) {
		tmp = (-1.0 * (v_m / u)) * (t1 / u);
	} else {
		tmp = t_1;
	}
	return v_s * tmp;
}
v\_m = abs(v)
v\_s = copysign(1.0, v)
function code(v_s, u, v_m, t1)
	t_1 = Float64(v_m / fma(-2.0, u, Float64(-1.0 * t1)))
	tmp = 0.0
	if (t1 <= -3.3e-45)
		tmp = t_1;
	elseif (t1 <= 1500000000000.0)
		tmp = Float64(Float64(-1.0 * Float64(v_m / u)) * Float64(t1 / u));
	else
		tmp = t_1;
	end
	return Float64(v_s * tmp)
end
v\_m = N[Abs[v], $MachinePrecision]
v\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[v]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[v$95$s_, u_, v$95$m_, t1_] := Block[{t$95$1 = N[(v$95$m / N[(-2.0 * u + N[(-1.0 * t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(v$95$s * If[LessEqual[t1, -3.3e-45], t$95$1, If[LessEqual[t1, 1500000000000.0], N[(N[(-1.0 * N[(v$95$m / u), $MachinePrecision]), $MachinePrecision] * N[(t1 / u), $MachinePrecision]), $MachinePrecision], t$95$1]]), $MachinePrecision]]
\begin{array}{l}
v\_m = \left|v\right|
\\
v\_s = \mathsf{copysign}\left(1, v\right)

\\
\begin{array}{l}
t_1 := \frac{v\_m}{\mathsf{fma}\left(-2, u, -1 \cdot t1\right)}\\
v\_s \cdot \begin{array}{l}
\mathbf{if}\;t1 \leq -3.3 \cdot 10^{-45}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t1 \leq 1500000000000:\\
\;\;\;\;\left(-1 \cdot \frac{v\_m}{u}\right) \cdot \frac{t1}{u}\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t1 < -3.3000000000000001e-45 or 1.5e12 < t1

    1. Initial program 72.6%

      \[\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}} \]
      2. div-flipN/A

        \[\leadsto \color{blue}{\frac{1}{\frac{\left(t1 + u\right) \cdot \left(t1 + u\right)}{\left(-t1\right) \cdot v}}} \]
      3. lift-*.f64N/A

        \[\leadsto \frac{1}{\frac{\left(t1 + u\right) \cdot \left(t1 + u\right)}{\color{blue}{\left(-t1\right) \cdot v}}} \]
      4. associate-/r*N/A

        \[\leadsto \frac{1}{\color{blue}{\frac{\frac{\left(t1 + u\right) \cdot \left(t1 + u\right)}{-t1}}{v}}} \]
      5. div-flip-revN/A

        \[\leadsto \color{blue}{\frac{v}{\frac{\left(t1 + u\right) \cdot \left(t1 + u\right)}{-t1}}} \]
      6. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{v}{\frac{\left(t1 + u\right) \cdot \left(t1 + u\right)}{-t1}}} \]
      7. lift-*.f64N/A

        \[\leadsto \frac{v}{\frac{\color{blue}{\left(t1 + u\right) \cdot \left(t1 + u\right)}}{-t1}} \]
      8. sqr-neg-revN/A

        \[\leadsto \frac{v}{\frac{\color{blue}{\left(\mathsf{neg}\left(\left(t1 + u\right)\right)\right) \cdot \left(\mathsf{neg}\left(\left(t1 + u\right)\right)\right)}}{-t1}} \]
      9. associate-/l*N/A

        \[\leadsto \frac{v}{\color{blue}{\left(\mathsf{neg}\left(\left(t1 + u\right)\right)\right) \cdot \frac{\mathsf{neg}\left(\left(t1 + u\right)\right)}{-t1}}} \]
      10. frac-2negN/A

        \[\leadsto \frac{v}{\left(\mathsf{neg}\left(\left(t1 + u\right)\right)\right) \cdot \color{blue}{\frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(t1 + u\right)\right)\right)\right)}{\mathsf{neg}\left(\left(-t1\right)\right)}}} \]
    3. Applied rewrites95.3%

      \[\leadsto \color{blue}{\frac{v}{\left(\left(-t1\right) - u\right) \cdot \left(\frac{u}{t1} - -1\right)}} \]
    4. Taylor expanded in u around 0

      \[\leadsto \frac{v}{\color{blue}{-2 \cdot u + -1 \cdot t1}} \]
    5. Step-by-step derivation
      1. lower-fma.f64N/A

        \[\leadsto \frac{v}{\mathsf{fma}\left(-2, \color{blue}{u}, -1 \cdot t1\right)} \]
      2. lower-*.f6462.7

        \[\leadsto \frac{v}{\mathsf{fma}\left(-2, u, -1 \cdot t1\right)} \]
    6. Applied rewrites62.7%

      \[\leadsto \frac{v}{\color{blue}{\mathsf{fma}\left(-2, u, -1 \cdot t1\right)}} \]

    if -3.3000000000000001e-45 < t1 < 1.5e12

    1. Initial program 72.6%

      \[\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{\left(-t1\right) \cdot v}}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
      3. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{v \cdot \left(-t1\right)}}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
      4. lift-*.f64N/A

        \[\leadsto \frac{v \cdot \left(-t1\right)}{\color{blue}{\left(t1 + u\right) \cdot \left(t1 + u\right)}} \]
      5. sqr-neg-revN/A

        \[\leadsto \frac{v \cdot \left(-t1\right)}{\color{blue}{\left(\mathsf{neg}\left(\left(t1 + u\right)\right)\right) \cdot \left(\mathsf{neg}\left(\left(t1 + u\right)\right)\right)}} \]
      6. times-fracN/A

        \[\leadsto \color{blue}{\frac{v}{\mathsf{neg}\left(\left(t1 + u\right)\right)} \cdot \frac{-t1}{\mathsf{neg}\left(\left(t1 + u\right)\right)}} \]
      7. lower-*.f64N/A

        \[\leadsto \color{blue}{\frac{v}{\mathsf{neg}\left(\left(t1 + u\right)\right)} \cdot \frac{-t1}{\mathsf{neg}\left(\left(t1 + u\right)\right)}} \]
      8. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{v}{\mathsf{neg}\left(\left(t1 + u\right)\right)}} \cdot \frac{-t1}{\mathsf{neg}\left(\left(t1 + u\right)\right)} \]
      9. lift-+.f64N/A

        \[\leadsto \frac{v}{\mathsf{neg}\left(\color{blue}{\left(t1 + u\right)}\right)} \cdot \frac{-t1}{\mathsf{neg}\left(\left(t1 + u\right)\right)} \]
      10. distribute-neg-inN/A

        \[\leadsto \frac{v}{\color{blue}{\left(\mathsf{neg}\left(t1\right)\right) + \left(\mathsf{neg}\left(u\right)\right)}} \cdot \frac{-t1}{\mathsf{neg}\left(\left(t1 + u\right)\right)} \]
      11. lift-neg.f64N/A

        \[\leadsto \frac{v}{\color{blue}{\left(-t1\right)} + \left(\mathsf{neg}\left(u\right)\right)} \cdot \frac{-t1}{\mathsf{neg}\left(\left(t1 + u\right)\right)} \]
      12. sub-flip-reverseN/A

        \[\leadsto \frac{v}{\color{blue}{\left(-t1\right) - u}} \cdot \frac{-t1}{\mathsf{neg}\left(\left(t1 + u\right)\right)} \]
      13. lower--.f64N/A

        \[\leadsto \frac{v}{\color{blue}{\left(-t1\right) - u}} \cdot \frac{-t1}{\mathsf{neg}\left(\left(t1 + u\right)\right)} \]
      14. lift-neg.f64N/A

        \[\leadsto \frac{v}{\left(-t1\right) - u} \cdot \frac{\color{blue}{\mathsf{neg}\left(t1\right)}}{\mathsf{neg}\left(\left(t1 + u\right)\right)} \]
      15. frac-2neg-revN/A

        \[\leadsto \frac{v}{\left(-t1\right) - u} \cdot \color{blue}{\frac{t1}{t1 + u}} \]
      16. lower-/.f6498.2

        \[\leadsto \frac{v}{\left(-t1\right) - u} \cdot \color{blue}{\frac{t1}{t1 + u}} \]
      17. lift-+.f64N/A

        \[\leadsto \frac{v}{\left(-t1\right) - u} \cdot \frac{t1}{\color{blue}{t1 + u}} \]
      18. +-commutativeN/A

        \[\leadsto \frac{v}{\left(-t1\right) - u} \cdot \frac{t1}{\color{blue}{u + t1}} \]
      19. lower-+.f6498.2

        \[\leadsto \frac{v}{\left(-t1\right) - u} \cdot \frac{t1}{\color{blue}{u + t1}} \]
    3. Applied rewrites98.2%

      \[\leadsto \color{blue}{\frac{v}{\left(-t1\right) - u} \cdot \frac{t1}{u + t1}} \]
    4. Taylor expanded in u around inf

      \[\leadsto \frac{v}{\left(-t1\right) - u} \cdot \color{blue}{\frac{t1}{u}} \]
    5. Step-by-step derivation
      1. lower-/.f6454.6

        \[\leadsto \frac{v}{\left(-t1\right) - u} \cdot \frac{t1}{\color{blue}{u}} \]
    6. Applied rewrites54.6%

      \[\leadsto \frac{v}{\left(-t1\right) - u} \cdot \color{blue}{\frac{t1}{u}} \]
    7. Taylor expanded in u around inf

      \[\leadsto \color{blue}{\left(-1 \cdot \frac{v}{u}\right)} \cdot \frac{t1}{u} \]
    8. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \left(-1 \cdot \color{blue}{\frac{v}{u}}\right) \cdot \frac{t1}{u} \]
      2. lower-/.f6452.3

        \[\leadsto \left(-1 \cdot \frac{v}{\color{blue}{u}}\right) \cdot \frac{t1}{u} \]
    9. Applied rewrites52.3%

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

Alternative 6: 62.7% accurate, 1.4× speedup?

\[\begin{array}{l} v\_m = \left|v\right| \\ v\_s = \mathsf{copysign}\left(1, v\right) \\ v\_s \cdot \frac{v\_m}{\mathsf{fma}\left(-2, u, -1 \cdot t1\right)} \end{array} \]
v\_m = (fabs.f64 v)
v\_s = (copysign.f64 #s(literal 1 binary64) v)
(FPCore (v_s u v_m t1)
 :precision binary64
 (* v_s (/ v_m (fma -2.0 u (* -1.0 t1)))))
v\_m = fabs(v);
v\_s = copysign(1.0, v);
double code(double v_s, double u, double v_m, double t1) {
	return v_s * (v_m / fma(-2.0, u, (-1.0 * t1)));
}
v\_m = abs(v)
v\_s = copysign(1.0, v)
function code(v_s, u, v_m, t1)
	return Float64(v_s * Float64(v_m / fma(-2.0, u, Float64(-1.0 * t1))))
end
v\_m = N[Abs[v], $MachinePrecision]
v\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[v]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[v$95$s_, u_, v$95$m_, t1_] := N[(v$95$s * N[(v$95$m / N[(-2.0 * u + N[(-1.0 * t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
v\_m = \left|v\right|
\\
v\_s = \mathsf{copysign}\left(1, v\right)

\\
v\_s \cdot \frac{v\_m}{\mathsf{fma}\left(-2, u, -1 \cdot t1\right)}
\end{array}
Derivation
  1. Initial program 72.6%

    \[\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
  2. Step-by-step derivation
    1. lift-/.f64N/A

      \[\leadsto \color{blue}{\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}} \]
    2. div-flipN/A

      \[\leadsto \color{blue}{\frac{1}{\frac{\left(t1 + u\right) \cdot \left(t1 + u\right)}{\left(-t1\right) \cdot v}}} \]
    3. lift-*.f64N/A

      \[\leadsto \frac{1}{\frac{\left(t1 + u\right) \cdot \left(t1 + u\right)}{\color{blue}{\left(-t1\right) \cdot v}}} \]
    4. associate-/r*N/A

      \[\leadsto \frac{1}{\color{blue}{\frac{\frac{\left(t1 + u\right) \cdot \left(t1 + u\right)}{-t1}}{v}}} \]
    5. div-flip-revN/A

      \[\leadsto \color{blue}{\frac{v}{\frac{\left(t1 + u\right) \cdot \left(t1 + u\right)}{-t1}}} \]
    6. lower-/.f64N/A

      \[\leadsto \color{blue}{\frac{v}{\frac{\left(t1 + u\right) \cdot \left(t1 + u\right)}{-t1}}} \]
    7. lift-*.f64N/A

      \[\leadsto \frac{v}{\frac{\color{blue}{\left(t1 + u\right) \cdot \left(t1 + u\right)}}{-t1}} \]
    8. sqr-neg-revN/A

      \[\leadsto \frac{v}{\frac{\color{blue}{\left(\mathsf{neg}\left(\left(t1 + u\right)\right)\right) \cdot \left(\mathsf{neg}\left(\left(t1 + u\right)\right)\right)}}{-t1}} \]
    9. associate-/l*N/A

      \[\leadsto \frac{v}{\color{blue}{\left(\mathsf{neg}\left(\left(t1 + u\right)\right)\right) \cdot \frac{\mathsf{neg}\left(\left(t1 + u\right)\right)}{-t1}}} \]
    10. frac-2negN/A

      \[\leadsto \frac{v}{\left(\mathsf{neg}\left(\left(t1 + u\right)\right)\right) \cdot \color{blue}{\frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(t1 + u\right)\right)\right)\right)}{\mathsf{neg}\left(\left(-t1\right)\right)}}} \]
  3. Applied rewrites95.3%

    \[\leadsto \color{blue}{\frac{v}{\left(\left(-t1\right) - u\right) \cdot \left(\frac{u}{t1} - -1\right)}} \]
  4. Taylor expanded in u around 0

    \[\leadsto \frac{v}{\color{blue}{-2 \cdot u + -1 \cdot t1}} \]
  5. Step-by-step derivation
    1. lower-fma.f64N/A

      \[\leadsto \frac{v}{\mathsf{fma}\left(-2, \color{blue}{u}, -1 \cdot t1\right)} \]
    2. lower-*.f6462.7

      \[\leadsto \frac{v}{\mathsf{fma}\left(-2, u, -1 \cdot t1\right)} \]
  6. Applied rewrites62.7%

    \[\leadsto \frac{v}{\color{blue}{\mathsf{fma}\left(-2, u, -1 \cdot t1\right)}} \]
  7. Add Preprocessing

Alternative 7: 62.3% accurate, 1.7× speedup?

\[\begin{array}{l} v\_m = \left|v\right| \\ v\_s = \mathsf{copysign}\left(1, v\right) \\ v\_s \cdot \frac{-1 \cdot v\_m}{u + t1} \end{array} \]
v\_m = (fabs.f64 v)
v\_s = (copysign.f64 #s(literal 1 binary64) v)
(FPCore (v_s u v_m t1) :precision binary64 (* v_s (/ (* -1.0 v_m) (+ u t1))))
v\_m = fabs(v);
v\_s = copysign(1.0, v);
double code(double v_s, double u, double v_m, double t1) {
	return v_s * ((-1.0 * v_m) / (u + t1));
}
v\_m =     private
v\_s =     private
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(v_s, u, v_m, t1)
use fmin_fmax_functions
    real(8), intent (in) :: v_s
    real(8), intent (in) :: u
    real(8), intent (in) :: v_m
    real(8), intent (in) :: t1
    code = v_s * (((-1.0d0) * v_m) / (u + t1))
end function
v\_m = Math.abs(v);
v\_s = Math.copySign(1.0, v);
public static double code(double v_s, double u, double v_m, double t1) {
	return v_s * ((-1.0 * v_m) / (u + t1));
}
v\_m = math.fabs(v)
v\_s = math.copysign(1.0, v)
def code(v_s, u, v_m, t1):
	return v_s * ((-1.0 * v_m) / (u + t1))
v\_m = abs(v)
v\_s = copysign(1.0, v)
function code(v_s, u, v_m, t1)
	return Float64(v_s * Float64(Float64(-1.0 * v_m) / Float64(u + t1)))
end
v\_m = abs(v);
v\_s = sign(v) * abs(1.0);
function tmp = code(v_s, u, v_m, t1)
	tmp = v_s * ((-1.0 * v_m) / (u + t1));
end
v\_m = N[Abs[v], $MachinePrecision]
v\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[v]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[v$95$s_, u_, v$95$m_, t1_] := N[(v$95$s * N[(N[(-1.0 * v$95$m), $MachinePrecision] / N[(u + t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
v\_m = \left|v\right|
\\
v\_s = \mathsf{copysign}\left(1, v\right)

\\
v\_s \cdot \frac{-1 \cdot v\_m}{u + t1}
\end{array}
Derivation
  1. Initial program 72.6%

    \[\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
  2. Step-by-step derivation
    1. lift-/.f64N/A

      \[\leadsto \color{blue}{\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}} \]
    2. lift-*.f64N/A

      \[\leadsto \frac{\left(-t1\right) \cdot v}{\color{blue}{\left(t1 + u\right) \cdot \left(t1 + u\right)}} \]
    3. associate-/r*N/A

      \[\leadsto \color{blue}{\frac{\frac{\left(-t1\right) \cdot v}{t1 + u}}{t1 + u}} \]
    4. lower-/.f64N/A

      \[\leadsto \color{blue}{\frac{\frac{\left(-t1\right) \cdot v}{t1 + u}}{t1 + u}} \]
    5. lift-*.f64N/A

      \[\leadsto \frac{\frac{\color{blue}{\left(-t1\right) \cdot v}}{t1 + u}}{t1 + u} \]
    6. associate-*l/N/A

      \[\leadsto \frac{\color{blue}{\frac{-t1}{t1 + u} \cdot v}}{t1 + u} \]
    7. lower-*.f64N/A

      \[\leadsto \frac{\color{blue}{\frac{-t1}{t1 + u} \cdot v}}{t1 + u} \]
    8. frac-2negN/A

      \[\leadsto \frac{\color{blue}{\frac{\mathsf{neg}\left(\left(-t1\right)\right)}{\mathsf{neg}\left(\left(t1 + u\right)\right)}} \cdot v}{t1 + u} \]
    9. lift-neg.f64N/A

      \[\leadsto \frac{\frac{\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(t1\right)\right)}\right)}{\mathsf{neg}\left(\left(t1 + u\right)\right)} \cdot v}{t1 + u} \]
    10. remove-double-negN/A

      \[\leadsto \frac{\frac{\color{blue}{t1}}{\mathsf{neg}\left(\left(t1 + u\right)\right)} \cdot v}{t1 + u} \]
    11. lower-/.f64N/A

      \[\leadsto \frac{\color{blue}{\frac{t1}{\mathsf{neg}\left(\left(t1 + u\right)\right)}} \cdot v}{t1 + u} \]
    12. lift-+.f64N/A

      \[\leadsto \frac{\frac{t1}{\mathsf{neg}\left(\color{blue}{\left(t1 + u\right)}\right)} \cdot v}{t1 + u} \]
    13. distribute-neg-inN/A

      \[\leadsto \frac{\frac{t1}{\color{blue}{\left(\mathsf{neg}\left(t1\right)\right) + \left(\mathsf{neg}\left(u\right)\right)}} \cdot v}{t1 + u} \]
    14. lift-neg.f64N/A

      \[\leadsto \frac{\frac{t1}{\color{blue}{\left(-t1\right)} + \left(\mathsf{neg}\left(u\right)\right)} \cdot v}{t1 + u} \]
    15. sub-flip-reverseN/A

      \[\leadsto \frac{\frac{t1}{\color{blue}{\left(-t1\right) - u}} \cdot v}{t1 + u} \]
    16. lower--.f6498.3

      \[\leadsto \frac{\frac{t1}{\color{blue}{\left(-t1\right) - u}} \cdot v}{t1 + u} \]
    17. lift-+.f64N/A

      \[\leadsto \frac{\frac{t1}{\left(-t1\right) - u} \cdot v}{\color{blue}{t1 + u}} \]
    18. +-commutativeN/A

      \[\leadsto \frac{\frac{t1}{\left(-t1\right) - u} \cdot v}{\color{blue}{u + t1}} \]
    19. lower-+.f6498.3

      \[\leadsto \frac{\frac{t1}{\left(-t1\right) - u} \cdot v}{\color{blue}{u + t1}} \]
  3. Applied rewrites98.3%

    \[\leadsto \color{blue}{\frac{\frac{t1}{\left(-t1\right) - u} \cdot v}{u + t1}} \]
  4. Taylor expanded in u around 0

    \[\leadsto \frac{\color{blue}{-1} \cdot v}{u + t1} \]
  5. Step-by-step derivation
    1. Applied rewrites62.3%

      \[\leadsto \frac{\color{blue}{-1} \cdot v}{u + t1} \]
    2. Add Preprocessing

    Alternative 8: 62.2% accurate, 1.7× speedup?

    \[\begin{array}{l} v\_m = \left|v\right| \\ v\_s = \mathsf{copysign}\left(1, v\right) \\ v\_s \cdot \left(v\_m \cdot \frac{-1}{u + t1}\right) \end{array} \]
    v\_m = (fabs.f64 v)
    v\_s = (copysign.f64 #s(literal 1 binary64) v)
    (FPCore (v_s u v_m t1) :precision binary64 (* v_s (* v_m (/ -1.0 (+ u t1)))))
    v\_m = fabs(v);
    v\_s = copysign(1.0, v);
    double code(double v_s, double u, double v_m, double t1) {
    	return v_s * (v_m * (-1.0 / (u + t1)));
    }
    
    v\_m =     private
    v\_s =     private
    module fmin_fmax_functions
        implicit none
        private
        public fmax
        public fmin
    
        interface fmax
            module procedure fmax88
            module procedure fmax44
            module procedure fmax84
            module procedure fmax48
        end interface
        interface fmin
            module procedure fmin88
            module procedure fmin44
            module procedure fmin84
            module procedure fmin48
        end interface
    contains
        real(8) function fmax88(x, y) result (res)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
        end function
        real(4) function fmax44(x, y) result (res)
            real(4), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
        end function
        real(8) function fmax84(x, y) result(res)
            real(8), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
        end function
        real(8) function fmax48(x, y) result(res)
            real(4), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
        end function
        real(8) function fmin88(x, y) result (res)
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
        end function
        real(4) function fmin44(x, y) result (res)
            real(4), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
        end function
        real(8) function fmin84(x, y) result(res)
            real(8), intent (in) :: x
            real(4), intent (in) :: y
            res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
        end function
        real(8) function fmin48(x, y) result(res)
            real(4), intent (in) :: x
            real(8), intent (in) :: y
            res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
        end function
    end module
    
    real(8) function code(v_s, u, v_m, t1)
    use fmin_fmax_functions
        real(8), intent (in) :: v_s
        real(8), intent (in) :: u
        real(8), intent (in) :: v_m
        real(8), intent (in) :: t1
        code = v_s * (v_m * ((-1.0d0) / (u + t1)))
    end function
    
    v\_m = Math.abs(v);
    v\_s = Math.copySign(1.0, v);
    public static double code(double v_s, double u, double v_m, double t1) {
    	return v_s * (v_m * (-1.0 / (u + t1)));
    }
    
    v\_m = math.fabs(v)
    v\_s = math.copysign(1.0, v)
    def code(v_s, u, v_m, t1):
    	return v_s * (v_m * (-1.0 / (u + t1)))
    
    v\_m = abs(v)
    v\_s = copysign(1.0, v)
    function code(v_s, u, v_m, t1)
    	return Float64(v_s * Float64(v_m * Float64(-1.0 / Float64(u + t1))))
    end
    
    v\_m = abs(v);
    v\_s = sign(v) * abs(1.0);
    function tmp = code(v_s, u, v_m, t1)
    	tmp = v_s * (v_m * (-1.0 / (u + t1)));
    end
    
    v\_m = N[Abs[v], $MachinePrecision]
    v\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[v]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
    code[v$95$s_, u_, v$95$m_, t1_] := N[(v$95$s * N[(v$95$m * N[(-1.0 / N[(u + t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
    
    \begin{array}{l}
    v\_m = \left|v\right|
    \\
    v\_s = \mathsf{copysign}\left(1, v\right)
    
    \\
    v\_s \cdot \left(v\_m \cdot \frac{-1}{u + t1}\right)
    \end{array}
    
    Derivation
    1. Initial program 72.6%

      \[\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)}} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{\left(-t1\right) \cdot v}{\color{blue}{\left(t1 + u\right) \cdot \left(t1 + u\right)}} \]
      3. associate-/r*N/A

        \[\leadsto \color{blue}{\frac{\frac{\left(-t1\right) \cdot v}{t1 + u}}{t1 + u}} \]
      4. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\frac{\left(-t1\right) \cdot v}{t1 + u}}{t1 + u}} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{\frac{\color{blue}{\left(-t1\right) \cdot v}}{t1 + u}}{t1 + u} \]
      6. associate-*l/N/A

        \[\leadsto \frac{\color{blue}{\frac{-t1}{t1 + u} \cdot v}}{t1 + u} \]
      7. lower-*.f64N/A

        \[\leadsto \frac{\color{blue}{\frac{-t1}{t1 + u} \cdot v}}{t1 + u} \]
      8. frac-2negN/A

        \[\leadsto \frac{\color{blue}{\frac{\mathsf{neg}\left(\left(-t1\right)\right)}{\mathsf{neg}\left(\left(t1 + u\right)\right)}} \cdot v}{t1 + u} \]
      9. lift-neg.f64N/A

        \[\leadsto \frac{\frac{\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(t1\right)\right)}\right)}{\mathsf{neg}\left(\left(t1 + u\right)\right)} \cdot v}{t1 + u} \]
      10. remove-double-negN/A

        \[\leadsto \frac{\frac{\color{blue}{t1}}{\mathsf{neg}\left(\left(t1 + u\right)\right)} \cdot v}{t1 + u} \]
      11. lower-/.f64N/A

        \[\leadsto \frac{\color{blue}{\frac{t1}{\mathsf{neg}\left(\left(t1 + u\right)\right)}} \cdot v}{t1 + u} \]
      12. lift-+.f64N/A

        \[\leadsto \frac{\frac{t1}{\mathsf{neg}\left(\color{blue}{\left(t1 + u\right)}\right)} \cdot v}{t1 + u} \]
      13. distribute-neg-inN/A

        \[\leadsto \frac{\frac{t1}{\color{blue}{\left(\mathsf{neg}\left(t1\right)\right) + \left(\mathsf{neg}\left(u\right)\right)}} \cdot v}{t1 + u} \]
      14. lift-neg.f64N/A

        \[\leadsto \frac{\frac{t1}{\color{blue}{\left(-t1\right)} + \left(\mathsf{neg}\left(u\right)\right)} \cdot v}{t1 + u} \]
      15. sub-flip-reverseN/A

        \[\leadsto \frac{\frac{t1}{\color{blue}{\left(-t1\right) - u}} \cdot v}{t1 + u} \]
      16. lower--.f6498.3

        \[\leadsto \frac{\frac{t1}{\color{blue}{\left(-t1\right) - u}} \cdot v}{t1 + u} \]
      17. lift-+.f64N/A

        \[\leadsto \frac{\frac{t1}{\left(-t1\right) - u} \cdot v}{\color{blue}{t1 + u}} \]
      18. +-commutativeN/A

        \[\leadsto \frac{\frac{t1}{\left(-t1\right) - u} \cdot v}{\color{blue}{u + t1}} \]
      19. lower-+.f6498.3

        \[\leadsto \frac{\frac{t1}{\left(-t1\right) - u} \cdot v}{\color{blue}{u + t1}} \]
    3. Applied rewrites98.3%

      \[\leadsto \color{blue}{\frac{\frac{t1}{\left(-t1\right) - u} \cdot v}{u + t1}} \]
    4. Taylor expanded in u around 0

      \[\leadsto \frac{\color{blue}{-1} \cdot v}{u + t1} \]
    5. Step-by-step derivation
      1. Applied rewrites62.3%

        \[\leadsto \frac{\color{blue}{-1} \cdot v}{u + t1} \]
      2. Step-by-step derivation
        1. lift-/.f64N/A

          \[\leadsto \color{blue}{\frac{-1 \cdot v}{u + t1}} \]
        2. lift-*.f64N/A

          \[\leadsto \frac{\color{blue}{-1 \cdot v}}{u + t1} \]
        3. *-commutativeN/A

          \[\leadsto \frac{\color{blue}{v \cdot -1}}{u + t1} \]
        4. lift-+.f64N/A

          \[\leadsto \frac{v \cdot -1}{\color{blue}{u + t1}} \]
        5. +-commutativeN/A

          \[\leadsto \frac{v \cdot -1}{\color{blue}{t1 + u}} \]
        6. associate-/l*N/A

          \[\leadsto \color{blue}{v \cdot \frac{-1}{t1 + u}} \]
        7. lower-*.f64N/A

          \[\leadsto \color{blue}{v \cdot \frac{-1}{t1 + u}} \]
        8. lower-/.f64N/A

          \[\leadsto v \cdot \color{blue}{\frac{-1}{t1 + u}} \]
        9. +-commutativeN/A

          \[\leadsto v \cdot \frac{-1}{\color{blue}{u + t1}} \]
        10. lift-+.f6462.2

          \[\leadsto v \cdot \frac{-1}{\color{blue}{u + t1}} \]
      3. Applied rewrites62.2%

        \[\leadsto \color{blue}{v \cdot \frac{-1}{u + t1}} \]
      4. Add Preprocessing

      Alternative 9: 54.9% accurate, 2.2× speedup?

      \[\begin{array}{l} v\_m = \left|v\right| \\ v\_s = \mathsf{copysign}\left(1, v\right) \\ v\_s \cdot \frac{-1}{\frac{t1}{v\_m}} \end{array} \]
      v\_m = (fabs.f64 v)
      v\_s = (copysign.f64 #s(literal 1 binary64) v)
      (FPCore (v_s u v_m t1) :precision binary64 (* v_s (/ -1.0 (/ t1 v_m))))
      v\_m = fabs(v);
      v\_s = copysign(1.0, v);
      double code(double v_s, double u, double v_m, double t1) {
      	return v_s * (-1.0 / (t1 / v_m));
      }
      
      v\_m =     private
      v\_s =     private
      module fmin_fmax_functions
          implicit none
          private
          public fmax
          public fmin
      
          interface fmax
              module procedure fmax88
              module procedure fmax44
              module procedure fmax84
              module procedure fmax48
          end interface
          interface fmin
              module procedure fmin88
              module procedure fmin44
              module procedure fmin84
              module procedure fmin48
          end interface
      contains
          real(8) function fmax88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(4) function fmax44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(8) function fmax84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmax48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
          end function
          real(8) function fmin88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(4) function fmin44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(8) function fmin84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmin48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
          end function
      end module
      
      real(8) function code(v_s, u, v_m, t1)
      use fmin_fmax_functions
          real(8), intent (in) :: v_s
          real(8), intent (in) :: u
          real(8), intent (in) :: v_m
          real(8), intent (in) :: t1
          code = v_s * ((-1.0d0) / (t1 / v_m))
      end function
      
      v\_m = Math.abs(v);
      v\_s = Math.copySign(1.0, v);
      public static double code(double v_s, double u, double v_m, double t1) {
      	return v_s * (-1.0 / (t1 / v_m));
      }
      
      v\_m = math.fabs(v)
      v\_s = math.copysign(1.0, v)
      def code(v_s, u, v_m, t1):
      	return v_s * (-1.0 / (t1 / v_m))
      
      v\_m = abs(v)
      v\_s = copysign(1.0, v)
      function code(v_s, u, v_m, t1)
      	return Float64(v_s * Float64(-1.0 / Float64(t1 / v_m)))
      end
      
      v\_m = abs(v);
      v\_s = sign(v) * abs(1.0);
      function tmp = code(v_s, u, v_m, t1)
      	tmp = v_s * (-1.0 / (t1 / v_m));
      end
      
      v\_m = N[Abs[v], $MachinePrecision]
      v\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[v]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
      code[v$95$s_, u_, v$95$m_, t1_] := N[(v$95$s * N[(-1.0 / N[(t1 / v$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
      
      \begin{array}{l}
      v\_m = \left|v\right|
      \\
      v\_s = \mathsf{copysign}\left(1, v\right)
      
      \\
      v\_s \cdot \frac{-1}{\frac{t1}{v\_m}}
      \end{array}
      
      Derivation
      1. Initial program 72.6%

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

        \[\leadsto \color{blue}{-1 \cdot \frac{v}{t1}} \]
      3. Step-by-step derivation
        1. lower-*.f64N/A

          \[\leadsto -1 \cdot \color{blue}{\frac{v}{t1}} \]
        2. lower-/.f6454.9

          \[\leadsto -1 \cdot \frac{v}{\color{blue}{t1}} \]
      4. Applied rewrites54.9%

        \[\leadsto \color{blue}{-1 \cdot \frac{v}{t1}} \]
      5. Step-by-step derivation
        1. lift-*.f64N/A

          \[\leadsto -1 \cdot \color{blue}{\frac{v}{t1}} \]
        2. lift-/.f64N/A

          \[\leadsto -1 \cdot \frac{v}{\color{blue}{t1}} \]
        3. div-flipN/A

          \[\leadsto -1 \cdot \frac{1}{\color{blue}{\frac{t1}{v}}} \]
        4. mult-flip-revN/A

          \[\leadsto \frac{-1}{\color{blue}{\frac{t1}{v}}} \]
        5. lower-/.f64N/A

          \[\leadsto \frac{-1}{\color{blue}{\frac{t1}{v}}} \]
        6. lower-/.f6454.5

          \[\leadsto \frac{-1}{\frac{t1}{\color{blue}{v}}} \]
      6. Applied rewrites54.5%

        \[\leadsto \frac{-1}{\color{blue}{\frac{t1}{v}}} \]
      7. Add Preprocessing

      Alternative 10: 54.5% accurate, 3.1× speedup?

      \[\begin{array}{l} v\_m = \left|v\right| \\ v\_s = \mathsf{copysign}\left(1, v\right) \\ v\_s \cdot \frac{-v\_m}{t1} \end{array} \]
      v\_m = (fabs.f64 v)
      v\_s = (copysign.f64 #s(literal 1 binary64) v)
      (FPCore (v_s u v_m t1) :precision binary64 (* v_s (/ (- v_m) t1)))
      v\_m = fabs(v);
      v\_s = copysign(1.0, v);
      double code(double v_s, double u, double v_m, double t1) {
      	return v_s * (-v_m / t1);
      }
      
      v\_m =     private
      v\_s =     private
      module fmin_fmax_functions
          implicit none
          private
          public fmax
          public fmin
      
          interface fmax
              module procedure fmax88
              module procedure fmax44
              module procedure fmax84
              module procedure fmax48
          end interface
          interface fmin
              module procedure fmin88
              module procedure fmin44
              module procedure fmin84
              module procedure fmin48
          end interface
      contains
          real(8) function fmax88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(4) function fmax44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(8) function fmax84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmax48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
          end function
          real(8) function fmin88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(4) function fmin44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(8) function fmin84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmin48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
          end function
      end module
      
      real(8) function code(v_s, u, v_m, t1)
      use fmin_fmax_functions
          real(8), intent (in) :: v_s
          real(8), intent (in) :: u
          real(8), intent (in) :: v_m
          real(8), intent (in) :: t1
          code = v_s * (-v_m / t1)
      end function
      
      v\_m = Math.abs(v);
      v\_s = Math.copySign(1.0, v);
      public static double code(double v_s, double u, double v_m, double t1) {
      	return v_s * (-v_m / t1);
      }
      
      v\_m = math.fabs(v)
      v\_s = math.copysign(1.0, v)
      def code(v_s, u, v_m, t1):
      	return v_s * (-v_m / t1)
      
      v\_m = abs(v)
      v\_s = copysign(1.0, v)
      function code(v_s, u, v_m, t1)
      	return Float64(v_s * Float64(Float64(-v_m) / t1))
      end
      
      v\_m = abs(v);
      v\_s = sign(v) * abs(1.0);
      function tmp = code(v_s, u, v_m, t1)
      	tmp = v_s * (-v_m / t1);
      end
      
      v\_m = N[Abs[v], $MachinePrecision]
      v\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[v]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
      code[v$95$s_, u_, v$95$m_, t1_] := N[(v$95$s * N[((-v$95$m) / t1), $MachinePrecision]), $MachinePrecision]
      
      \begin{array}{l}
      v\_m = \left|v\right|
      \\
      v\_s = \mathsf{copysign}\left(1, v\right)
      
      \\
      v\_s \cdot \frac{-v\_m}{t1}
      \end{array}
      
      Derivation
      1. Initial program 72.6%

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

        \[\leadsto \color{blue}{-1 \cdot \frac{v}{t1}} \]
      3. Step-by-step derivation
        1. lower-*.f64N/A

          \[\leadsto -1 \cdot \color{blue}{\frac{v}{t1}} \]
        2. lower-/.f6454.9

          \[\leadsto -1 \cdot \frac{v}{\color{blue}{t1}} \]
      4. Applied rewrites54.9%

        \[\leadsto \color{blue}{-1 \cdot \frac{v}{t1}} \]
      5. Step-by-step derivation
        1. lift-*.f64N/A

          \[\leadsto -1 \cdot \color{blue}{\frac{v}{t1}} \]
        2. mul-1-negN/A

          \[\leadsto \mathsf{neg}\left(\frac{v}{t1}\right) \]
        3. lift-/.f64N/A

          \[\leadsto \mathsf{neg}\left(\frac{v}{t1}\right) \]
        4. distribute-neg-fracN/A

          \[\leadsto \frac{\mathsf{neg}\left(v\right)}{\color{blue}{t1}} \]
        5. lower-/.f64N/A

          \[\leadsto \frac{\mathsf{neg}\left(v\right)}{\color{blue}{t1}} \]
        6. lower-neg.f6454.9

          \[\leadsto \frac{-v}{t1} \]
      6. Applied rewrites54.9%

        \[\leadsto \frac{-v}{\color{blue}{t1}} \]
      7. Add Preprocessing

      Reproduce

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