Trigonometry A

Percentage Accurate: 99.8% → 99.8%
Time: 4.6s
Alternatives: 14
Speedup: N/A×

Specification

?
\[0 \leq e \land e \leq 1\]
\[\begin{array}{l} \\ \frac{e \cdot \sin v}{1 + e \cdot \cos v} \end{array} \]
(FPCore (e v) :precision binary64 (/ (* e (sin v)) (+ 1.0 (* e (cos v)))))
double code(double e, double v) {
	return (e * sin(v)) / (1.0 + (e * cos(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(e, v)
use fmin_fmax_functions
    real(8), intent (in) :: e
    real(8), intent (in) :: v
    code = (e * sin(v)) / (1.0d0 + (e * cos(v)))
end function
public static double code(double e, double v) {
	return (e * Math.sin(v)) / (1.0 + (e * Math.cos(v)));
}
def code(e, v):
	return (e * math.sin(v)) / (1.0 + (e * math.cos(v)))
function code(e, v)
	return Float64(Float64(e * sin(v)) / Float64(1.0 + Float64(e * cos(v))))
end
function tmp = code(e, v)
	tmp = (e * sin(v)) / (1.0 + (e * cos(v)));
end
code[e_, v_] := N[(N[(e * N[Sin[v], $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(e * N[Cos[v], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{e \cdot \sin v}{1 + e \cdot \cos v}
\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 14 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: 99.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{e \cdot \sin v}{1 + e \cdot \cos v} \end{array} \]
(FPCore (e v) :precision binary64 (/ (* e (sin v)) (+ 1.0 (* e (cos v)))))
double code(double e, double v) {
	return (e * sin(v)) / (1.0 + (e * cos(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(e, v)
use fmin_fmax_functions
    real(8), intent (in) :: e
    real(8), intent (in) :: v
    code = (e * sin(v)) / (1.0d0 + (e * cos(v)))
end function
public static double code(double e, double v) {
	return (e * Math.sin(v)) / (1.0 + (e * Math.cos(v)));
}
def code(e, v):
	return (e * math.sin(v)) / (1.0 + (e * math.cos(v)))
function code(e, v)
	return Float64(Float64(e * sin(v)) / Float64(1.0 + Float64(e * cos(v))))
end
function tmp = code(e, v)
	tmp = (e * sin(v)) / (1.0 + (e * cos(v)));
end
code[e_, v_] := N[(N[(e * N[Sin[v], $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(e * N[Cos[v], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{e \cdot \sin v}{1 + e \cdot \cos v}
\end{array}

Alternative 1: 99.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ e \cdot \frac{\sin v}{\mathsf{fma}\left(\cos v, e, 1\right)} \end{array} \]
(FPCore (e v) :precision binary64 (* e (/ (sin v) (fma (cos v) e 1.0))))
double code(double e, double v) {
	return e * (sin(v) / fma(cos(v), e, 1.0));
}
function code(e, v)
	return Float64(e * Float64(sin(v) / fma(cos(v), e, 1.0)))
end
code[e_, v_] := N[(e * N[(N[Sin[v], $MachinePrecision] / N[(N[Cos[v], $MachinePrecision] * e + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
e \cdot \frac{\sin v}{\mathsf{fma}\left(\cos v, e, 1\right)}
\end{array}
Derivation
  1. Initial program 99.8%

    \[\frac{e \cdot \sin v}{1 + e \cdot \cos v} \]
  2. Step-by-step derivation
    1. lift-/.f64N/A

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

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

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

      \[\leadsto \frac{e \cdot \sin v}{\color{blue}{1 + e \cdot \cos v}} \]
    5. lift-*.f64N/A

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

      \[\leadsto \frac{e \cdot \sin v}{1 + e \cdot \color{blue}{\cos v}} \]
    7. associate-/l*N/A

      \[\leadsto \color{blue}{e \cdot \frac{\sin v}{1 + e \cdot \cos v}} \]
    8. lower-*.f64N/A

      \[\leadsto \color{blue}{e \cdot \frac{\sin v}{1 + e \cdot \cos v}} \]
    9. lower-/.f64N/A

      \[\leadsto e \cdot \color{blue}{\frac{\sin v}{1 + e \cdot \cos v}} \]
    10. lift-sin.f64N/A

      \[\leadsto e \cdot \frac{\color{blue}{\sin v}}{1 + e \cdot \cos v} \]
    11. +-commutativeN/A

      \[\leadsto e \cdot \frac{\sin v}{\color{blue}{e \cdot \cos v + 1}} \]
    12. *-commutativeN/A

      \[\leadsto e \cdot \frac{\sin v}{\color{blue}{\cos v \cdot e} + 1} \]
    13. lower-fma.f64N/A

      \[\leadsto e \cdot \frac{\sin v}{\color{blue}{\mathsf{fma}\left(\cos v, e, 1\right)}} \]
    14. lift-cos.f6499.8

      \[\leadsto e \cdot \frac{\sin v}{\mathsf{fma}\left(\color{blue}{\cos v}, e, 1\right)} \]
  3. Applied rewrites99.8%

    \[\leadsto \color{blue}{e \cdot \frac{\sin v}{\mathsf{fma}\left(\cos v, e, 1\right)}} \]
  4. Add Preprocessing

Alternative 2: 99.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \sin v \cdot \frac{e}{\mathsf{fma}\left(\cos v, e, 1\right)} \end{array} \]
(FPCore (e v) :precision binary64 (* (sin v) (/ e (fma (cos v) e 1.0))))
double code(double e, double v) {
	return sin(v) * (e / fma(cos(v), e, 1.0));
}
function code(e, v)
	return Float64(sin(v) * Float64(e / fma(cos(v), e, 1.0)))
end
code[e_, v_] := N[(N[Sin[v], $MachinePrecision] * N[(e / N[(N[Cos[v], $MachinePrecision] * e + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\sin v \cdot \frac{e}{\mathsf{fma}\left(\cos v, e, 1\right)}
\end{array}
Derivation
  1. Initial program 99.8%

    \[\frac{e \cdot \sin v}{1 + e \cdot \cos v} \]
  2. Step-by-step derivation
    1. lift-/.f64N/A

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

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

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

      \[\leadsto \frac{e \cdot \sin v}{\color{blue}{1 + e \cdot \cos v}} \]
    5. lift-*.f64N/A

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

      \[\leadsto \frac{e \cdot \sin v}{1 + e \cdot \color{blue}{\cos v}} \]
    7. associate-/l*N/A

      \[\leadsto \color{blue}{e \cdot \frac{\sin v}{1 + e \cdot \cos v}} \]
    8. lower-*.f64N/A

      \[\leadsto \color{blue}{e \cdot \frac{\sin v}{1 + e \cdot \cos v}} \]
    9. lower-/.f64N/A

      \[\leadsto e \cdot \color{blue}{\frac{\sin v}{1 + e \cdot \cos v}} \]
    10. lift-sin.f64N/A

      \[\leadsto e \cdot \frac{\color{blue}{\sin v}}{1 + e \cdot \cos v} \]
    11. +-commutativeN/A

      \[\leadsto e \cdot \frac{\sin v}{\color{blue}{e \cdot \cos v + 1}} \]
    12. *-commutativeN/A

      \[\leadsto e \cdot \frac{\sin v}{\color{blue}{\cos v \cdot e} + 1} \]
    13. lower-fma.f64N/A

      \[\leadsto e \cdot \frac{\sin v}{\color{blue}{\mathsf{fma}\left(\cos v, e, 1\right)}} \]
    14. lift-cos.f6499.8

      \[\leadsto e \cdot \frac{\sin v}{\mathsf{fma}\left(\color{blue}{\cos v}, e, 1\right)} \]
  3. Applied rewrites99.8%

    \[\leadsto \color{blue}{e \cdot \frac{\sin v}{\mathsf{fma}\left(\cos v, e, 1\right)}} \]
  4. Step-by-step derivation
    1. lift-*.f64N/A

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

      \[\leadsto e \cdot \color{blue}{\frac{\sin v}{\mathsf{fma}\left(\cos v, e, 1\right)}} \]
    3. lift-sin.f64N/A

      \[\leadsto e \cdot \frac{\color{blue}{\sin v}}{\mathsf{fma}\left(\cos v, e, 1\right)} \]
    4. lift-cos.f64N/A

      \[\leadsto e \cdot \frac{\sin v}{\mathsf{fma}\left(\color{blue}{\cos v}, e, 1\right)} \]
    5. lift-fma.f64N/A

      \[\leadsto e \cdot \frac{\sin v}{\color{blue}{\cos v \cdot e + 1}} \]
    6. associate-*r/N/A

      \[\leadsto \color{blue}{\frac{e \cdot \sin v}{\cos v \cdot e + 1}} \]
    7. *-commutativeN/A

      \[\leadsto \frac{\color{blue}{\sin v \cdot e}}{\cos v \cdot e + 1} \]
    8. associate-/l*N/A

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

      \[\leadsto \color{blue}{\sin v \cdot \frac{e}{\cos v \cdot e + 1}} \]
    10. lift-sin.f64N/A

      \[\leadsto \color{blue}{\sin v} \cdot \frac{e}{\cos v \cdot e + 1} \]
    11. lower-/.f64N/A

      \[\leadsto \sin v \cdot \color{blue}{\frac{e}{\cos v \cdot e + 1}} \]
    12. lift-fma.f64N/A

      \[\leadsto \sin v \cdot \frac{e}{\color{blue}{\mathsf{fma}\left(\cos v, e, 1\right)}} \]
    13. lift-cos.f6499.8

      \[\leadsto \sin v \cdot \frac{e}{\mathsf{fma}\left(\color{blue}{\cos v}, e, 1\right)} \]
  5. Applied rewrites99.8%

    \[\leadsto \color{blue}{\sin v \cdot \frac{e}{\mathsf{fma}\left(\cos v, e, 1\right)}} \]
  6. Add Preprocessing

Alternative 3: 99.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{\sin v}{\cos v + \frac{1}{e}} \end{array} \]
(FPCore (e v) :precision binary64 (/ (sin v) (+ (cos v) (/ 1.0 e))))
double code(double e, double v) {
	return sin(v) / (cos(v) + (1.0 / e));
}
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(e, v)
use fmin_fmax_functions
    real(8), intent (in) :: e
    real(8), intent (in) :: v
    code = sin(v) / (cos(v) + (1.0d0 / e))
end function
public static double code(double e, double v) {
	return Math.sin(v) / (Math.cos(v) + (1.0 / e));
}
def code(e, v):
	return math.sin(v) / (math.cos(v) + (1.0 / e))
function code(e, v)
	return Float64(sin(v) / Float64(cos(v) + Float64(1.0 / e)))
end
function tmp = code(e, v)
	tmp = sin(v) / (cos(v) + (1.0 / e));
end
code[e_, v_] := N[(N[Sin[v], $MachinePrecision] / N[(N[Cos[v], $MachinePrecision] + N[(1.0 / e), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\sin v}{\cos v + \frac{1}{e}}
\end{array}
Derivation
  1. Initial program 99.8%

    \[\frac{e \cdot \sin v}{1 + e \cdot \cos v} \]
  2. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto \frac{\color{blue}{e \cdot \sin v}}{1 + e \cdot \cos v} \]
    2. lift-sin.f64N/A

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

      \[\leadsto \frac{\color{blue}{\sin v \cdot e}}{1 + e \cdot \cos v} \]
    4. lower-*.f64N/A

      \[\leadsto \frac{\color{blue}{\sin v \cdot e}}{1 + e \cdot \cos v} \]
    5. lift-sin.f6499.8

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

      \[\leadsto \frac{\sin v \cdot e}{\color{blue}{1 + e \cdot \cos v}} \]
    7. lift-*.f64N/A

      \[\leadsto \frac{\sin v \cdot e}{1 + \color{blue}{e \cdot \cos v}} \]
    8. lift-cos.f64N/A

      \[\leadsto \frac{\sin v \cdot e}{1 + e \cdot \color{blue}{\cos v}} \]
    9. +-commutativeN/A

      \[\leadsto \frac{\sin v \cdot e}{\color{blue}{e \cdot \cos v + 1}} \]
    10. *-commutativeN/A

      \[\leadsto \frac{\sin v \cdot e}{\color{blue}{\cos v \cdot e} + 1} \]
    11. lower-fma.f64N/A

      \[\leadsto \frac{\sin v \cdot e}{\color{blue}{\mathsf{fma}\left(\cos v, e, 1\right)}} \]
    12. lift-cos.f6499.8

      \[\leadsto \frac{\sin v \cdot e}{\mathsf{fma}\left(\color{blue}{\cos v}, e, 1\right)} \]
  3. Applied rewrites99.8%

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

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

      \[\leadsto \frac{\sin v \cdot e}{\color{blue}{\cos v \cdot e + 1}} \]
    3. metadata-evalN/A

      \[\leadsto \frac{\sin v \cdot e}{\cos v \cdot e + \color{blue}{{e}^{0}}} \]
    4. metadata-evalN/A

      \[\leadsto \frac{\sin v \cdot e}{\cos v \cdot e + {e}^{\color{blue}{\left(-1 + 1\right)}}} \]
    5. pow-plusN/A

      \[\leadsto \frac{\sin v \cdot e}{\cos v \cdot e + \color{blue}{{e}^{-1} \cdot e}} \]
    6. inv-powN/A

      \[\leadsto \frac{\sin v \cdot e}{\cos v \cdot e + \color{blue}{\frac{1}{e}} \cdot e} \]
    7. distribute-rgt-inN/A

      \[\leadsto \frac{\sin v \cdot e}{\color{blue}{e \cdot \left(\cos v + \frac{1}{e}\right)}} \]
    8. *-commutativeN/A

      \[\leadsto \frac{\sin v \cdot e}{\color{blue}{\left(\cos v + \frac{1}{e}\right) \cdot e}} \]
    9. lower-*.f64N/A

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

      \[\leadsto \frac{\sin v \cdot e}{\color{blue}{\left(\cos v + \frac{1}{e}\right)} \cdot e} \]
    11. lift-cos.f64N/A

      \[\leadsto \frac{\sin v \cdot e}{\left(\color{blue}{\cos v} + \frac{1}{e}\right) \cdot e} \]
    12. lower-/.f6499.7

      \[\leadsto \frac{\sin v \cdot e}{\left(\cos v + \color{blue}{\frac{1}{e}}\right) \cdot e} \]
  5. Applied rewrites99.7%

    \[\leadsto \frac{\sin v \cdot e}{\color{blue}{\left(\cos v + \frac{1}{e}\right) \cdot e}} \]
  6. Taylor expanded in v around inf

    \[\leadsto \color{blue}{\frac{\sin v}{\cos v + \frac{1}{e}}} \]
  7. Step-by-step derivation
    1. lower-/.f64N/A

      \[\leadsto \frac{\sin v}{\color{blue}{\cos v + \frac{1}{e}}} \]
    2. lift-sin.f64N/A

      \[\leadsto \frac{\sin v}{\color{blue}{\cos v} + \frac{1}{e}} \]
    3. lift-cos.f64N/A

      \[\leadsto \frac{\sin v}{\cos v + \frac{\color{blue}{1}}{e}} \]
    4. lift-/.f64N/A

      \[\leadsto \frac{\sin v}{\cos v + \frac{1}{\color{blue}{e}}} \]
    5. lift-+.f6499.6

      \[\leadsto \frac{\sin v}{\cos v + \color{blue}{\frac{1}{e}}} \]
  8. Applied rewrites99.6%

    \[\leadsto \color{blue}{\frac{\sin v}{\cos v + \frac{1}{e}}} \]
  9. Add Preprocessing

Alternative 4: 98.9% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;v \leq 0.00064:\\ \;\;\;\;\frac{\mathsf{fma}\left(\left(v \cdot v\right) \cdot e, -0.16666666666666666, e\right) \cdot v}{1 + e}\\ \mathbf{else}:\\ \;\;\;\;\sin v \cdot e\\ \end{array} \end{array} \]
(FPCore (e v)
 :precision binary64
 (if (<= v 0.00064)
   (/ (* (fma (* (* v v) e) -0.16666666666666666 e) v) (+ 1.0 e))
   (* (sin v) e)))
double code(double e, double v) {
	double tmp;
	if (v <= 0.00064) {
		tmp = (fma(((v * v) * e), -0.16666666666666666, e) * v) / (1.0 + e);
	} else {
		tmp = sin(v) * e;
	}
	return tmp;
}
function code(e, v)
	tmp = 0.0
	if (v <= 0.00064)
		tmp = Float64(Float64(fma(Float64(Float64(v * v) * e), -0.16666666666666666, e) * v) / Float64(1.0 + e));
	else
		tmp = Float64(sin(v) * e);
	end
	return tmp
end
code[e_, v_] := If[LessEqual[v, 0.00064], N[(N[(N[(N[(N[(v * v), $MachinePrecision] * e), $MachinePrecision] * -0.16666666666666666 + e), $MachinePrecision] * v), $MachinePrecision] / N[(1.0 + e), $MachinePrecision]), $MachinePrecision], N[(N[Sin[v], $MachinePrecision] * e), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;v \leq 0.00064:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(v \cdot v\right) \cdot e, -0.16666666666666666, e\right) \cdot v}{1 + e}\\

\mathbf{else}:\\
\;\;\;\;\sin v \cdot e\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if v < 6.40000000000000052e-4

    1. Initial program 99.8%

      \[\frac{e \cdot \sin v}{1 + e \cdot \cos v} \]
    2. Taylor expanded in v around 0

      \[\leadsto \frac{e \cdot \sin v}{1 + \color{blue}{e}} \]
    3. Step-by-step derivation
      1. Applied rewrites99.2%

        \[\leadsto \frac{e \cdot \sin v}{1 + \color{blue}{e}} \]
      2. Taylor expanded in v around 0

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

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

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

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

          \[\leadsto \frac{\left(\frac{-1}{6} \cdot \left(e \cdot {v}^{2}\right) + e\right) \cdot v}{1 + e} \]
        5. *-commutativeN/A

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

          \[\leadsto \frac{\mathsf{fma}\left(e \cdot {v}^{2}, \frac{-1}{6}, e\right) \cdot v}{1 + e} \]
        7. *-commutativeN/A

          \[\leadsto \frac{\mathsf{fma}\left({v}^{2} \cdot e, \frac{-1}{6}, e\right) \cdot v}{1 + e} \]
        8. lower-*.f64N/A

          \[\leadsto \frac{\mathsf{fma}\left({v}^{2} \cdot e, \frac{-1}{6}, e\right) \cdot v}{1 + e} \]
        9. pow2N/A

          \[\leadsto \frac{\mathsf{fma}\left(\left(v \cdot v\right) \cdot e, \frac{-1}{6}, e\right) \cdot v}{1 + e} \]
        10. lift-*.f6468.1

          \[\leadsto \frac{\mathsf{fma}\left(\left(v \cdot v\right) \cdot e, -0.16666666666666666, e\right) \cdot v}{1 + e} \]
      4. Applied rewrites68.1%

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\left(v \cdot v\right) \cdot e, -0.16666666666666666, e\right) \cdot v}}{1 + e} \]

      if 6.40000000000000052e-4 < v

      1. Initial program 99.6%

        \[\frac{e \cdot \sin v}{1 + e \cdot \cos v} \]
      2. Taylor expanded in e around 0

        \[\leadsto \color{blue}{e \cdot \sin v} \]
      3. Step-by-step derivation
        1. *-commutativeN/A

          \[\leadsto \sin v \cdot \color{blue}{e} \]
        2. lower-*.f64N/A

          \[\leadsto \sin v \cdot \color{blue}{e} \]
        3. lift-sin.f6497.9

          \[\leadsto \sin v \cdot e \]
      4. Applied rewrites97.9%

        \[\leadsto \color{blue}{\sin v \cdot e} \]
    4. Recombined 2 regimes into one program.
    5. Add Preprocessing

    Alternative 5: 98.9% accurate, 1.8× speedup?

    \[\begin{array}{l} \\ \frac{\sin v \cdot e}{e + 1} \end{array} \]
    (FPCore (e v) :precision binary64 (/ (* (sin v) e) (+ e 1.0)))
    double code(double e, double v) {
    	return (sin(v) * e) / (e + 1.0);
    }
    
    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(e, v)
    use fmin_fmax_functions
        real(8), intent (in) :: e
        real(8), intent (in) :: v
        code = (sin(v) * e) / (e + 1.0d0)
    end function
    
    public static double code(double e, double v) {
    	return (Math.sin(v) * e) / (e + 1.0);
    }
    
    def code(e, v):
    	return (math.sin(v) * e) / (e + 1.0)
    
    function code(e, v)
    	return Float64(Float64(sin(v) * e) / Float64(e + 1.0))
    end
    
    function tmp = code(e, v)
    	tmp = (sin(v) * e) / (e + 1.0);
    end
    
    code[e_, v_] := N[(N[(N[Sin[v], $MachinePrecision] * e), $MachinePrecision] / N[(e + 1.0), $MachinePrecision]), $MachinePrecision]
    
    \begin{array}{l}
    
    \\
    \frac{\sin v \cdot e}{e + 1}
    \end{array}
    
    Derivation
    1. Initial program 99.8%

      \[\frac{e \cdot \sin v}{1 + e \cdot \cos v} \]
    2. Taylor expanded in v around 0

      \[\leadsto \frac{e \cdot \sin v}{1 + \color{blue}{e}} \]
    3. Step-by-step derivation
      1. Applied rewrites98.9%

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

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

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

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

          \[\leadsto \frac{\color{blue}{\sin v} \cdot e}{1 + e} \]
        5. lift-*.f6498.9

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

          \[\leadsto \frac{\sin v \cdot e}{\color{blue}{1 + e}} \]
        7. +-commutativeN/A

          \[\leadsto \frac{\sin v \cdot e}{\color{blue}{e + 1}} \]
        8. lower-+.f6498.9

          \[\leadsto \frac{\sin v \cdot e}{\color{blue}{e + 1}} \]
      3. Applied rewrites98.9%

        \[\leadsto \color{blue}{\frac{\sin v \cdot e}{e + 1}} \]
      4. Add Preprocessing

      Alternative 6: 75.8% accurate, 1.8× speedup?

      \[\begin{array}{l} \\ \sin v \cdot \frac{e}{e + 1} \end{array} \]
      (FPCore (e v) :precision binary64 (* (sin v) (/ e (+ e 1.0))))
      double code(double e, double v) {
      	return sin(v) * (e / (e + 1.0));
      }
      
      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(e, v)
      use fmin_fmax_functions
          real(8), intent (in) :: e
          real(8), intent (in) :: v
          code = sin(v) * (e / (e + 1.0d0))
      end function
      
      public static double code(double e, double v) {
      	return Math.sin(v) * (e / (e + 1.0));
      }
      
      def code(e, v):
      	return math.sin(v) * (e / (e + 1.0))
      
      function code(e, v)
      	return Float64(sin(v) * Float64(e / Float64(e + 1.0)))
      end
      
      function tmp = code(e, v)
      	tmp = sin(v) * (e / (e + 1.0));
      end
      
      code[e_, v_] := N[(N[Sin[v], $MachinePrecision] * N[(e / N[(e + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
      
      \begin{array}{l}
      
      \\
      \sin v \cdot \frac{e}{e + 1}
      \end{array}
      
      Derivation
      1. Initial program 99.8%

        \[\frac{e \cdot \sin v}{1 + e \cdot \cos v} \]
      2. Taylor expanded in v around 0

        \[\leadsto \frac{e \cdot \sin v}{1 + \color{blue}{e}} \]
      3. Step-by-step derivation
        1. Applied rewrites98.9%

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

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

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

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

            \[\leadsto \frac{\color{blue}{\sin v} \cdot e}{1 + e} \]
          5. lift-*.f6498.9

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

            \[\leadsto \frac{\sin v \cdot e}{\color{blue}{1 + e}} \]
          7. +-commutativeN/A

            \[\leadsto \frac{\sin v \cdot e}{\color{blue}{e + 1}} \]
          8. lower-+.f6498.9

            \[\leadsto \frac{\sin v \cdot e}{\color{blue}{e + 1}} \]
        3. Applied rewrites98.9%

          \[\leadsto \color{blue}{\frac{\sin v \cdot e}{e + 1}} \]
        4. Step-by-step derivation
          1. lift-/.f64N/A

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

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

            \[\leadsto \frac{\color{blue}{\sin v} \cdot e}{e + 1} \]
          4. associate-/l*N/A

            \[\leadsto \color{blue}{\sin v \cdot \frac{e}{e + 1}} \]
          5. lower-*.f64N/A

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

            \[\leadsto \color{blue}{\sin v} \cdot \frac{e}{e + 1} \]
          7. lower-/.f6498.9

            \[\leadsto \sin v \cdot \color{blue}{\frac{e}{e + 1}} \]
        5. Applied rewrites98.9%

          \[\leadsto \color{blue}{\sin v \cdot \frac{e}{e + 1}} \]
        6. Add Preprocessing

        Alternative 7: 52.7% accurate, 2.3× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;v \leq 75000000:\\ \;\;\;\;\frac{e \cdot \left(\mathsf{fma}\left(0.008333333333333333 \cdot \left(v \cdot v\right) - 0.16666666666666666, v \cdot v, 1\right) \cdot v\right)}{1 + e}\\ \mathbf{else}:\\ \;\;\;\;e \cdot \left(\left(-e\right) \cdot v\right)\\ \end{array} \end{array} \]
        (FPCore (e v)
         :precision binary64
         (if (<= v 75000000.0)
           (/
            (*
             e
             (*
              (fma
               (- (* 0.008333333333333333 (* v v)) 0.16666666666666666)
               (* v v)
               1.0)
              v))
            (+ 1.0 e))
           (* e (* (- e) v))))
        double code(double e, double v) {
        	double tmp;
        	if (v <= 75000000.0) {
        		tmp = (e * (fma(((0.008333333333333333 * (v * v)) - 0.16666666666666666), (v * v), 1.0) * v)) / (1.0 + e);
        	} else {
        		tmp = e * (-e * v);
        	}
        	return tmp;
        }
        
        function code(e, v)
        	tmp = 0.0
        	if (v <= 75000000.0)
        		tmp = Float64(Float64(e * Float64(fma(Float64(Float64(0.008333333333333333 * Float64(v * v)) - 0.16666666666666666), Float64(v * v), 1.0) * v)) / Float64(1.0 + e));
        	else
        		tmp = Float64(e * Float64(Float64(-e) * v));
        	end
        	return tmp
        end
        
        code[e_, v_] := If[LessEqual[v, 75000000.0], N[(N[(e * N[(N[(N[(N[(0.008333333333333333 * N[(v * v), $MachinePrecision]), $MachinePrecision] - 0.16666666666666666), $MachinePrecision] * N[(v * v), $MachinePrecision] + 1.0), $MachinePrecision] * v), $MachinePrecision]), $MachinePrecision] / N[(1.0 + e), $MachinePrecision]), $MachinePrecision], N[(e * N[((-e) * v), $MachinePrecision]), $MachinePrecision]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;v \leq 75000000:\\
        \;\;\;\;\frac{e \cdot \left(\mathsf{fma}\left(0.008333333333333333 \cdot \left(v \cdot v\right) - 0.16666666666666666, v \cdot v, 1\right) \cdot v\right)}{1 + e}\\
        
        \mathbf{else}:\\
        \;\;\;\;e \cdot \left(\left(-e\right) \cdot v\right)\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if v < 7.5e7

          1. Initial program 99.8%

            \[\frac{e \cdot \sin v}{1 + e \cdot \cos v} \]
          2. Taylor expanded in v around 0

            \[\leadsto \frac{e \cdot \sin v}{1 + \color{blue}{e}} \]
          3. Step-by-step derivation
            1. Applied rewrites99.2%

              \[\leadsto \frac{e \cdot \sin v}{1 + \color{blue}{e}} \]
            2. Taylor expanded in v around 0

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

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

                \[\leadsto \frac{e \cdot \left(\left(1 + {v}^{2} \cdot \left(\frac{1}{120} \cdot {v}^{2} - \frac{1}{6}\right)\right) \cdot \color{blue}{v}\right)}{1 + e} \]
              3. +-commutativeN/A

                \[\leadsto \frac{e \cdot \left(\left({v}^{2} \cdot \left(\frac{1}{120} \cdot {v}^{2} - \frac{1}{6}\right) + 1\right) \cdot v\right)}{1 + e} \]
              4. *-commutativeN/A

                \[\leadsto \frac{e \cdot \left(\left(\left(\frac{1}{120} \cdot {v}^{2} - \frac{1}{6}\right) \cdot {v}^{2} + 1\right) \cdot v\right)}{1 + e} \]
              5. lower-fma.f64N/A

                \[\leadsto \frac{e \cdot \left(\mathsf{fma}\left(\frac{1}{120} \cdot {v}^{2} - \frac{1}{6}, {v}^{2}, 1\right) \cdot v\right)}{1 + e} \]
              6. lower--.f64N/A

                \[\leadsto \frac{e \cdot \left(\mathsf{fma}\left(\frac{1}{120} \cdot {v}^{2} - \frac{1}{6}, {v}^{2}, 1\right) \cdot v\right)}{1 + e} \]
              7. lower-*.f64N/A

                \[\leadsto \frac{e \cdot \left(\mathsf{fma}\left(\frac{1}{120} \cdot {v}^{2} - \frac{1}{6}, {v}^{2}, 1\right) \cdot v\right)}{1 + e} \]
              8. pow2N/A

                \[\leadsto \frac{e \cdot \left(\mathsf{fma}\left(\frac{1}{120} \cdot \left(v \cdot v\right) - \frac{1}{6}, {v}^{2}, 1\right) \cdot v\right)}{1 + e} \]
              9. lift-*.f64N/A

                \[\leadsto \frac{e \cdot \left(\mathsf{fma}\left(\frac{1}{120} \cdot \left(v \cdot v\right) - \frac{1}{6}, {v}^{2}, 1\right) \cdot v\right)}{1 + e} \]
              10. pow2N/A

                \[\leadsto \frac{e \cdot \left(\mathsf{fma}\left(\frac{1}{120} \cdot \left(v \cdot v\right) - \frac{1}{6}, v \cdot v, 1\right) \cdot v\right)}{1 + e} \]
              11. lift-*.f6467.6

                \[\leadsto \frac{e \cdot \left(\mathsf{fma}\left(0.008333333333333333 \cdot \left(v \cdot v\right) - 0.16666666666666666, v \cdot v, 1\right) \cdot v\right)}{1 + e} \]
            4. Applied rewrites67.6%

              \[\leadsto \frac{e \cdot \color{blue}{\left(\mathsf{fma}\left(0.008333333333333333 \cdot \left(v \cdot v\right) - 0.16666666666666666, v \cdot v, 1\right) \cdot v\right)}}{1 + e} \]

            if 7.5e7 < v

            1. Initial program 99.6%

              \[\frac{e \cdot \sin v}{1 + e \cdot \cos v} \]
            2. Taylor expanded in v around 0

              \[\leadsto \color{blue}{\frac{e \cdot v}{1 + e}} \]
            3. Step-by-step derivation
              1. associate-/l*N/A

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

                \[\leadsto e \cdot \color{blue}{\frac{v}{1 + e}} \]
              3. lower-/.f64N/A

                \[\leadsto e \cdot \frac{v}{\color{blue}{1 + e}} \]
              4. lower-+.f643.8

                \[\leadsto e \cdot \frac{v}{1 + \color{blue}{e}} \]
            4. Applied rewrites3.8%

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

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

                \[\leadsto e \cdot \left(-1 \cdot \left(e \cdot v\right) + v\right) \]
              2. lower-+.f64N/A

                \[\leadsto e \cdot \left(-1 \cdot \left(e \cdot v\right) + v\right) \]
              3. mul-1-negN/A

                \[\leadsto e \cdot \left(\left(\mathsf{neg}\left(e \cdot v\right)\right) + v\right) \]
              4. lower-neg.f64N/A

                \[\leadsto e \cdot \left(\left(-e \cdot v\right) + v\right) \]
              5. *-commutativeN/A

                \[\leadsto e \cdot \left(\left(-v \cdot e\right) + v\right) \]
              6. lower-*.f643.8

                \[\leadsto e \cdot \left(\left(-v \cdot e\right) + v\right) \]
            7. Applied rewrites3.8%

              \[\leadsto e \cdot \left(\left(-v \cdot e\right) + \color{blue}{v}\right) \]
            8. Taylor expanded in e around inf

              \[\leadsto e \cdot \left(-1 \cdot \left(e \cdot \color{blue}{v}\right)\right) \]
            9. Step-by-step derivation
              1. associate-*r*N/A

                \[\leadsto e \cdot \left(\left(-1 \cdot e\right) \cdot v\right) \]
              2. mul-1-negN/A

                \[\leadsto e \cdot \left(\left(\mathsf{neg}\left(e\right)\right) \cdot v\right) \]
              3. lower-*.f64N/A

                \[\leadsto e \cdot \left(\left(\mathsf{neg}\left(e\right)\right) \cdot v\right) \]
              4. lower-neg.f645.7

                \[\leadsto e \cdot \left(\left(-e\right) \cdot v\right) \]
            10. Applied rewrites5.7%

              \[\leadsto e \cdot \left(\left(-e\right) \cdot v\right) \]
          4. Recombined 2 regimes into one program.
          5. Add Preprocessing

          Alternative 8: 52.3% accurate, 2.6× speedup?

          \[\begin{array}{l} \\ \frac{e \cdot v}{1 + e \cdot \mathsf{fma}\left(0.041666666666666664 \cdot \left(v \cdot v\right) - 0.5, v \cdot v, 1\right)} \end{array} \]
          (FPCore (e v)
           :precision binary64
           (/
            (* e v)
            (+ 1.0 (* e (fma (- (* 0.041666666666666664 (* v v)) 0.5) (* v v) 1.0)))))
          double code(double e, double v) {
          	return (e * v) / (1.0 + (e * fma(((0.041666666666666664 * (v * v)) - 0.5), (v * v), 1.0)));
          }
          
          function code(e, v)
          	return Float64(Float64(e * v) / Float64(1.0 + Float64(e * fma(Float64(Float64(0.041666666666666664 * Float64(v * v)) - 0.5), Float64(v * v), 1.0))))
          end
          
          code[e_, v_] := N[(N[(e * v), $MachinePrecision] / N[(1.0 + N[(e * N[(N[(N[(0.041666666666666664 * N[(v * v), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision] * N[(v * v), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
          
          \begin{array}{l}
          
          \\
          \frac{e \cdot v}{1 + e \cdot \mathsf{fma}\left(0.041666666666666664 \cdot \left(v \cdot v\right) - 0.5, v \cdot v, 1\right)}
          \end{array}
          
          Derivation
          1. Initial program 99.8%

            \[\frac{e \cdot \sin v}{1 + e \cdot \cos v} \]
          2. Taylor expanded in v around 0

            \[\leadsto \frac{e \cdot \sin v}{1 + e \cdot \color{blue}{\left(1 + {v}^{2} \cdot \left(\frac{1}{24} \cdot {v}^{2} - \frac{1}{2}\right)\right)}} \]
          3. Step-by-step derivation
            1. +-commutativeN/A

              \[\leadsto \frac{e \cdot \sin v}{1 + e \cdot \left({v}^{2} \cdot \left(\frac{1}{24} \cdot {v}^{2} - \frac{1}{2}\right) + \color{blue}{1}\right)} \]
            2. *-commutativeN/A

              \[\leadsto \frac{e \cdot \sin v}{1 + e \cdot \left(\left(\frac{1}{24} \cdot {v}^{2} - \frac{1}{2}\right) \cdot {v}^{2} + 1\right)} \]
            3. lower-fma.f64N/A

              \[\leadsto \frac{e \cdot \sin v}{1 + e \cdot \mathsf{fma}\left(\frac{1}{24} \cdot {v}^{2} - \frac{1}{2}, \color{blue}{{v}^{2}}, 1\right)} \]
            4. lower--.f64N/A

              \[\leadsto \frac{e \cdot \sin v}{1 + e \cdot \mathsf{fma}\left(\frac{1}{24} \cdot {v}^{2} - \frac{1}{2}, {\color{blue}{v}}^{2}, 1\right)} \]
            5. lower-*.f64N/A

              \[\leadsto \frac{e \cdot \sin v}{1 + e \cdot \mathsf{fma}\left(\frac{1}{24} \cdot {v}^{2} - \frac{1}{2}, {v}^{2}, 1\right)} \]
            6. unpow2N/A

              \[\leadsto \frac{e \cdot \sin v}{1 + e \cdot \mathsf{fma}\left(\frac{1}{24} \cdot \left(v \cdot v\right) - \frac{1}{2}, {v}^{2}, 1\right)} \]
            7. lower-*.f64N/A

              \[\leadsto \frac{e \cdot \sin v}{1 + e \cdot \mathsf{fma}\left(\frac{1}{24} \cdot \left(v \cdot v\right) - \frac{1}{2}, {v}^{2}, 1\right)} \]
            8. unpow2N/A

              \[\leadsto \frac{e \cdot \sin v}{1 + e \cdot \mathsf{fma}\left(\frac{1}{24} \cdot \left(v \cdot v\right) - \frac{1}{2}, v \cdot \color{blue}{v}, 1\right)} \]
            9. lower-*.f6458.9

              \[\leadsto \frac{e \cdot \sin v}{1 + e \cdot \mathsf{fma}\left(0.041666666666666664 \cdot \left(v \cdot v\right) - 0.5, v \cdot \color{blue}{v}, 1\right)} \]
          4. Applied rewrites58.9%

            \[\leadsto \frac{e \cdot \sin v}{1 + e \cdot \color{blue}{\mathsf{fma}\left(0.041666666666666664 \cdot \left(v \cdot v\right) - 0.5, v \cdot v, 1\right)}} \]
          5. Taylor expanded in v around 0

            \[\leadsto \frac{e \cdot \color{blue}{v}}{1 + e \cdot \mathsf{fma}\left(\frac{1}{24} \cdot \left(v \cdot v\right) - \frac{1}{2}, v \cdot v, 1\right)} \]
          6. Step-by-step derivation
            1. Applied rewrites52.7%

              \[\leadsto \frac{e \cdot \color{blue}{v}}{1 + e \cdot \mathsf{fma}\left(0.041666666666666664 \cdot \left(v \cdot v\right) - 0.5, v \cdot v, 1\right)} \]
            2. Add Preprocessing

            Alternative 9: 51.9% accurate, 3.7× speedup?

            \[\begin{array}{l} \\ \frac{\mathsf{fma}\left(\left(v \cdot v\right) \cdot e, -0.16666666666666666, e\right) \cdot v}{1 + e} \end{array} \]
            (FPCore (e v)
             :precision binary64
             (/ (* (fma (* (* v v) e) -0.16666666666666666 e) v) (+ 1.0 e)))
            double code(double e, double v) {
            	return (fma(((v * v) * e), -0.16666666666666666, e) * v) / (1.0 + e);
            }
            
            function code(e, v)
            	return Float64(Float64(fma(Float64(Float64(v * v) * e), -0.16666666666666666, e) * v) / Float64(1.0 + e))
            end
            
            code[e_, v_] := N[(N[(N[(N[(N[(v * v), $MachinePrecision] * e), $MachinePrecision] * -0.16666666666666666 + e), $MachinePrecision] * v), $MachinePrecision] / N[(1.0 + e), $MachinePrecision]), $MachinePrecision]
            
            \begin{array}{l}
            
            \\
            \frac{\mathsf{fma}\left(\left(v \cdot v\right) \cdot e, -0.16666666666666666, e\right) \cdot v}{1 + e}
            \end{array}
            
            Derivation
            1. Initial program 99.8%

              \[\frac{e \cdot \sin v}{1 + e \cdot \cos v} \]
            2. Taylor expanded in v around 0

              \[\leadsto \frac{e \cdot \sin v}{1 + \color{blue}{e}} \]
            3. Step-by-step derivation
              1. Applied rewrites98.9%

                \[\leadsto \frac{e \cdot \sin v}{1 + \color{blue}{e}} \]
              2. Taylor expanded in v around 0

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

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

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

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

                  \[\leadsto \frac{\left(\frac{-1}{6} \cdot \left(e \cdot {v}^{2}\right) + e\right) \cdot v}{1 + e} \]
                5. *-commutativeN/A

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

                  \[\leadsto \frac{\mathsf{fma}\left(e \cdot {v}^{2}, \frac{-1}{6}, e\right) \cdot v}{1 + e} \]
                7. *-commutativeN/A

                  \[\leadsto \frac{\mathsf{fma}\left({v}^{2} \cdot e, \frac{-1}{6}, e\right) \cdot v}{1 + e} \]
                8. lower-*.f64N/A

                  \[\leadsto \frac{\mathsf{fma}\left({v}^{2} \cdot e, \frac{-1}{6}, e\right) \cdot v}{1 + e} \]
                9. pow2N/A

                  \[\leadsto \frac{\mathsf{fma}\left(\left(v \cdot v\right) \cdot e, \frac{-1}{6}, e\right) \cdot v}{1 + e} \]
                10. lift-*.f6451.5

                  \[\leadsto \frac{\mathsf{fma}\left(\left(v \cdot v\right) \cdot e, -0.16666666666666666, e\right) \cdot v}{1 + e} \]
              4. Applied rewrites51.5%

                \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\left(v \cdot v\right) \cdot e, -0.16666666666666666, e\right) \cdot v}}{1 + e} \]
              5. Add Preprocessing

              Alternative 10: 51.9% accurate, 7.6× speedup?

              \[\begin{array}{l} \\ \frac{e \cdot v}{1 + e} \end{array} \]
              (FPCore (e v) :precision binary64 (/ (* e v) (+ 1.0 e)))
              double code(double e, double v) {
              	return (e * v) / (1.0 + e);
              }
              
              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(e, v)
              use fmin_fmax_functions
                  real(8), intent (in) :: e
                  real(8), intent (in) :: v
                  code = (e * v) / (1.0d0 + e)
              end function
              
              public static double code(double e, double v) {
              	return (e * v) / (1.0 + e);
              }
              
              def code(e, v):
              	return (e * v) / (1.0 + e)
              
              function code(e, v)
              	return Float64(Float64(e * v) / Float64(1.0 + e))
              end
              
              function tmp = code(e, v)
              	tmp = (e * v) / (1.0 + e);
              end
              
              code[e_, v_] := N[(N[(e * v), $MachinePrecision] / N[(1.0 + e), $MachinePrecision]), $MachinePrecision]
              
              \begin{array}{l}
              
              \\
              \frac{e \cdot v}{1 + e}
              \end{array}
              
              Derivation
              1. Initial program 99.8%

                \[\frac{e \cdot \sin v}{1 + e \cdot \cos v} \]
              2. Taylor expanded in v around 0

                \[\leadsto \frac{e \cdot \sin v}{1 + \color{blue}{e}} \]
              3. Step-by-step derivation
                1. Applied rewrites98.9%

                  \[\leadsto \frac{e \cdot \sin v}{1 + \color{blue}{e}} \]
                2. Taylor expanded in v around 0

                  \[\leadsto \frac{e \cdot \color{blue}{v}}{1 + e} \]
                3. Step-by-step derivation
                  1. Applied rewrites51.9%

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

                  Alternative 11: 51.5% accurate, 7.6× speedup?

                  \[\begin{array}{l} \\ e \cdot \frac{v}{1 + e} \end{array} \]
                  (FPCore (e v) :precision binary64 (* e (/ v (+ 1.0 e))))
                  double code(double e, double v) {
                  	return e * (v / (1.0 + e));
                  }
                  
                  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(e, v)
                  use fmin_fmax_functions
                      real(8), intent (in) :: e
                      real(8), intent (in) :: v
                      code = e * (v / (1.0d0 + e))
                  end function
                  
                  public static double code(double e, double v) {
                  	return e * (v / (1.0 + e));
                  }
                  
                  def code(e, v):
                  	return e * (v / (1.0 + e))
                  
                  function code(e, v)
                  	return Float64(e * Float64(v / Float64(1.0 + e)))
                  end
                  
                  function tmp = code(e, v)
                  	tmp = e * (v / (1.0 + e));
                  end
                  
                  code[e_, v_] := N[(e * N[(v / N[(1.0 + e), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
                  
                  \begin{array}{l}
                  
                  \\
                  e \cdot \frac{v}{1 + e}
                  \end{array}
                  
                  Derivation
                  1. Initial program 99.8%

                    \[\frac{e \cdot \sin v}{1 + e \cdot \cos v} \]
                  2. Taylor expanded in v around 0

                    \[\leadsto \color{blue}{\frac{e \cdot v}{1 + e}} \]
                  3. Step-by-step derivation
                    1. associate-/l*N/A

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

                      \[\leadsto e \cdot \color{blue}{\frac{v}{1 + e}} \]
                    3. lower-/.f64N/A

                      \[\leadsto e \cdot \frac{v}{\color{blue}{1 + e}} \]
                    4. lower-+.f6451.9

                      \[\leadsto e \cdot \frac{v}{1 + \color{blue}{e}} \]
                  4. Applied rewrites51.9%

                    \[\leadsto \color{blue}{e \cdot \frac{v}{1 + e}} \]
                  5. Add Preprocessing

                  Alternative 12: 51.4% accurate, 8.0× speedup?

                  \[\begin{array}{l} \\ e \cdot \left(\left(1 - e\right) \cdot v\right) \end{array} \]
                  (FPCore (e v) :precision binary64 (* e (* (- 1.0 e) v)))
                  double code(double e, double v) {
                  	return e * ((1.0 - e) * 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(e, v)
                  use fmin_fmax_functions
                      real(8), intent (in) :: e
                      real(8), intent (in) :: v
                      code = e * ((1.0d0 - e) * v)
                  end function
                  
                  public static double code(double e, double v) {
                  	return e * ((1.0 - e) * v);
                  }
                  
                  def code(e, v):
                  	return e * ((1.0 - e) * v)
                  
                  function code(e, v)
                  	return Float64(e * Float64(Float64(1.0 - e) * v))
                  end
                  
                  function tmp = code(e, v)
                  	tmp = e * ((1.0 - e) * v);
                  end
                  
                  code[e_, v_] := N[(e * N[(N[(1.0 - e), $MachinePrecision] * v), $MachinePrecision]), $MachinePrecision]
                  
                  \begin{array}{l}
                  
                  \\
                  e \cdot \left(\left(1 - e\right) \cdot v\right)
                  \end{array}
                  
                  Derivation
                  1. Initial program 99.8%

                    \[\frac{e \cdot \sin v}{1 + e \cdot \cos v} \]
                  2. Taylor expanded in v around 0

                    \[\leadsto \color{blue}{\frac{e \cdot v}{1 + e}} \]
                  3. Step-by-step derivation
                    1. associate-/l*N/A

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

                      \[\leadsto e \cdot \color{blue}{\frac{v}{1 + e}} \]
                    3. lower-/.f64N/A

                      \[\leadsto e \cdot \frac{v}{\color{blue}{1 + e}} \]
                    4. lower-+.f6451.9

                      \[\leadsto e \cdot \frac{v}{1 + \color{blue}{e}} \]
                  4. Applied rewrites51.9%

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

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

                      \[\leadsto e \cdot \left(-1 \cdot \left(e \cdot v\right) + v\right) \]
                    2. lower-+.f64N/A

                      \[\leadsto e \cdot \left(-1 \cdot \left(e \cdot v\right) + v\right) \]
                    3. mul-1-negN/A

                      \[\leadsto e \cdot \left(\left(\mathsf{neg}\left(e \cdot v\right)\right) + v\right) \]
                    4. lower-neg.f64N/A

                      \[\leadsto e \cdot \left(\left(-e \cdot v\right) + v\right) \]
                    5. *-commutativeN/A

                      \[\leadsto e \cdot \left(\left(-v \cdot e\right) + v\right) \]
                    6. lower-*.f6451.4

                      \[\leadsto e \cdot \left(\left(-v \cdot e\right) + v\right) \]
                  7. Applied rewrites51.4%

                    \[\leadsto e \cdot \left(\left(-v \cdot e\right) + \color{blue}{v}\right) \]
                  8. Taylor expanded in v around 0

                    \[\leadsto e \cdot \left(v \cdot \left(1 - \color{blue}{e}\right)\right) \]
                  9. Step-by-step derivation
                    1. *-commutativeN/A

                      \[\leadsto e \cdot \left(\left(1 - e\right) \cdot v\right) \]
                    2. lower-*.f64N/A

                      \[\leadsto e \cdot \left(\left(1 - e\right) \cdot v\right) \]
                    3. lower--.f6451.4

                      \[\leadsto e \cdot \left(\left(1 - e\right) \cdot v\right) \]
                  10. Applied rewrites51.4%

                    \[\leadsto e \cdot \left(\left(1 - e\right) \cdot v\right) \]
                  11. Add Preprocessing

                  Alternative 13: 50.9% accurate, 19.4× speedup?

                  \[\begin{array}{l} \\ e \cdot v \end{array} \]
                  (FPCore (e v) :precision binary64 (* e v))
                  double code(double e, double v) {
                  	return e * 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(e, v)
                  use fmin_fmax_functions
                      real(8), intent (in) :: e
                      real(8), intent (in) :: v
                      code = e * v
                  end function
                  
                  public static double code(double e, double v) {
                  	return e * v;
                  }
                  
                  def code(e, v):
                  	return e * v
                  
                  function code(e, v)
                  	return Float64(e * v)
                  end
                  
                  function tmp = code(e, v)
                  	tmp = e * v;
                  end
                  
                  code[e_, v_] := N[(e * v), $MachinePrecision]
                  
                  \begin{array}{l}
                  
                  \\
                  e \cdot v
                  \end{array}
                  
                  Derivation
                  1. Initial program 99.8%

                    \[\frac{e \cdot \sin v}{1 + e \cdot \cos v} \]
                  2. Taylor expanded in v around 0

                    \[\leadsto \color{blue}{\frac{e \cdot v}{1 + e}} \]
                  3. Step-by-step derivation
                    1. associate-/l*N/A

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

                      \[\leadsto e \cdot \color{blue}{\frac{v}{1 + e}} \]
                    3. lower-/.f64N/A

                      \[\leadsto e \cdot \frac{v}{\color{blue}{1 + e}} \]
                    4. lower-+.f6451.9

                      \[\leadsto e \cdot \frac{v}{1 + \color{blue}{e}} \]
                  4. Applied rewrites51.9%

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

                    \[\leadsto e \cdot v \]
                  6. Step-by-step derivation
                    1. Applied rewrites50.9%

                      \[\leadsto e \cdot v \]
                    2. Add Preprocessing

                    Alternative 14: 4.5% accurate, 76.6× speedup?

                    \[\begin{array}{l} \\ v \end{array} \]
                    (FPCore (e v) :precision binary64 v)
                    double code(double e, double v) {
                    	return 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(e, v)
                    use fmin_fmax_functions
                        real(8), intent (in) :: e
                        real(8), intent (in) :: v
                        code = v
                    end function
                    
                    public static double code(double e, double v) {
                    	return v;
                    }
                    
                    def code(e, v):
                    	return v
                    
                    function code(e, v)
                    	return v
                    end
                    
                    function tmp = code(e, v)
                    	tmp = v;
                    end
                    
                    code[e_, v_] := v
                    
                    \begin{array}{l}
                    
                    \\
                    v
                    \end{array}
                    
                    Derivation
                    1. Initial program 99.8%

                      \[\frac{e \cdot \sin v}{1 + e \cdot \cos v} \]
                    2. Taylor expanded in v around 0

                      \[\leadsto \color{blue}{\frac{e \cdot v}{1 + e}} \]
                    3. Step-by-step derivation
                      1. associate-/l*N/A

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

                        \[\leadsto e \cdot \color{blue}{\frac{v}{1 + e}} \]
                      3. lower-/.f64N/A

                        \[\leadsto e \cdot \frac{v}{\color{blue}{1 + e}} \]
                      4. lower-+.f6451.9

                        \[\leadsto e \cdot \frac{v}{1 + \color{blue}{e}} \]
                    4. Applied rewrites51.9%

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

                      \[\leadsto v \]
                    6. Step-by-step derivation
                      1. Applied rewrites4.5%

                        \[\leadsto v \]
                      2. Add Preprocessing

                      Reproduce

                      ?
                      herbie shell --seed 2025124 
                      (FPCore (e v)
                        :name "Trigonometry A"
                        :precision binary64
                        :pre (and (<= 0.0 e) (<= e 1.0))
                        (/ (* e (sin v)) (+ 1.0 (* e (cos v)))))