Rosa's DopplerBench

Percentage Accurate: 73.3% → 98.4%
Time: 3.5s
Alternatives: 8
Speedup: N/A×

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}

Sampling outcomes in binary64 precision:

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 8 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: 73.3% 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: 98.4% accurate, N/A× speedup?

\[\begin{array}{l} \\ \frac{\frac{t1}{u + t1} \cdot v}{-1 \cdot \left(u + t1\right)} \end{array} \]
(FPCore (u v t1)
 :precision binary64
 (/ (* (/ t1 (+ u t1)) v) (* -1.0 (+ u t1))))
double code(double u, double v, double t1) {
	return ((t1 / (u + t1)) * v) / (-1.0 * (u + t1));
}
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 / (u + t1)) * v) / ((-1.0d0) * (u + t1))
end function
public static double code(double u, double v, double t1) {
	return ((t1 / (u + t1)) * v) / (-1.0 * (u + t1));
}
def code(u, v, t1):
	return ((t1 / (u + t1)) * v) / (-1.0 * (u + t1))
function code(u, v, t1)
	return Float64(Float64(Float64(t1 / Float64(u + t1)) * v) / Float64(-1.0 * Float64(u + t1)))
end
function tmp = code(u, v, t1)
	tmp = ((t1 / (u + t1)) * v) / (-1.0 * (u + t1));
