rsin A (should all be same)

Percentage Accurate: 76.8% → 99.5%
Time: 5.2s
Alternatives: 11
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ \frac{r \cdot \sin b}{\cos \left(a + b\right)} \end{array} \]
(FPCore (r a b) :precision binary64 (/ (* r (sin b)) (cos (+ a b))))
double code(double r, double a, double b) {
	return (r * sin(b)) / cos((a + b));
}
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(r, a, b)
use fmin_fmax_functions
    real(8), intent (in) :: r
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    code = (r * sin(b)) / cos((a + b))
end function
public static double code(double r, double a, double b) {
	return (r * Math.sin(b)) / Math.cos((a + b));
}
def code(r, a, b):
	return (r * math.sin(b)) / math.cos((a + b))
function code(r, a, b)
	return Float64(Float64(r * sin(b)) / cos(Float64(a + b)))
end
function tmp = code(r, a, b)
	tmp = (r * sin(b)) / cos((a + b));
end
code[r_, a_, b_] := N[(N[(r * N[Sin[b], $MachinePrecision]), $MachinePrecision] / N[Cos[N[(a + b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{r \cdot \sin b}{\cos \left(a + b\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 11 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: 76.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{r \cdot \sin b}{\cos \left(a + b\right)} \end{array} \]
(FPCore (r a b) :precision binary64 (/ (* r (sin b)) (cos (+ a b))))
double code(double r, double a, double b) {
	return (r * sin(b)) / cos((a + b));
}
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(r, a, b)
use fmin_fmax_functions
    real(8), intent (in) :: r
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    code = (r * sin(b)) / cos((a + b))
end function
public static double code(double r, double a, double b) {
	return (r * Math.sin(b)) / Math.cos((a + b));
}
def code(r, a, b):
	return (r * math.sin(b)) / math.cos((a + b))
function code(r, a, b)
	return Float64(Float64(r * sin(b)) / cos(Float64(a + b)))
end
function tmp = code(r, a, b)
	tmp = (r * sin(b)) / cos((a + b));
end
code[r_, a_, b_] := N[(N[(r * N[Sin[b], $MachinePrecision]), $MachinePrecision] / N[Cos[N[(a + b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{r \cdot \sin b}{\cos \left(a + b\right)}
\end{array}

Alternative 1: 99.5% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \frac{r \cdot \sin b}{\cos b \cdot \cos a - \sin b \cdot \sin a} \end{array} \]
(FPCore (r a b)
 :precision binary64
 (/ (* r (sin b)) (- (* (cos b) (cos a)) (* (sin b) (sin a)))))
double code(double r, double a, double b) {
	return (r * sin(b)) / ((cos(b) * cos(a)) - (sin(b) * sin(a)));
}
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(r, a, b)
use fmin_fmax_functions
    real(8), intent (in) :: r
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    code = (r * sin(b)) / ((cos(b) * cos(a)) - (sin(b) * sin(a)))
end function
public static double code(double r, double a, double b) {
	return (r * Math.sin(b)) / ((Math.cos(b) * Math.cos(a)) - (Math.sin(b) * Math.sin(a)));
}
def code(r, a, b):
	return (r * math.sin(b)) / ((math.cos(b) * math.cos(a)) - (math.sin(b) * math.sin(a)))
function code(r, a, b)
	return Float64(Float64(r * sin(b)) / Float64(Float64(cos(b) * cos(a)) - Float64(sin(b) * sin(a))))
end
function tmp = code(r, a, b)
	tmp = (r * sin(b)) / ((cos(b) * cos(a)) - (sin(b) * sin(a)));
end
code[r_, a_, b_] := N[(N[(r * N[Sin[b], $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[b], $MachinePrecision] * N[Cos[a], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[b], $MachinePrecision] * N[Sin[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{r \cdot \sin b}{\cos b \cdot \cos a - \sin b \cdot \sin a}
\end{array}
Derivation
  1. Initial program 76.0%

    \[\frac{r \cdot \sin b}{\cos \left(a + b\right)} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-+.f64N/A

      \[\leadsto \frac{r \cdot \sin b}{\cos \color{blue}{\left(a + b\right)}} \]
    2. lift-cos.f64N/A

      \[\leadsto \frac{r \cdot \sin b}{\color{blue}{\cos \left(a + b\right)}} \]
    3. +-commutativeN/A

      \[\leadsto \frac{r \cdot \sin b}{\cos \color{blue}{\left(b + a\right)}} \]
    4. cos-sumN/A

      \[\leadsto \frac{r \cdot \sin b}{\color{blue}{\cos b \cdot \cos a - \sin b \cdot \sin a}} \]
    5. cos-neg-revN/A

      \[\leadsto \frac{r \cdot \sin b}{\cos b \cdot \color{blue}{\cos \left(\mathsf{neg}\left(a\right)\right)} - \sin b \cdot \sin a} \]
    6. mul-1-negN/A

      \[\leadsto \frac{r \cdot \sin b}{\cos b \cdot \cos \color{blue}{\left(-1 \cdot a\right)} - \sin b \cdot \sin a} \]
    7. lower--.f64N/A

      \[\leadsto \frac{r \cdot \sin b}{\color{blue}{\cos b \cdot \cos \left(-1 \cdot a\right) - \sin b \cdot \sin a}} \]
    8. mul-1-negN/A

      \[\leadsto \frac{r \cdot \sin b}{\cos b \cdot \cos \color{blue}{\left(\mathsf{neg}\left(a\right)\right)} - \sin b \cdot \sin a} \]
    9. cos-neg-revN/A

      \[\leadsto \frac{r \cdot \sin b}{\cos b \cdot \color{blue}{\cos a} - \sin b \cdot \sin a} \]
    10. lower-*.f64N/A

      \[\leadsto \frac{r \cdot \sin b}{\color{blue}{\cos b \cdot \cos a} - \sin b \cdot \sin a} \]
    11. lower-cos.f64N/A

      \[\leadsto \frac{r \cdot \sin b}{\color{blue}{\cos b} \cdot \cos a - \sin b \cdot \sin a} \]
    12. lower-cos.f64N/A

      \[\leadsto \frac{r \cdot \sin b}{\cos b \cdot \color{blue}{\cos a} - \sin b \cdot \sin a} \]
    13. lower-*.f64N/A

      \[\leadsto \frac{r \cdot \sin b}{\cos b \cdot \cos a - \color{blue}{\sin b \cdot \sin a}} \]
    14. lift-sin.f64N/A

      \[\leadsto \frac{r \cdot \sin b}{\cos b \cdot \cos a - \color{blue}{\sin b} \cdot \sin a} \]
    15. lower-sin.f6499.5

      \[\leadsto \frac{r \cdot \sin b}{\cos b \cdot \cos a - \sin b \cdot \color{blue}{\sin a}} \]
  4. Applied rewrites99.5%

    \[\leadsto \frac{r \cdot \sin b}{\color{blue}{\cos b \cdot \cos a - \sin b \cdot \sin a}} \]
  5. Add Preprocessing

Alternative 2: 78.1% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \frac{r \cdot \sin b}{\mathsf{fma}\left(\cos b, \cos a, \frac{-1}{\frac{\mathsf{fma}\left(0.16666666666666666, b \cdot b, 1\right)}{b}} \cdot \sin a\right)} \end{array} \]
(FPCore (r a b)
 :precision binary64
 (/
  (* r (sin b))
  (fma
   (cos b)
   (cos a)
   (* (/ -1.0 (/ (fma 0.16666666666666666 (* b b) 1.0) b)) (sin a)))))
double code(double r, double a, double b) {
	return (r * sin(b)) / fma(cos(b), cos(a), ((-1.0 / (fma(0.16666666666666666, (b * b), 1.0) / b)) * sin(a)));
}
function code(r, a, b)
	return Float64(Float64(r * sin(b)) / fma(cos(b), cos(a), Float64(Float64(-1.0 / Float64(fma(0.16666666666666666, Float64(b * b), 1.0) / b)) * sin(a))))
end
code[r_, a_, b_] := N[(N[(r * N[Sin[b], $MachinePrecision]), $MachinePrecision] / N[(N[Cos[b], $MachinePrecision] * N[Cos[a], $MachinePrecision] + N[(N[(-1.0 / N[(N[(0.16666666666666666 * N[(b * b), $MachinePrecision] + 1.0), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision] * N[Sin[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{r \cdot \sin b}{\mathsf{fma}\left(\cos b, \cos a, \frac{-1}{\frac{\mathsf{fma}\left(0.16666666666666666, b \cdot b, 1\right)}{b}} \cdot \sin a\right)}
\end{array}
Derivation
  1. Initial program 76.0%

    \[\frac{r \cdot \sin b}{\cos \left(a + b\right)} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift-+.f64N/A

      \[\leadsto \frac{r \cdot \sin b}{\cos \color{blue}{\left(a + b\right)}} \]
    2. lift-cos.f64N/A

      \[\leadsto \frac{r \cdot \sin b}{\color{blue}{\cos \left(a + b\right)}} \]
    3. +-commutativeN/A

      \[\leadsto \frac{r \cdot \sin b}{\cos \color{blue}{\left(b + a\right)}} \]
    4. cos-sumN/A

      \[\leadsto \frac{r \cdot \sin b}{\color{blue}{\cos b \cdot \cos a - \sin b \cdot \sin a}} \]
    5. cos-neg-revN/A

      \[\leadsto \frac{r \cdot \sin b}{\cos b \cdot \color{blue}{\cos \left(\mathsf{neg}\left(a\right)\right)} - \sin b \cdot \sin a} \]
    6. mul-1-negN/A

      \[\leadsto \frac{r \cdot \sin b}{\cos b \cdot \cos \color{blue}{\left(-1 \cdot a\right)} - \sin b \cdot \sin a} \]
    7. lower--.f64N/A

      \[\leadsto \frac{r \cdot \sin b}{\color{blue}{\cos b \cdot \cos \left(-1 \cdot a\right) - \sin b \cdot \sin a}} \]
    8. mul-1-negN/A

      \[\leadsto \frac{r \cdot \sin b}{\cos b \cdot \cos \color{blue}{\left(\mathsf{neg}\left(a\right)\right)} - \sin b \cdot \sin a} \]
    9. cos-neg-revN/A

      \[\leadsto \frac{r \cdot \sin b}{\cos b \cdot \color{blue}{\cos a} - \sin b \cdot \sin a} \]
    10. lower-*.f64N/A

      \[\leadsto \frac{r \cdot \sin b}{\color{blue}{\cos b \cdot \cos a} - \sin b \cdot \sin a} \]
    11. lower-cos.f64N/A

      \[\leadsto \frac{r \cdot \sin b}{\color{blue}{\cos b} \cdot \cos a - \sin b \cdot \sin a} \]
    12. lower-cos.f64N/A

      \[\leadsto \frac{r \cdot \sin b}{\cos b \cdot \color{blue}{\cos a} - \sin b \cdot \sin a} \]
    13. lower-*.f64N/A

      \[\leadsto \frac{r \cdot \sin b}{\cos b \cdot \cos a - \color{blue}{\sin b \cdot \sin a}} \]
    14. lift-sin.f64N/A

      \[\leadsto \frac{r \cdot \sin b}{\cos b \cdot \cos a - \color{blue}{\sin b} \cdot \sin a} \]
    15. lower-sin.f6499.5

      \[\leadsto \frac{r \cdot \sin b}{\cos b \cdot \cos a - \sin b \cdot \color{blue}{\sin a}} \]
  4. Applied rewrites99.5%

    \[\leadsto \frac{r \cdot \sin b}{\color{blue}{\cos b \cdot \cos a - \sin b \cdot \sin a}} \]
  5. Step-by-step derivation
    1. lift--.f64N/A

      \[\leadsto \frac{r \cdot \sin b}{\color{blue}{\cos b \cdot \cos a - \sin b \cdot \sin a}} \]
    2. lift-*.f64N/A

      \[\leadsto \frac{r \cdot \sin b}{\color{blue}{\cos b \cdot \cos a} - \sin b \cdot \sin a} \]
    3. lift-cos.f64N/A

      \[\leadsto \frac{r \cdot \sin b}{\color{blue}{\cos b} \cdot \cos a - \sin b \cdot \sin a} \]
    4. lift-cos.f64N/A

      \[\leadsto \frac{r \cdot \sin b}{\cos b \cdot \color{blue}{\cos a} - \sin b \cdot \sin a} \]
    5. lift-*.f64N/A

      \[\leadsto \frac{r \cdot \sin b}{\cos b \cdot \cos a - \color{blue}{\sin b \cdot \sin a}} \]
    6. lift-sin.f64N/A

      \[\leadsto \frac{r \cdot \sin b}{\cos b \cdot \cos a - \color{blue}{\sin b} \cdot \sin a} \]
    7. lift-sin.f64N/A

      \[\leadsto \frac{r \cdot \sin b}{\cos b \cdot \cos a - \sin b \cdot \color{blue}{\sin a}} \]
    8. fp-cancel-sub-sign-invN/A

      \[\leadsto \frac{r \cdot \sin b}{\color{blue}{\cos b \cdot \cos a + \left(\mathsf{neg}\left(\sin b\right)\right) \cdot \sin a}} \]
    9. lower-fma.f64N/A

      \[\leadsto \frac{r \cdot \sin b}{\color{blue}{\mathsf{fma}\left(\cos b, \cos a, \left(\mathsf{neg}\left(\sin b\right)\right) \cdot \sin a\right)}} \]
    10. lift-cos.f64N/A

      \[\leadsto \frac{r \cdot \sin b}{\mathsf{fma}\left(\color{blue}{\cos b}, \cos a, \left(\mathsf{neg}\left(\sin b\right)\right) \cdot \sin a\right)} \]
    11. lift-cos.f64N/A

      \[\leadsto \frac{r \cdot \sin b}{\mathsf{fma}\left(\cos b, \color{blue}{\cos a}, \left(\mathsf{neg}\left(\sin b\right)\right) \cdot \sin a\right)} \]
    12. sin-neg-revN/A

      \[\leadsto \frac{r \cdot \sin b}{\mathsf{fma}\left(\cos b, \cos a, \color{blue}{\sin \left(\mathsf{neg}\left(b\right)\right)} \cdot \sin a\right)} \]
    13. mul-1-negN/A

      \[\leadsto \frac{r \cdot \sin b}{\mathsf{fma}\left(\cos b, \cos a, \sin \color{blue}{\left(-1 \cdot b\right)} \cdot \sin a\right)} \]
    14. lower-*.f64N/A

      \[\leadsto \frac{r \cdot \sin b}{\mathsf{fma}\left(\cos b, \cos a, \color{blue}{\sin \left(-1 \cdot b\right) \cdot \sin a}\right)} \]
    15. mul-1-negN/A

      \[\leadsto \frac{r \cdot \sin b}{\mathsf{fma}\left(\cos b, \cos a, \sin \color{blue}{\left(\mathsf{neg}\left(b\right)\right)} \cdot \sin a\right)} \]
    16. sin-neg-revN/A

      \[\leadsto \frac{r \cdot \sin b}{\mathsf{fma}\left(\cos b, \cos a, \color{blue}{\left(\mathsf{neg}\left(\sin b\right)\right)} \cdot \sin a\right)} \]
    17. lower-neg.f64N/A

      \[\leadsto \frac{r \cdot \sin b}{\mathsf{fma}\left(\cos b, \cos a, \color{blue}{\left(-\sin b\right)} \cdot \sin a\right)} \]
    18. lift-sin.f64N/A

      \[\leadsto \frac{r \cdot \sin b}{\mathsf{fma}\left(\cos b, \cos a, \left(-\color{blue}{\sin b}\right) \cdot \sin a\right)} \]
    19. lift-sin.f6499.5

      \[\leadsto \frac{r \cdot \sin b}{\mathsf{fma}\left(\cos b, \cos a, \left(-\sin b\right) \cdot \color{blue}{\sin a}\right)} \]
  6. Applied rewrites99.5%

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

      \[\leadsto \frac{r \cdot \sin b}{\mathsf{fma}\left(\cos b, \cos a, \left(-\color{blue}{\sin b}\right) \cdot \sin a\right)} \]
    2. unpow1N/A

      \[\leadsto \frac{r \cdot \sin b}{\mathsf{fma}\left(\cos b, \cos a, \left(-\color{blue}{{\sin b}^{1}}\right) \cdot \sin a\right)} \]
    3. metadata-evalN/A

      \[\leadsto \frac{r \cdot \sin b}{\mathsf{fma}\left(\cos b, \cos a, \left(-{\sin b}^{\color{blue}{\left(\mathsf{neg}\left(-1\right)\right)}}\right) \cdot \sin a\right)} \]
    4. pow-negN/A

      \[\leadsto \frac{r \cdot \sin b}{\mathsf{fma}\left(\cos b, \cos a, \left(-\color{blue}{\frac{1}{{\sin b}^{-1}}}\right) \cdot \sin a\right)} \]
    5. lower-/.f64N/A

      \[\leadsto \frac{r \cdot \sin b}{\mathsf{fma}\left(\cos b, \cos a, \left(-\color{blue}{\frac{1}{{\sin b}^{-1}}}\right) \cdot \sin a\right)} \]
    6. lower-pow.f64N/A

      \[\leadsto \frac{r \cdot \sin b}{\mathsf{fma}\left(\cos b, \cos a, \left(-\frac{1}{\color{blue}{{\sin b}^{-1}}}\right) \cdot \sin a\right)} \]
    7. lift-sin.f6499.5

      \[\leadsto \frac{r \cdot \sin b}{\mathsf{fma}\left(\cos b, \cos a, \left(-\frac{1}{{\color{blue}{\sin b}}^{-1}}\right) \cdot \sin a\right)} \]
  8. Applied rewrites99.5%

    \[\leadsto \frac{r \cdot \sin b}{\mathsf{fma}\left(\cos b, \cos a, \left(-\color{blue}{\frac{1}{{\sin b}^{-1}}}\right) \cdot \sin a\right)} \]
  9. Taylor expanded in b around 0

    \[\leadsto \frac{r \cdot \sin b}{\mathsf{fma}\left(\cos b, \cos a, \left(-\frac{1}{\color{blue}{\frac{1 + \frac{1}{6} \cdot {b}^{2}}{b}}}\right) \cdot \sin a\right)} \]
  10. Step-by-step derivation
    1. Applied rewrites77.1%

      \[\leadsto \frac{r \cdot \sin b}{\mathsf{fma}\left(\cos b, \cos a, \left(-\frac{1}{\color{blue}{\frac{\mathsf{fma}\left(0.16666666666666666, b \cdot b, 1\right)}{b}}}\right) \cdot \sin a\right)} \]
    2. Final simplification77.1%

      \[\leadsto \frac{r \cdot \sin b}{\mathsf{fma}\left(\cos b, \cos a, \frac{-1}{\frac{\mathsf{fma}\left(0.16666666666666666, b \cdot b, 1\right)}{b}} \cdot \sin a\right)} \]
    3. Add Preprocessing

    Alternative 3: 76.4% accurate, 1.0× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -2.1 \cdot 10^{-5} \lor \neg \left(a \leq 55000000\right):\\ \;\;\;\;r \cdot \frac{\sin b}{\cos a}\\ \mathbf{else}:\\ \;\;\;\;r \cdot \tan b\\ \end{array} \end{array} \]
    (FPCore (r a b)
     :precision binary64
     (if (or (<= a -2.1e-5) (not (<= a 55000000.0)))
       (* r (/ (sin b) (cos a)))
       (* r (tan b))))
    double code(double r, double a, double b) {
    	double tmp;
    	if ((a <= -2.1e-5) || !(a <= 55000000.0)) {
    		tmp = r * (sin(b) / cos(a));
    	} else {
    		tmp = r * tan(b);
    	}
    	return tmp;
    }
    
    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(r, a, b)
    use fmin_fmax_functions
        real(8), intent (in) :: r
        real(8), intent (in) :: a
        real(8), intent (in) :: b
        real(8) :: tmp
        if ((a <= (-2.1d-5)) .or. (.not. (a <= 55000000.0d0))) then
            tmp = r * (sin(b) / cos(a))
        else
            tmp = r * tan(b)
        end if
        code = tmp
    end function
    
    public static double code(double r, double a, double b) {
    	double tmp;
    	if ((a <= -2.1e-5) || !(a <= 55000000.0)) {
    		tmp = r * (Math.sin(b) / Math.cos(a));
    	} else {
    		tmp = r * Math.tan(b);
    	}
    	return tmp;
    }
    
    def code(r, a, b):
    	tmp = 0
    	if (a <= -2.1e-5) or not (a <= 55000000.0):
    		tmp = r * (math.sin(b) / math.cos(a))
    	else:
    		tmp = r * math.tan(b)
    	return tmp
    
    function code(r, a, b)
    	tmp = 0.0
    	if ((a <= -2.1e-5) || !(a <= 55000000.0))
    		tmp = Float64(r * Float64(sin(b) / cos(a)));
    	else
    		tmp = Float64(r * tan(b));
    	end
    	return tmp
    end
    
    function tmp_2 = code(r, a, b)
    	tmp = 0.0;
    	if ((a <= -2.1e-5) || ~((a <= 55000000.0)))
    		tmp = r * (sin(b) / cos(a));
    	else
    		tmp = r * tan(b);
    	end
    	tmp_2 = tmp;
    end
    
    code[r_, a_, b_] := If[Or[LessEqual[a, -2.1e-5], N[Not[LessEqual[a, 55000000.0]], $MachinePrecision]], N[(r * N[(N[Sin[b], $MachinePrecision] / N[Cos[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(r * N[Tan[b], $MachinePrecision]), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;a \leq -2.1 \cdot 10^{-5} \lor \neg \left(a \leq 55000000\right):\\
    \;\;\;\;r \cdot \frac{\sin b}{\cos a}\\
    
    \mathbf{else}:\\
    \;\;\;\;r \cdot \tan b\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if a < -2.09999999999999988e-5 or 5.5e7 < a

      1. Initial program 54.2%

        \[\frac{r \cdot \sin b}{\cos \left(a + b\right)} \]
      2. Add Preprocessing
      3. Taylor expanded in a around inf

        \[\leadsto \frac{r \cdot \sin b}{\cos \color{blue}{a}} \]
      4. Step-by-step derivation
        1. Applied rewrites53.8%

          \[\leadsto \frac{r \cdot \sin b}{\cos \color{blue}{a}} \]
        2. Step-by-step derivation
          1. lift-/.f64N/A

            \[\leadsto \color{blue}{\frac{r \cdot \sin b}{\cos a}} \]
          2. lift-*.f64N/A

            \[\leadsto \frac{\color{blue}{r \cdot \sin b}}{\cos a} \]
          3. lift-sin.f64N/A

            \[\leadsto \frac{r \cdot \color{blue}{\sin b}}{\cos a} \]
          4. associate-/l*N/A

            \[\leadsto \color{blue}{r \cdot \frac{\sin b}{\cos a}} \]
          5. lower-*.f64N/A

            \[\leadsto \color{blue}{r \cdot \frac{\sin b}{\cos a}} \]
          6. lower-/.f64N/A

            \[\leadsto r \cdot \color{blue}{\frac{\sin b}{\cos a}} \]
          7. lift-sin.f6453.8

            \[\leadsto r \cdot \frac{\color{blue}{\sin b}}{\cos a} \]
        3. Applied rewrites53.8%

          \[\leadsto \color{blue}{r \cdot \frac{\sin b}{\cos a}} \]

        if -2.09999999999999988e-5 < a < 5.5e7

        1. Initial program 98.2%

          \[\frac{r \cdot \sin b}{\cos \left(a + b\right)} \]
        2. Add Preprocessing
        3. Taylor expanded in a around 0

          \[\leadsto \color{blue}{\frac{r \cdot \sin b}{\cos b}} \]
        4. Step-by-step derivation
          1. Applied rewrites98.3%

            \[\leadsto \color{blue}{r \cdot \tan b} \]
        5. Recombined 2 regimes into one program.
        6. Final simplification75.9%

          \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -2.1 \cdot 10^{-5} \lor \neg \left(a \leq 55000000\right):\\ \;\;\;\;r \cdot \frac{\sin b}{\cos a}\\ \mathbf{else}:\\ \;\;\;\;r \cdot \tan b\\ \end{array} \]
        7. Add Preprocessing

        Alternative 4: 76.4% accurate, 1.0× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;a \leq -2.1 \cdot 10^{-5}:\\ \;\;\;\;\frac{r \cdot \sin b}{\cos a}\\ \mathbf{elif}\;a \leq 55000000:\\ \;\;\;\;r \cdot \tan b\\ \mathbf{else}:\\ \;\;\;\;r \cdot \frac{\sin b}{\cos a}\\ \end{array} \end{array} \]
        (FPCore (r a b)
         :precision binary64
         (if (<= a -2.1e-5)
           (/ (* r (sin b)) (cos a))
           (if (<= a 55000000.0) (* r (tan b)) (* r (/ (sin b) (cos a))))))
        double code(double r, double a, double b) {
        	double tmp;
        	if (a <= -2.1e-5) {
        		tmp = (r * sin(b)) / cos(a);
        	} else if (a <= 55000000.0) {
        		tmp = r * tan(b);
        	} else {
        		tmp = r * (sin(b) / cos(a));
        	}
        	return tmp;
        }
        
        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(r, a, b)
        use fmin_fmax_functions
            real(8), intent (in) :: r
            real(8), intent (in) :: a
            real(8), intent (in) :: b
            real(8) :: tmp
            if (a <= (-2.1d-5)) then
                tmp = (r * sin(b)) / cos(a)
            else if (a <= 55000000.0d0) then
                tmp = r * tan(b)
            else
                tmp = r * (sin(b) / cos(a))
            end if
            code = tmp
        end function
        
        public static double code(double r, double a, double b) {
        	double tmp;
        	if (a <= -2.1e-5) {
        		tmp = (r * Math.sin(b)) / Math.cos(a);
        	} else if (a <= 55000000.0) {
        		tmp = r * Math.tan(b);
        	} else {
        		tmp = r * (Math.sin(b) / Math.cos(a));
        	}
        	return tmp;
        }
        
        def code(r, a, b):
        	tmp = 0
        	if a <= -2.1e-5:
        		tmp = (r * math.sin(b)) / math.cos(a)
        	elif a <= 55000000.0:
        		tmp = r * math.tan(b)
        	else:
        		tmp = r * (math.sin(b) / math.cos(a))
        	return tmp
        
        function code(r, a, b)
        	tmp = 0.0
        	if (a <= -2.1e-5)
        		tmp = Float64(Float64(r * sin(b)) / cos(a));
        	elseif (a <= 55000000.0)
        		tmp = Float64(r * tan(b));
        	else
        		tmp = Float64(r * Float64(sin(b) / cos(a)));
        	end
        	return tmp
        end
        
        function tmp_2 = code(r, a, b)
        	tmp = 0.0;
        	if (a <= -2.1e-5)
        		tmp = (r * sin(b)) / cos(a);
        	elseif (a <= 55000000.0)
        		tmp = r * tan(b);
        	else
        		tmp = r * (sin(b) / cos(a));
        	end
        	tmp_2 = tmp;
        end
        
        code[r_, a_, b_] := If[LessEqual[a, -2.1e-5], N[(N[(r * N[Sin[b], $MachinePrecision]), $MachinePrecision] / N[Cos[a], $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 55000000.0], N[(r * N[Tan[b], $MachinePrecision]), $MachinePrecision], N[(r * N[(N[Sin[b], $MachinePrecision] / N[Cos[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;a \leq -2.1 \cdot 10^{-5}:\\
        \;\;\;\;\frac{r \cdot \sin b}{\cos a}\\
        
        \mathbf{elif}\;a \leq 55000000:\\
        \;\;\;\;r \cdot \tan b\\
        
        \mathbf{else}:\\
        \;\;\;\;r \cdot \frac{\sin b}{\cos a}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if a < -2.09999999999999988e-5

          1. Initial program 50.3%

            \[\frac{r \cdot \sin b}{\cos \left(a + b\right)} \]
          2. Add Preprocessing
          3. Taylor expanded in a around inf

            \[\leadsto \frac{r \cdot \sin b}{\cos \color{blue}{a}} \]
          4. Step-by-step derivation
            1. Applied rewrites50.1%

              \[\leadsto \frac{r \cdot \sin b}{\cos \color{blue}{a}} \]

            if -2.09999999999999988e-5 < a < 5.5e7

            1. Initial program 98.2%

              \[\frac{r \cdot \sin b}{\cos \left(a + b\right)} \]
            2. Add Preprocessing
            3. Taylor expanded in a around 0

              \[\leadsto \color{blue}{\frac{r \cdot \sin b}{\cos b}} \]
            4. Step-by-step derivation
              1. Applied rewrites98.3%

                \[\leadsto \color{blue}{r \cdot \tan b} \]

              if 5.5e7 < a

              1. Initial program 59.6%

                \[\frac{r \cdot \sin b}{\cos \left(a + b\right)} \]
              2. Add Preprocessing
              3. Taylor expanded in a around inf

                \[\leadsto \frac{r \cdot \sin b}{\cos \color{blue}{a}} \]
              4. Step-by-step derivation
                1. Applied rewrites59.0%

                  \[\leadsto \frac{r \cdot \sin b}{\cos \color{blue}{a}} \]
                2. Step-by-step derivation
                  1. lift-/.f64N/A

                    \[\leadsto \color{blue}{\frac{r \cdot \sin b}{\cos a}} \]
                  2. lift-*.f64N/A

                    \[\leadsto \frac{\color{blue}{r \cdot \sin b}}{\cos a} \]
                  3. lift-sin.f64N/A

                    \[\leadsto \frac{r \cdot \color{blue}{\sin b}}{\cos a} \]
                  4. associate-/l*N/A

                    \[\leadsto \color{blue}{r \cdot \frac{\sin b}{\cos a}} \]
                  5. lower-*.f64N/A

                    \[\leadsto \color{blue}{r \cdot \frac{\sin b}{\cos a}} \]
                  6. lower-/.f64N/A

                    \[\leadsto r \cdot \color{blue}{\frac{\sin b}{\cos a}} \]
                  7. lift-sin.f6459.1

                    \[\leadsto r \cdot \frac{\color{blue}{\sin b}}{\cos a} \]
                3. Applied rewrites59.1%

                  \[\leadsto \color{blue}{r \cdot \frac{\sin b}{\cos a}} \]
              5. Recombined 3 regimes into one program.
              6. Add Preprocessing

              Alternative 5: 76.8% accurate, 1.0× speedup?

              \[\begin{array}{l} \\ \frac{r \cdot \sin b}{\cos \left(a + b\right)} \end{array} \]
              (FPCore (r a b) :precision binary64 (/ (* r (sin b)) (cos (+ a b))))
              double code(double r, double a, double b) {
              	return (r * sin(b)) / cos((a + b));
              }
              
              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(r, a, b)
              use fmin_fmax_functions
                  real(8), intent (in) :: r
                  real(8), intent (in) :: a
                  real(8), intent (in) :: b
                  code = (r * sin(b)) / cos((a + b))
              end function
              
              public static double code(double r, double a, double b) {
              	return (r * Math.sin(b)) / Math.cos((a + b));
              }
              
              def code(r, a, b):
              	return (r * math.sin(b)) / math.cos((a + b))
              
              function code(r, a, b)
              	return Float64(Float64(r * sin(b)) / cos(Float64(a + b)))
              end
              
              function tmp = code(r, a, b)
              	tmp = (r * sin(b)) / cos((a + b));
              end
              
              code[r_, a_, b_] := N[(N[(r * N[Sin[b], $MachinePrecision]), $MachinePrecision] / N[Cos[N[(a + b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
              
              \begin{array}{l}
              
              \\
              \frac{r \cdot \sin b}{\cos \left(a + b\right)}
              \end{array}
              
              Derivation
              1. Initial program 76.0%

                \[\frac{r \cdot \sin b}{\cos \left(a + b\right)} \]
              2. Add Preprocessing
              3. Add Preprocessing

              Alternative 6: 76.8% accurate, 1.0× speedup?

              \[\begin{array}{l} \\ r \cdot \frac{\sin b}{\cos \left(a + b\right)} \end{array} \]
              (FPCore (r a b) :precision binary64 (* r (/ (sin b) (cos (+ a b)))))
              double code(double r, double a, double b) {
              	return r * (sin(b) / cos((a + b)));
              }
              
              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(r, a, b)
              use fmin_fmax_functions
                  real(8), intent (in) :: r
                  real(8), intent (in) :: a
                  real(8), intent (in) :: b
                  code = r * (sin(b) / cos((a + b)))
              end function
              
              public static double code(double r, double a, double b) {
              	return r * (Math.sin(b) / Math.cos((a + b)));
              }
              
              def code(r, a, b):
              	return r * (math.sin(b) / math.cos((a + b)))
              
              function code(r, a, b)
              	return Float64(r * Float64(sin(b) / cos(Float64(a + b))))
              end
              
              function tmp = code(r, a, b)
              	tmp = r * (sin(b) / cos((a + b)));
              end
              
              code[r_, a_, b_] := N[(r * N[(N[Sin[b], $MachinePrecision] / N[Cos[N[(a + b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
              
              \begin{array}{l}
              
              \\
              r \cdot \frac{\sin b}{\cos \left(a + b\right)}
              \end{array}
              
              Derivation
              1. Initial program 76.0%

                \[\frac{r \cdot \sin b}{\cos \left(a + b\right)} \]
              2. Add Preprocessing
              3. Step-by-step derivation
                1. lift-/.f64N/A

                  \[\leadsto \color{blue}{\frac{r \cdot \sin b}{\cos \left(a + b\right)}} \]
                2. lift-*.f64N/A

                  \[\leadsto \frac{\color{blue}{r \cdot \sin b}}{\cos \left(a + b\right)} \]
                3. lift-sin.f64N/A

                  \[\leadsto \frac{r \cdot \color{blue}{\sin b}}{\cos \left(a + b\right)} \]
                4. lift-+.f64N/A

                  \[\leadsto \frac{r \cdot \sin b}{\cos \color{blue}{\left(a + b\right)}} \]
                5. lift-cos.f64N/A

                  \[\leadsto \frac{r \cdot \sin b}{\color{blue}{\cos \left(a + b\right)}} \]
                6. associate-/l*N/A

                  \[\leadsto \color{blue}{r \cdot \frac{\sin b}{\cos \left(a + b\right)}} \]
                7. lower-*.f64N/A

                  \[\leadsto \color{blue}{r \cdot \frac{\sin b}{\cos \left(a + b\right)}} \]
                8. lower-/.f64N/A

                  \[\leadsto r \cdot \color{blue}{\frac{\sin b}{\cos \left(a + b\right)}} \]
                9. lift-sin.f64N/A

                  \[\leadsto r \cdot \frac{\color{blue}{\sin b}}{\cos \left(a + b\right)} \]
                10. lift-cos.f64N/A

                  \[\leadsto r \cdot \frac{\sin b}{\color{blue}{\cos \left(a + b\right)}} \]
                11. lift-+.f6476.0

                  \[\leadsto r \cdot \frac{\sin b}{\cos \color{blue}{\left(a + b\right)}} \]
              4. Applied rewrites76.0%

                \[\leadsto \color{blue}{r \cdot \frac{\sin b}{\cos \left(a + b\right)}} \]
              5. Add Preprocessing

              Alternative 7: 76.1% accurate, 1.5× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -8100000000 \lor \neg \left(b \leq 3.3 \cdot 10^{-5}\right):\\ \;\;\;\;r \cdot \tan b\\ \mathbf{else}:\\ \;\;\;\;\frac{r \cdot \left(\mathsf{fma}\left(-0.16666666666666666, b \cdot b, 1\right) \cdot b\right)}{\cos a}\\ \end{array} \end{array} \]
              (FPCore (r a b)
               :precision binary64
               (if (or (<= b -8100000000.0) (not (<= b 3.3e-5)))
                 (* r (tan b))
                 (/ (* r (* (fma -0.16666666666666666 (* b b) 1.0) b)) (cos a))))
              double code(double r, double a, double b) {
              	double tmp;
              	if ((b <= -8100000000.0) || !(b <= 3.3e-5)) {
              		tmp = r * tan(b);
              	} else {
              		tmp = (r * (fma(-0.16666666666666666, (b * b), 1.0) * b)) / cos(a);
              	}
              	return tmp;
              }
              
              function code(r, a, b)
              	tmp = 0.0
              	if ((b <= -8100000000.0) || !(b <= 3.3e-5))
              		tmp = Float64(r * tan(b));
              	else
              		tmp = Float64(Float64(r * Float64(fma(-0.16666666666666666, Float64(b * b), 1.0) * b)) / cos(a));
              	end
              	return tmp
              end
              
              code[r_, a_, b_] := If[Or[LessEqual[b, -8100000000.0], N[Not[LessEqual[b, 3.3e-5]], $MachinePrecision]], N[(r * N[Tan[b], $MachinePrecision]), $MachinePrecision], N[(N[(r * N[(N[(-0.16666666666666666 * N[(b * b), $MachinePrecision] + 1.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision] / N[Cos[a], $MachinePrecision]), $MachinePrecision]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              \mathbf{if}\;b \leq -8100000000 \lor \neg \left(b \leq 3.3 \cdot 10^{-5}\right):\\
              \;\;\;\;r \cdot \tan b\\
              
              \mathbf{else}:\\
              \;\;\;\;\frac{r \cdot \left(\mathsf{fma}\left(-0.16666666666666666, b \cdot b, 1\right) \cdot b\right)}{\cos a}\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if b < -8.1e9 or 3.3000000000000003e-5 < b

                1. Initial program 54.7%

                  \[\frac{r \cdot \sin b}{\cos \left(a + b\right)} \]
                2. Add Preprocessing
                3. Taylor expanded in a around 0

                  \[\leadsto \color{blue}{\frac{r \cdot \sin b}{\cos b}} \]
                4. Step-by-step derivation
                  1. Applied rewrites53.9%

                    \[\leadsto \color{blue}{r \cdot \tan b} \]

                  if -8.1e9 < b < 3.3000000000000003e-5

                  1. Initial program 98.6%

                    \[\frac{r \cdot \sin b}{\cos \left(a + b\right)} \]
                  2. Add Preprocessing
                  3. Taylor expanded in a around inf

                    \[\leadsto \frac{r \cdot \sin b}{\cos \color{blue}{a}} \]
                  4. Step-by-step derivation
                    1. Applied rewrites98.6%

                      \[\leadsto \frac{r \cdot \sin b}{\cos \color{blue}{a}} \]
                    2. Taylor expanded in b around 0

                      \[\leadsto \frac{r \cdot \color{blue}{\left(b \cdot \left(1 + \frac{-1}{6} \cdot {b}^{2}\right)\right)}}{\cos a} \]
                    3. Step-by-step derivation
                      1. Applied rewrites98.4%

                        \[\leadsto \frac{r \cdot \color{blue}{\left(\mathsf{fma}\left(-0.16666666666666666, b \cdot b, 1\right) \cdot b\right)}}{\cos a} \]
                    4. Recombined 2 regimes into one program.
                    5. Final simplification75.4%

                      \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -8100000000 \lor \neg \left(b \leq 3.3 \cdot 10^{-5}\right):\\ \;\;\;\;r \cdot \tan b\\ \mathbf{else}:\\ \;\;\;\;\frac{r \cdot \left(\mathsf{fma}\left(-0.16666666666666666, b \cdot b, 1\right) \cdot b\right)}{\cos a}\\ \end{array} \]
                    6. Add Preprocessing

                    Alternative 8: 76.6% accurate, 1.7× speedup?

                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -1.7 \cdot 10^{-5} \lor \neg \left(b \leq 4.3 \cdot 10^{-5}\right):\\ \;\;\;\;r \cdot \tan b\\ \mathbf{else}:\\ \;\;\;\;\frac{r \cdot b}{\cos a}\\ \end{array} \end{array} \]
                    (FPCore (r a b)
                     :precision binary64
                     (if (or (<= b -1.7e-5) (not (<= b 4.3e-5)))
                       (* r (tan b))
                       (/ (* r b) (cos a))))
                    double code(double r, double a, double b) {
                    	double tmp;
                    	if ((b <= -1.7e-5) || !(b <= 4.3e-5)) {
                    		tmp = r * tan(b);
                    	} else {
                    		tmp = (r * b) / cos(a);
                    	}
                    	return tmp;
                    }
                    
                    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(r, a, b)
                    use fmin_fmax_functions
                        real(8), intent (in) :: r
                        real(8), intent (in) :: a
                        real(8), intent (in) :: b
                        real(8) :: tmp
                        if ((b <= (-1.7d-5)) .or. (.not. (b <= 4.3d-5))) then
                            tmp = r * tan(b)
                        else
                            tmp = (r * b) / cos(a)
                        end if
                        code = tmp
                    end function
                    
                    public static double code(double r, double a, double b) {
                    	double tmp;
                    	if ((b <= -1.7e-5) || !(b <= 4.3e-5)) {
                    		tmp = r * Math.tan(b);
                    	} else {
                    		tmp = (r * b) / Math.cos(a);
                    	}
                    	return tmp;
                    }
                    
                    def code(r, a, b):
                    	tmp = 0
                    	if (b <= -1.7e-5) or not (b <= 4.3e-5):
                    		tmp = r * math.tan(b)
                    	else:
                    		tmp = (r * b) / math.cos(a)
                    	return tmp
                    
                    function code(r, a, b)
                    	tmp = 0.0
                    	if ((b <= -1.7e-5) || !(b <= 4.3e-5))
                    		tmp = Float64(r * tan(b));
                    	else
                    		tmp = Float64(Float64(r * b) / cos(a));
                    	end
                    	return tmp
                    end
                    
                    function tmp_2 = code(r, a, b)
                    	tmp = 0.0;
                    	if ((b <= -1.7e-5) || ~((b <= 4.3e-5)))
                    		tmp = r * tan(b);
                    	else
                    		tmp = (r * b) / cos(a);
                    	end
                    	tmp_2 = tmp;
                    end
                    
                    code[r_, a_, b_] := If[Or[LessEqual[b, -1.7e-5], N[Not[LessEqual[b, 4.3e-5]], $MachinePrecision]], N[(r * N[Tan[b], $MachinePrecision]), $MachinePrecision], N[(N[(r * b), $MachinePrecision] / N[Cos[a], $MachinePrecision]), $MachinePrecision]]
                    
                    \begin{array}{l}
                    
                    \\
                    \begin{array}{l}
                    \mathbf{if}\;b \leq -1.7 \cdot 10^{-5} \lor \neg \left(b \leq 4.3 \cdot 10^{-5}\right):\\
                    \;\;\;\;r \cdot \tan b\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;\frac{r \cdot b}{\cos a}\\
                    
                    
                    \end{array}
                    \end{array}
                    
                    Derivation
                    1. Split input into 2 regimes
                    2. if b < -1.7e-5 or 4.3000000000000002e-5 < b

                      1. Initial program 54.3%

                        \[\frac{r \cdot \sin b}{\cos \left(a + b\right)} \]
                      2. Add Preprocessing
                      3. Taylor expanded in a around 0

                        \[\leadsto \color{blue}{\frac{r \cdot \sin b}{\cos b}} \]
                      4. Step-by-step derivation
                        1. Applied rewrites53.1%

                          \[\leadsto \color{blue}{r \cdot \tan b} \]

                        if -1.7e-5 < b < 4.3000000000000002e-5

                        1. Initial program 99.8%

                          \[\frac{r \cdot \sin b}{\cos \left(a + b\right)} \]
                        2. Add Preprocessing
                        3. Taylor expanded in a around inf

                          \[\leadsto \frac{r \cdot \sin b}{\cos \color{blue}{a}} \]
                        4. Step-by-step derivation
                          1. Applied rewrites99.8%

                            \[\leadsto \frac{r \cdot \sin b}{\cos \color{blue}{a}} \]
                          2. Taylor expanded in b around 0

                            \[\leadsto \frac{r \cdot \color{blue}{b}}{\cos a} \]
                          3. Step-by-step derivation
                            1. Applied rewrites99.8%

                              \[\leadsto \frac{r \cdot \color{blue}{b}}{\cos a} \]
                          4. Recombined 2 regimes into one program.
                          5. Final simplification75.4%

                            \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.7 \cdot 10^{-5} \lor \neg \left(b \leq 4.3 \cdot 10^{-5}\right):\\ \;\;\;\;r \cdot \tan b\\ \mathbf{else}:\\ \;\;\;\;\frac{r \cdot b}{\cos a}\\ \end{array} \]
                          6. Add Preprocessing

                          Alternative 9: 76.6% accurate, 1.7× speedup?

                          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -1.7 \cdot 10^{-5} \lor \neg \left(b \leq 4.3 \cdot 10^{-5}\right):\\ \;\;\;\;r \cdot \tan b\\ \mathbf{else}:\\ \;\;\;\;b \cdot \frac{r}{\cos a}\\ \end{array} \end{array} \]
                          (FPCore (r a b)
                           :precision binary64
                           (if (or (<= b -1.7e-5) (not (<= b 4.3e-5)))
                             (* r (tan b))
                             (* b (/ r (cos a)))))
                          double code(double r, double a, double b) {
                          	double tmp;
                          	if ((b <= -1.7e-5) || !(b <= 4.3e-5)) {
                          		tmp = r * tan(b);
                          	} else {
                          		tmp = b * (r / cos(a));
                          	}
                          	return tmp;
                          }
                          
                          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(r, a, b)
                          use fmin_fmax_functions
                              real(8), intent (in) :: r
                              real(8), intent (in) :: a
                              real(8), intent (in) :: b
                              real(8) :: tmp
                              if ((b <= (-1.7d-5)) .or. (.not. (b <= 4.3d-5))) then
                                  tmp = r * tan(b)
                              else
                                  tmp = b * (r / cos(a))
                              end if
                              code = tmp
                          end function
                          
                          public static double code(double r, double a, double b) {
                          	double tmp;
                          	if ((b <= -1.7e-5) || !(b <= 4.3e-5)) {
                          		tmp = r * Math.tan(b);
                          	} else {
                          		tmp = b * (r / Math.cos(a));
                          	}
                          	return tmp;
                          }
                          
                          def code(r, a, b):
                          	tmp = 0
                          	if (b <= -1.7e-5) or not (b <= 4.3e-5):
                          		tmp = r * math.tan(b)
                          	else:
                          		tmp = b * (r / math.cos(a))
                          	return tmp
                          
                          function code(r, a, b)
                          	tmp = 0.0
                          	if ((b <= -1.7e-5) || !(b <= 4.3e-5))
                          		tmp = Float64(r * tan(b));
                          	else
                          		tmp = Float64(b * Float64(r / cos(a)));
                          	end
                          	return tmp
                          end
                          
                          function tmp_2 = code(r, a, b)
                          	tmp = 0.0;
                          	if ((b <= -1.7e-5) || ~((b <= 4.3e-5)))
                          		tmp = r * tan(b);
                          	else
                          		tmp = b * (r / cos(a));
                          	end
                          	tmp_2 = tmp;
                          end
                          
                          code[r_, a_, b_] := If[Or[LessEqual[b, -1.7e-5], N[Not[LessEqual[b, 4.3e-5]], $MachinePrecision]], N[(r * N[Tan[b], $MachinePrecision]), $MachinePrecision], N[(b * N[(r / N[Cos[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
                          
                          \begin{array}{l}
                          
                          \\
                          \begin{array}{l}
                          \mathbf{if}\;b \leq -1.7 \cdot 10^{-5} \lor \neg \left(b \leq 4.3 \cdot 10^{-5}\right):\\
                          \;\;\;\;r \cdot \tan b\\
                          
                          \mathbf{else}:\\
                          \;\;\;\;b \cdot \frac{r}{\cos a}\\
                          
                          
                          \end{array}
                          \end{array}
                          
                          Derivation
                          1. Split input into 2 regimes
                          2. if b < -1.7e-5 or 4.3000000000000002e-5 < b

                            1. Initial program 54.3%

                              \[\frac{r \cdot \sin b}{\cos \left(a + b\right)} \]
                            2. Add Preprocessing
                            3. Taylor expanded in a around 0

                              \[\leadsto \color{blue}{\frac{r \cdot \sin b}{\cos b}} \]
                            4. Step-by-step derivation
                              1. Applied rewrites53.1%

                                \[\leadsto \color{blue}{r \cdot \tan b} \]

                              if -1.7e-5 < b < 4.3000000000000002e-5

                              1. Initial program 99.8%

                                \[\frac{r \cdot \sin b}{\cos \left(a + b\right)} \]
                              2. Add Preprocessing
                              3. Taylor expanded in b around 0

                                \[\leadsto \color{blue}{\frac{b \cdot r}{\cos a}} \]
                              4. Step-by-step derivation
                                1. Applied rewrites99.8%

                                  \[\leadsto \color{blue}{b \cdot \frac{r}{\cos a}} \]
                              5. Recombined 2 regimes into one program.
                              6. Final simplification75.4%

                                \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -1.7 \cdot 10^{-5} \lor \neg \left(b \leq 4.3 \cdot 10^{-5}\right):\\ \;\;\;\;r \cdot \tan b\\ \mathbf{else}:\\ \;\;\;\;b \cdot \frac{r}{\cos a}\\ \end{array} \]
                              7. Add Preprocessing

                              Alternative 10: 60.1% accurate, 2.1× speedup?

                              \[\begin{array}{l} \\ r \cdot \tan b \end{array} \]
                              (FPCore (r a b) :precision binary64 (* r (tan b)))
                              double code(double r, double a, double b) {
                              	return r * tan(b);
                              }
                              
                              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(r, a, b)
                              use fmin_fmax_functions
                                  real(8), intent (in) :: r
                                  real(8), intent (in) :: a
                                  real(8), intent (in) :: b
                                  code = r * tan(b)
                              end function
                              
                              public static double code(double r, double a, double b) {
                              	return r * Math.tan(b);
                              }
                              
                              def code(r, a, b):
                              	return r * math.tan(b)
                              
                              function code(r, a, b)
                              	return Float64(r * tan(b))
                              end
                              
                              function tmp = code(r, a, b)
                              	tmp = r * tan(b);
                              end
                              
                              code[r_, a_, b_] := N[(r * N[Tan[b], $MachinePrecision]), $MachinePrecision]
                              
                              \begin{array}{l}
                              
                              \\
                              r \cdot \tan b
                              \end{array}
                              
                              Derivation
                              1. Initial program 76.0%

                                \[\frac{r \cdot \sin b}{\cos \left(a + b\right)} \]
                              2. Add Preprocessing
                              3. Taylor expanded in a around 0

                                \[\leadsto \color{blue}{\frac{r \cdot \sin b}{\cos b}} \]
                              4. Step-by-step derivation
                                1. Applied rewrites59.0%

                                  \[\leadsto \color{blue}{r \cdot \tan b} \]
                                2. Add Preprocessing

                                Alternative 11: 34.8% accurate, 36.7× speedup?

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

                                  \[\frac{r \cdot \sin b}{\cos \left(a + b\right)} \]
                                2. Add Preprocessing
                                3. Taylor expanded in a around 0

                                  \[\leadsto \color{blue}{\frac{r \cdot \sin b}{\cos b}} \]
                                4. Step-by-step derivation
                                  1. Applied rewrites59.0%

                                    \[\leadsto \color{blue}{r \cdot \tan b} \]
                                  2. Taylor expanded in b around 0

                                    \[\leadsto r \cdot b \]
                                  3. Step-by-step derivation
                                    1. Applied rewrites33.3%

                                      \[\leadsto r \cdot b \]
                                    2. Add Preprocessing

                                    Reproduce

                                    ?
                                    herbie shell --seed 2025026 
                                    (FPCore (r a b)
                                      :name "rsin A (should all be same)"
                                      :precision binary64
                                      (/ (* r (sin b)) (cos (+ a b))))