end
code[u_, v_, t1_] := N[(N[(N[(t1 / N[(u + t1), $MachinePrecision]), $MachinePrecision] * v), $MachinePrecision] / N[(-1.0 * N[(u + t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

    \[\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
  2. Add Preprocessing
  3. 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-neg.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{-1 \cdot t1}{u + t1} \cdot \frac{v}{\color{blue}{u + t1}} \]
    16. lower-+.f6498.0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{\left(-1 \cdot \frac{t1}{u + t1}\right) \cdot v}{u + t1}} \]
  7. Final simplification98.3%

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

Alternative 2: 98.3% accurate, N/A× speedup?

\[\begin{array}{l} \\ \frac{\frac{-1 \cdot t1}{\left(\frac{u}{t1} + 1\right) \cdot t1} \cdot v}{u + t1} \end{array} \]
(FPCore (u v t1)
 :precision binary64
 (/ (* (/ (* -1.0 t1) (* (+ (/ u t1) 1.0) t1)) v) (+ u t1)))
double code(double u, double v, double t1) {
	return (((-1.0 * t1) / (((u / t1) + 1.0) * t1)) * v) / (u + t1);
}
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 = ((((-1.0d0) * t1) / (((u / t1) + 1.0d0) * t1)) * v) / (u + t1)
end function
public static double code(double u, double v, double t1) {
	return (((-1.0 * t1) / (((u / t1) + 1.0) * t1)) * v) / (u + t1);
}
def code(u, v, t1):
	return (((-1.0 * t1) / (((u / t1) + 1.0) * t1)) * v) / (u + t1)
function code(u, v, t1)
	return Float64(Float64(Float64(Float64(-1.0 * t1) / Float64(Float64(Float64(u / t1) + 1.0) * t1)) * v) / Float64(u + t1))
end
function tmp = code(u, v, t1)
	tmp = (((-1.0 * t1) / (((u / t1) + 1.0) * t1)) * v) / (u + t1);
end
code[u_, v_, t1_] := N[(N[(N[(N[(-1.0 * t1), $MachinePrecision] / N[(N[(N[(u / t1), $MachinePrecision] + 1.0), $MachinePrecision] * t1), $MachinePrecision]), $MachinePrecision] * v), $MachinePrecision] / N[(u + t1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

    \[\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
  2. Add Preprocessing
  3. 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-neg.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{-1 \cdot t1}{u + t1} \cdot \frac{v}{\color{blue}{u + t1}} \]
    16. lower-+.f6498.0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\left(-1 \cdot \frac{t1}{\left(\frac{u}{t1} + 1\right) \cdot t1}\right) \cdot v}{u + t1} \]
    5. lower-/.f6498.3

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

    \[\leadsto \frac{\left(-1 \cdot \frac{t1}{\color{blue}{\left(\frac{u}{t1} + 1\right) \cdot t1}}\right) \cdot v}{u + t1} \]
  10. Final simplification98.3%

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

Alternative 3: 98.0% accurate, N/A× speedup?

\[\begin{array}{l} \\ \frac{t1}{u + t1} \cdot \frac{-1 \cdot v}{\left(\frac{u}{t1} + 1\right) \cdot t1} \end{array} \]
(FPCore (u v t1)
 :precision binary64
 (* (/ t1 (+ u t1)) (/ (* -1.0 v) (* (+ (/ u t1) 1.0) t1))))
double code(double u, double v, double t1) {
	return (t1 / (u + t1)) * ((-1.0 * v) / (((u / t1) + 1.0) * t1));
}
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 / (u + t1)) * (((-1.0d0) * v) / (((u / t1) + 1.0d0) * t1))
end function
public static double code(double u, double v, double t1) {
	return (t1 / (u + t1)) * ((-1.0 * v) / (((u / t1) + 1.0) * t1));
}
def code(u, v, t1):
	return (t1 / (u + t1)) * ((-1.0 * v) / (((u / t1) + 1.0) * t1))
function code(u, v, t1)
	return Float64(Float64(t1 / Float64(u + t1)) * Float64(Float64(-1.0 * v) / Float64(Float64(Float64(u / t1) + 1.0) * t1)))
end
function tmp = code(u, v, t1)
	tmp = (t1 / (u + t1)) * ((-1.0 * v) / (((u / t1) + 1.0) * t1));
end
code[u_, v_, t1_] := N[(N[(t1 / N[(u + t1), $MachinePrecision]), $MachinePrecision] * N[(N[(-1.0 * v), $MachinePrecision] / N[(N[(N[(u / t1), $MachinePrecision] + 1.0), $MachinePrecision] * t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

    \[\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
  2. Add Preprocessing
  3. 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-neg.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{-1 \cdot t1}{u + t1} \cdot \frac{v}{\color{blue}{u + t1}} \]
    16. lower-+.f6498.0

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

    \[\leadsto \color{blue}{\frac{-1 \cdot t1}{u + t1} \cdot \frac{v}{u + t1}} \]
  5. Taylor expanded in t1 around inf

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

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

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

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

      \[\leadsto \frac{-1 \cdot t1}{u + t1} \cdot \frac{v}{\left(\frac{u}{t1} + 1\right) \cdot t1} \]
    5. lower-/.f6498.0

      \[\leadsto \frac{-1 \cdot t1}{u + t1} \cdot \frac{v}{\left(\frac{u}{t1} + 1\right) \cdot t1} \]
  7. Applied rewrites98.0%

    \[\leadsto \frac{-1 \cdot t1}{u + t1} \cdot \frac{v}{\color{blue}{\left(\frac{u}{t1} + 1\right) \cdot t1}} \]
  8. Final simplification98.0%

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

Alternative 4: 91.8% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t1 \leq 4.2 \cdot 10^{+194}:\\ \;\;\;\;\frac{t1}{u + t1} \cdot \frac{-1 \cdot v}{\left(\frac{t1}{u} + 1\right) \cdot u}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{2}{t1}, u \cdot \frac{v}{t1}, \frac{v}{t1} \cdot -1\right)\\ \end{array} \end{array} \]
(FPCore (u v t1)
 :precision binary64
 (if (<= t1 4.2e+194)
   (* (/ t1 (+ u t1)) (/ (* -1.0 v) (* (+ (/ t1 u) 1.0) u)))
   (fma (/ 2.0 t1) (* u (/ v t1)) (* (/ v t1) -1.0))))
double code(double u, double v, double t1) {
	double tmp;
	if (t1 <= 4.2e+194) {
		tmp = (t1 / (u + t1)) * ((-1.0 * v) / (((t1 / u) + 1.0) * u));
	} else {
		tmp = fma((2.0 / t1), (u * (v / t1)), ((v / t1) * -1.0));
	}
	return tmp;
}
function code(u, v, t1)
	tmp = 0.0
	if (t1 <= 4.2e+194)
		tmp = Float64(Float64(t1 / Float64(u + t1)) * Float64(Float64(-1.0 * v) / Float64(Float64(Float64(t1 / u) + 1.0) * u)));
	else
		tmp = fma(Float64(2.0 / t1), Float64(u * Float64(v / t1)), Float64(Float64(v / t1) * -1.0));
	end
	return tmp
end
code[u_, v_, t1_] := If[LessEqual[t1, 4.2e+194], N[(N[(t1 / N[(u + t1), $MachinePrecision]), $MachinePrecision] * N[(N[(-1.0 * v), $MachinePrecision] / N[(N[(N[(t1 / u), $MachinePrecision] + 1.0), $MachinePrecision] * u), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 / t1), $MachinePrecision] * N[(u * N[(v / t1), $MachinePrecision]), $MachinePrecision] + N[(N[(v / t1), $MachinePrecision] * -1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;t1 \leq 4.2 \cdot 10^{+194}:\\
\;\;\;\;\frac{t1}{u + t1} \cdot \frac{-1 \cdot v}{\left(\frac{t1}{u} + 1\right) \cdot u}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if t1 < 4.20000000000000032e194

    1. Initial program 75.3%

      \[\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
    2. Add Preprocessing
    3. 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-neg.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-1 \cdot t1}{u + t1} \cdot \frac{v}{\color{blue}{u + t1}} \]
      16. lower-+.f6497.8

        \[\leadsto \frac{-1 \cdot t1}{u + t1} \cdot \frac{v}{\color{blue}{u + t1}} \]
    4. Applied rewrites97.8%

      \[\leadsto \color{blue}{\frac{-1 \cdot t1}{u + t1} \cdot \frac{v}{u + t1}} \]
    5. Taylor expanded in u around inf

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

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

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

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

        \[\leadsto \frac{-1 \cdot t1}{u + t1} \cdot \frac{v}{\left(\frac{t1}{u} + 1\right) \cdot u} \]
      5. lower-/.f6493.1

        \[\leadsto \frac{-1 \cdot t1}{u + t1} \cdot \frac{v}{\left(\frac{t1}{u} + 1\right) \cdot u} \]
    7. Applied rewrites93.1%

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

    if 4.20000000000000032e194 < t1

    1. Initial program 38.9%

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

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

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

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

        \[\leadsto \frac{2 \cdot \left(u \cdot v\right)}{t1 \cdot t1} + -1 \cdot \frac{v}{t1} \]
      4. times-fracN/A

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{2}{t1}, u \cdot \frac{v}{t1}, \frac{v}{t1} \cdot -1\right) \]
      12. lower-/.f6496.3

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t1 \leq 4.2 \cdot 10^{+194}:\\ \;\;\;\;\frac{t1}{u + t1} \cdot \frac{-1 \cdot v}{\left(\frac{t1}{u} + 1\right) \cdot u}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{2}{t1}, u \cdot \frac{v}{t1}, \frac{v}{t1} \cdot -1\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 86.0% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t1 \leq -7.2 \cdot 10^{+138}:\\ \;\;\;\;\left(\frac{u}{t1 \cdot t1} \cdot 2 - {t1}^{-1}\right) \cdot v\\ \mathbf{elif}\;t1 \leq 7.5 \cdot 10^{+113}:\\ \;\;\;\;\left(-1 \cdot t1\right) \cdot \frac{v}{{\left(u + t1\right)}^{2}}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{2}{t1}, u \cdot \frac{v}{t1}, \frac{v}{t1} \cdot -1\right)\\ \end{array} \end{array} \]
(FPCore (u v t1)
 :precision binary64
 (if (<= t1 -7.2e+138)
   (* (- (* (/ u (* t1 t1)) 2.0) (pow t1 -1.0)) v)
   (if (<= t1 7.5e+113)
     (* (* -1.0 t1) (/ v (pow (+ u t1) 2.0)))
     (fma (/ 2.0 t1) (* u (/ v t1)) (* (/ v t1) -1.0)))))
double code(double u, double v, double t1) {
	double tmp;
	if (t1 <= -7.2e+138) {
		tmp = (((u / (t1 * t1)) * 2.0) - pow(t1, -1.0)) * v;
	} else if (t1 <= 7.5e+113) {
		tmp = (-1.0 * t1) * (v / pow((u + t1), 2.0));
	} else {
		tmp = fma((2.0 / t1), (u * (v / t1)), ((v / t1) * -1.0));
	}
	return tmp;
}
function code(u, v, t1)
	tmp = 0.0
	if (t1 <= -7.2e+138)
		tmp = Float64(Float64(Float64(Float64(u / Float64(t1 * t1)) * 2.0) - (t1 ^ -1.0)) * v);
	elseif (t1 <= 7.5e+113)
		tmp = Float64(Float64(-1.0 * t1) * Float64(v / (Float64(u + t1) ^ 2.0)));
	else
		tmp = fma(Float64(2.0 / t1), Float64(u * Float64(v / t1)), Float64(Float64(v / t1) * -1.0));
	end
	return tmp
end
code[u_, v_, t1_] := If[LessEqual[t1, -7.2e+138], N[(N[(N[(N[(u / N[(t1 * t1), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision] - N[Power[t1, -1.0], $MachinePrecision]), $MachinePrecision] * v), $MachinePrecision], If[LessEqual[t1, 7.5e+113], N[(N[(-1.0 * t1), $MachinePrecision] * N[(v / N[Power[N[(u + t1), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 / t1), $MachinePrecision] * N[(u * N[(v / t1), $MachinePrecision]), $MachinePrecision] + N[(N[(v / t1), $MachinePrecision] * -1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;t1 \leq -7.2 \cdot 10^{+138}:\\
\;\;\;\;\left(\frac{u}{t1 \cdot t1} \cdot 2 - {t1}^{-1}\right) \cdot v\\

\mathbf{elif}\;t1 \leq 7.5 \cdot 10^{+113}:\\
\;\;\;\;\left(-1 \cdot t1\right) \cdot \frac{v}{{\left(u + t1\right)}^{2}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if t1 < -7.2000000000000002e138

    1. Initial program 47.8%

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

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

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

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

        \[\leadsto \frac{2 \cdot \left(u \cdot v\right)}{t1 \cdot t1} + -1 \cdot \frac{v}{t1} \]
      4. times-fracN/A

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{2}{t1}, u \cdot \frac{v}{t1}, \frac{v}{t1} \cdot -1\right) \]
      12. lower-/.f6481.3

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

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

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

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

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

        \[\leadsto \left(2 \cdot \frac{u}{{t1}^{2}} - \frac{1}{t1}\right) \cdot v \]
      4. *-commutativeN/A

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

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

        \[\leadsto \left(\frac{u}{{t1}^{2}} \cdot 2 - \frac{1}{t1}\right) \cdot v \]
      7. unpow2N/A

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

        \[\leadsto \left(\frac{u}{t1 \cdot t1} \cdot 2 - \frac{1}{t1}\right) \cdot v \]
      9. inv-powN/A

        \[\leadsto \left(\frac{u}{t1 \cdot t1} \cdot 2 - {t1}^{-1}\right) \cdot v \]
      10. lower-pow.f6483.2

        \[\leadsto \left(\frac{u}{t1 \cdot t1} \cdot 2 - {t1}^{-1}\right) \cdot v \]
    8. Applied rewrites83.2%

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

    if -7.2000000000000002e138 < t1 < 7.5000000000000001e113

    1. Initial program 82.3%

      \[\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
    2. Add Preprocessing
    3. 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-neg.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(-1 \cdot t1\right) \cdot \frac{v}{{\color{blue}{\left(u + t1\right)}}^{2}} \]
      15. lower-+.f6489.3

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

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

    if 7.5000000000000001e113 < t1

    1. Initial program 48.3%

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

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

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

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

        \[\leadsto \frac{2 \cdot \left(u \cdot v\right)}{t1 \cdot t1} + -1 \cdot \frac{v}{t1} \]
      4. times-fracN/A

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{2}{t1}, u \cdot \frac{v}{t1}, \frac{v}{t1} \cdot -1\right) \]
      12. lower-/.f6487.0

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

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

Alternative 6: 73.4% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;t1 \leq -1.9 \cdot 10^{-15}:\\ \;\;\;\;\left(\frac{u}{t1 \cdot t1} \cdot 2 - {t1}^{-1}\right) \cdot v\\ \mathbf{elif}\;t1 \leq 1.32 \cdot 10^{+16}:\\ \;\;\;\;\left(\left(\frac{t1}{u \cdot u} - {u}^{-1}\right) \cdot t1\right) \cdot \frac{v}{u + t1}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{2}{t1}, u \cdot \frac{v}{t1}, \frac{v}{t1} \cdot -1\right)\\ \end{array} \end{array} \]
(FPCore (u v t1)
 :precision binary64
 (if (<= t1 -1.9e-15)
   (* (- (* (/ u (* t1 t1)) 2.0) (pow t1 -1.0)) v)
   (if (<= t1 1.32e+16)
     (* (* (- (/ t1 (* u u)) (pow u -1.0)) t1) (/ v (+ u t1)))
     (fma (/ 2.0 t1) (* u (/ v t1)) (* (/ v t1) -1.0)))))
double code(double u, double v, double t1) {
	double tmp;
	if (t1 <= -1.9e-15) {
		tmp = (((u / (t1 * t1)) * 2.0) - pow(t1, -1.0)) * v;
	} else if (t1 <= 1.32e+16) {
		tmp = (((t1 / (u * u)) - pow(u, -1.0)) * t1) * (v / (u + t1));
	} else {
		tmp = fma((2.0 / t1), (u * (v / t1)), ((v / t1) * -1.0));
	}
	return tmp;
}
function code(u, v, t1)
	tmp = 0.0
	if (t1 <= -1.9e-15)
		tmp = Float64(Float64(Float64(Float64(u / Float64(t1 * t1)) * 2.0) - (t1 ^ -1.0)) * v);
	elseif (t1 <= 1.32e+16)
		tmp = Float64(Float64(Float64(Float64(t1 / Float64(u * u)) - (u ^ -1.0)) * t1) * Float64(v / Float64(u + t1)));
	else
		tmp = fma(Float64(2.0 / t1), Float64(u * Float64(v / t1)), Float64(Float64(v / t1) * -1.0));
	end
	return tmp
end
code[u_, v_, t1_] := If[LessEqual[t1, -1.9e-15], N[(N[(N[(N[(u / N[(t1 * t1), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision] - N[Power[t1, -1.0], $MachinePrecision]), $MachinePrecision] * v), $MachinePrecision], If[LessEqual[t1, 1.32e+16], N[(N[(N[(N[(t1 / N[(u * u), $MachinePrecision]), $MachinePrecision] - N[Power[u, -1.0], $MachinePrecision]), $MachinePrecision] * t1), $MachinePrecision] * N[(v / N[(u + t1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 / t1), $MachinePrecision] * N[(u * N[(v / t1), $MachinePrecision]), $MachinePrecision] + N[(N[(v / t1), $MachinePrecision] * -1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

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

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


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

    1. Initial program 58.2%

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

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

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

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

        \[\leadsto \frac{2 \cdot \left(u \cdot v\right)}{t1 \cdot t1} + -1 \cdot \frac{v}{t1} \]
      4. times-fracN/A

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{2}{t1}, u \cdot \frac{v}{t1}, \frac{v}{t1} \cdot -1\right) \]
      12. lower-/.f6480.0

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

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

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

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

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

        \[\leadsto \left(2 \cdot \frac{u}{{t1}^{2}} - \frac{1}{t1}\right) \cdot v \]
      4. *-commutativeN/A

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

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

        \[\leadsto \left(\frac{u}{{t1}^{2}} \cdot 2 - \frac{1}{t1}\right) \cdot v \]
      7. unpow2N/A

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

        \[\leadsto \left(\frac{u}{t1 \cdot t1} \cdot 2 - \frac{1}{t1}\right) \cdot v \]
      9. inv-powN/A

        \[\leadsto \left(\frac{u}{t1 \cdot t1} \cdot 2 - {t1}^{-1}\right) \cdot v \]
      10. lower-pow.f6480.9

        \[\leadsto \left(\frac{u}{t1 \cdot t1} \cdot 2 - {t1}^{-1}\right) \cdot v \]
    8. Applied rewrites80.9%

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

    if -1.9000000000000001e-15 < t1 < 1.32e16

    1. Initial program 84.4%

      \[\frac{\left(-t1\right) \cdot v}{\left(t1 + u\right) \cdot \left(t1 + u\right)} \]
    2. Add Preprocessing
    3. 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-neg.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-1 \cdot t1}{u + t1} \cdot \frac{v}{\color{blue}{u + t1}} \]
      16. lower-+.f6496.2

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

      \[\leadsto \color{blue}{\frac{-1 \cdot t1}{u + t1} \cdot \frac{v}{u + t1}} \]
    5. Taylor expanded in t1 around 0

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

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

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

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

        \[\leadsto \left(\left(\frac{t1}{{u}^{2}} - \frac{1}{u}\right) \cdot t1\right) \cdot \frac{v}{u + t1} \]
      5. unpow2N/A

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

        \[\leadsto \left(\left(\frac{t1}{u \cdot u} - \frac{1}{u}\right) \cdot t1\right) \cdot \frac{v}{u + t1} \]
      7. inv-powN/A

        \[\leadsto \left(\left(\frac{t1}{u \cdot u} - {u}^{-1}\right) \cdot t1\right) \cdot \frac{v}{u + t1} \]
      8. lower-pow.f6478.5

        \[\leadsto \left(\left(\frac{t1}{u \cdot u} - {u}^{-1}\right) \cdot t1\right) \cdot \frac{v}{u + t1} \]
    7. Applied rewrites78.5%

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

    if 1.32e16 < t1

    1. Initial program 56.4%

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

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

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

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

        \[\leadsto \frac{2 \cdot \left(u \cdot v\right)}{t1 \cdot t1} + -1 \cdot \frac{v}{t1} \]
      4. times-fracN/A

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{2}{t1}, u \cdot \frac{v}{t1}, \frac{v}{t1} \cdot -1\right) \]
      12. lower-/.f6483.4

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

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

Alternative 7: 52.7% accurate, N/A× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(\frac{2}{t1}, u \cdot \frac{v}{t1}, \frac{v}{t1} \cdot -1\right) \end{array} \]
(FPCore (u v t1)
 :precision binary64
 (fma (/ 2.0 t1) (* u (/ v t1)) (* (/ v t1) -1.0)))
double code(double u, double v, double t1) {
	return fma((2.0 / t1), (u * (v / t1)), ((v / t1) * -1.0));
}
function code(u, v, t1)
	return fma(Float64(2.0 / t1), Float64(u * Float64(v / t1)), Float64(Float64(v / t1) * -1.0))
end
code[u_, v_, t1_] := N[(N[(2.0 / t1), $MachinePrecision] * N[(u * N[(v / t1), $MachinePrecision]), $MachinePrecision] + N[(N[(v / t1), $MachinePrecision] * -1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

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

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

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

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

      \[\leadsto \frac{2 \cdot \left(u \cdot v\right)}{t1 \cdot t1} + -1 \cdot \frac{v}{t1} \]
    4. times-fracN/A

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\frac{2}{t1}, u \cdot \frac{v}{t1}, \frac{v}{t1} \cdot -1\right) \]
    12. lower-/.f6447.1

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

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

Alternative 8: 50.8% accurate, N/A× speedup?

\[\begin{array}{l} \\ \left(\frac{u}{t1 \cdot t1} \cdot 2 - {t1}^{-1}\right) \cdot v \end{array} \]
(FPCore (u v t1)
 :precision binary64
 (* (- (* (/ u (* t1 t1)) 2.0) (pow t1 -1.0)) v))
double code(double u, double v, double t1) {
	return (((u / (t1 * t1)) * 2.0) - pow(t1, -1.0)) * v;
}
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 = (((u / (t1 * t1)) * 2.0d0) - (t1 ** (-1.0d0))) * v
end function
public static double code(double u, double v, double t1) {
	return (((u / (t1 * t1)) * 2.0) - Math.pow(t1, -1.0)) * v;
}
def code(u, v, t1):
	return (((u / (t1 * t1)) * 2.0) - math.pow(t1, -1.0)) * v
function code(u, v, t1)
	return Float64(Float64(Float64(Float64(u / Float64(t1 * t1)) * 2.0) - (t1 ^ -1.0)) * v)
end
function tmp = code(u, v, t1)
	tmp = (((u / (t1 * t1)) * 2.0) - (t1 ^ -1.0)) * v;
end
code[u_, v_, t1_] := N[(N[(N[(N[(u / N[(t1 * t1), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision] - N[Power[t1, -1.0], $MachinePrecision]), $MachinePrecision] * v), $MachinePrecision]
\begin{array}{l}

\\
\left(\frac{u}{t1 \cdot t1} \cdot 2 - {t1}^{-1}\right) \cdot v
\end{array}
Derivation
  1. Initial program 71.5%

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

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

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

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

      \[\leadsto \frac{2 \cdot \left(u \cdot v\right)}{t1 \cdot t1} + -1 \cdot \frac{v}{t1} \]
    4. times-fracN/A

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\frac{2}{t1}, u \cdot \frac{v}{t1}, \frac{v}{t1} \cdot -1\right) \]
    12. lower-/.f6447.1

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

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

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

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

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

      \[\leadsto \left(2 \cdot \frac{u}{{t1}^{2}} - \frac{1}{t1}\right) \cdot v \]
    4. *-commutativeN/A

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

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

      \[\leadsto \left(\frac{u}{{t1}^{2}} \cdot 2 - \frac{1}{t1}\right) \cdot v \]
    7. unpow2N/A

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

      \[\leadsto \left(\frac{u}{t1 \cdot t1} \cdot 2 - \frac{1}{t1}\right) \cdot v \]
    9. inv-powN/A

      \[\leadsto \left(\frac{u}{t1 \cdot t1} \cdot 2 - {t1}^{-1}\right) \cdot v \]
    10. lower-pow.f6446.3

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

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

Reproduce

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