rsin B (should all be same)

Percentage Accurate: 76.4% → 99.5%
Time: 6.3s
Alternatives: 22
Speedup: 0.5×

Specification

?
\[\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}

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 22 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.4% 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}

Alternative 1: 99.5% accurate, 0.4× speedup?

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

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

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

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

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

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

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

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

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

      \[\leadsto r \cdot \frac{\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 r \cdot \frac{\sin b}{\cos b \cdot \color{blue}{\cos a} - \sin b \cdot \sin a} \]
    10. lower-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto r \cdot \frac{\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 r \cdot \frac{\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 r \cdot \frac{\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 r \cdot \frac{\sin b}{\mathsf{fma}\left(\cos b, \color{blue}{\cos a}, \left(\mathsf{neg}\left(\sin b\right)\right) \cdot \sin a\right)} \]
    12. lower-*.f64N/A

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

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

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

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

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

Alternative 2: 99.5% accurate, 0.4× speedup?

\[\begin{array}{l} \\ r \cdot \frac{\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(r * Float64(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[(r * N[(N[Sin[b], $MachinePrecision] / N[(N[(N[Cos[b], $MachinePrecision] * N[Cos[a], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[b], $MachinePrecision] * N[Sin[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

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

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

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

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

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

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

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

      \[\leadsto r \cdot \frac{\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 r \cdot \frac{\sin b}{\cos b \cdot \color{blue}{\cos a} - \sin b \cdot \sin a} \]
    10. lower-*.f64N/A

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

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

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

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

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

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

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

Alternative 3: 78.2% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos b \cdot \cos a\\ t_1 := r \cdot \frac{b}{t\_0 - b \cdot \sin a}\\ \mathbf{if}\;a \leq -4:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;a \leq 4.2:\\ \;\;\;\;r \cdot \frac{\sin b}{t\_0 - \sin b \cdot \left(\mathsf{fma}\left(\mathsf{fma}\left(a \cdot a, -0.0001984126984126984, 0.008333333333333333\right) \cdot \left(a \cdot a\right) - 0.16666666666666666, a \cdot a, 1\right) \cdot a\right)}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (r a b)
 :precision binary64
 (let* ((t_0 (* (cos b) (cos a))) (t_1 (* r (/ b (- t_0 (* b (sin a)))))))
   (if (<= a -4.0)
     t_1
     (if (<= a 4.2)
       (*
        r
        (/
         (sin b)
         (-
          t_0
          (*
           (sin b)
           (*
            (fma
             (-
              (*
               (fma (* a a) -0.0001984126984126984 0.008333333333333333)
               (* a a))
              0.16666666666666666)
             (* a a)
             1.0)
            a)))))
       t_1))))
double code(double r, double a, double b) {
	double t_0 = cos(b) * cos(a);
	double t_1 = r * (b / (t_0 - (b * sin(a))));
	double tmp;
	if (a <= -4.0) {
		tmp = t_1;
	} else if (a <= 4.2) {
		tmp = r * (sin(b) / (t_0 - (sin(b) * (fma(((fma((a * a), -0.0001984126984126984, 0.008333333333333333) * (a * a)) - 0.16666666666666666), (a * a), 1.0) * a))));
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(r, a, b)
	t_0 = Float64(cos(b) * cos(a))
	t_1 = Float64(r * Float64(b / Float64(t_0 - Float64(b * sin(a)))))
	tmp = 0.0
	if (a <= -4.0)
		tmp = t_1;
	elseif (a <= 4.2)
		tmp = Float64(r * Float64(sin(b) / Float64(t_0 - Float64(sin(b) * Float64(fma(Float64(Float64(fma(Float64(a * a), -0.0001984126984126984, 0.008333333333333333) * Float64(a * a)) - 0.16666666666666666), Float64(a * a), 1.0) * a)))));
	else
		tmp = t_1;
	end
	return tmp
end
code[r_, a_, b_] := Block[{t$95$0 = N[(N[Cos[b], $MachinePrecision] * N[Cos[a], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(r * N[(b / N[(t$95$0 - N[(b * N[Sin[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -4.0], t$95$1, If[LessEqual[a, 4.2], N[(r * N[(N[Sin[b], $MachinePrecision] / N[(t$95$0 - N[(N[Sin[b], $MachinePrecision] * N[(N[(N[(N[(N[(N[(a * a), $MachinePrecision] * -0.0001984126984126984 + 0.008333333333333333), $MachinePrecision] * N[(a * a), $MachinePrecision]), $MachinePrecision] - 0.16666666666666666), $MachinePrecision] * N[(a * a), $MachinePrecision] + 1.0), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \cos b \cdot \cos a\\
t_1 := r \cdot \frac{b}{t\_0 - b \cdot \sin a}\\
\mathbf{if}\;a \leq -4:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;a \leq 4.2:\\
\;\;\;\;r \cdot \frac{\sin b}{t\_0 - \sin b \cdot \left(\mathsf{fma}\left(\mathsf{fma}\left(a \cdot a, -0.0001984126984126984, 0.008333333333333333\right) \cdot \left(a \cdot a\right) - 0.16666666666666666, a \cdot a, 1\right) \cdot a\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -4 or 4.20000000000000018 < a

    1. Initial program 54.0%

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

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

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

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

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

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

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

        \[\leadsto r \cdot \frac{\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 r \cdot \frac{\sin b}{\cos b \cdot \color{blue}{\cos a} - \sin b \cdot \sin a} \]
      10. lower-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

        if -4 < a < 4.20000000000000018

        1. Initial program 98.5%

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

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

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

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

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

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

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

            \[\leadsto r \cdot \frac{\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 r \cdot \frac{\sin b}{\cos b \cdot \color{blue}{\cos a} - \sin b \cdot \sin a} \]
          10. lower-*.f64N/A

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

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

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

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

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

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

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

          \[\leadsto r \cdot \frac{\sin b}{\cos b \cdot \cos a - \sin b \cdot \color{blue}{\left(a \cdot \left(1 + {a}^{2} \cdot \left({a}^{2} \cdot \left(\frac{1}{120} + \frac{-1}{5040} \cdot {a}^{2}\right) - \frac{1}{6}\right)\right)\right)}} \]
        5. Step-by-step derivation
          1. *-commutativeN/A

            \[\leadsto r \cdot \frac{\sin b}{\cos b \cdot \cos a - \sin b \cdot \left(\left(1 + {a}^{2} \cdot \left({a}^{2} \cdot \left(\frac{1}{120} + \frac{-1}{5040} \cdot {a}^{2}\right) - \frac{1}{6}\right)\right) \cdot \color{blue}{a}\right)} \]
          2. lower-*.f64N/A

            \[\leadsto r \cdot \frac{\sin b}{\cos b \cdot \cos a - \sin b \cdot \left(\left(1 + {a}^{2} \cdot \left({a}^{2} \cdot \left(\frac{1}{120} + \frac{-1}{5040} \cdot {a}^{2}\right) - \frac{1}{6}\right)\right) \cdot \color{blue}{a}\right)} \]
        6. Applied rewrites99.6%

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

      Alternative 4: 78.2% accurate, 0.4× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := r \cdot \frac{b}{\cos b \cdot \cos a - b \cdot \sin a}\\ \mathbf{if}\;a \leq -1.76:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;a \leq 3.9:\\ \;\;\;\;r \cdot \frac{\sin b}{\cos b \cdot \mathsf{fma}\left(\mathsf{fma}\left(-0.001388888888888889, a \cdot a, 0.041666666666666664\right) \cdot \left(a \cdot a\right) - 0.5, a \cdot a, 1\right) - \sin b \cdot \sin a}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
      (FPCore (r a b)
       :precision binary64
       (let* ((t_0 (* r (/ b (- (* (cos b) (cos a)) (* b (sin a)))))))
         (if (<= a -1.76)
           t_0
           (if (<= a 3.9)
             (*
              r
              (/
               (sin b)
               (-
                (*
                 (cos b)
                 (fma
                  (-
                   (*
                    (fma -0.001388888888888889 (* a a) 0.041666666666666664)
                    (* a a))
                   0.5)
                  (* a a)
                  1.0))
                (* (sin b) (sin a)))))
             t_0))))
      double code(double r, double a, double b) {
      	double t_0 = r * (b / ((cos(b) * cos(a)) - (b * sin(a))));
      	double tmp;
      	if (a <= -1.76) {
      		tmp = t_0;
      	} else if (a <= 3.9) {
      		tmp = r * (sin(b) / ((cos(b) * fma(((fma(-0.001388888888888889, (a * a), 0.041666666666666664) * (a * a)) - 0.5), (a * a), 1.0)) - (sin(b) * sin(a))));
      	} else {
      		tmp = t_0;
      	}
      	return tmp;
      }
      
      function code(r, a, b)
      	t_0 = Float64(r * Float64(b / Float64(Float64(cos(b) * cos(a)) - Float64(b * sin(a)))))
      	tmp = 0.0
      	if (a <= -1.76)
      		tmp = t_0;
      	elseif (a <= 3.9)
      		tmp = Float64(r * Float64(sin(b) / Float64(Float64(cos(b) * fma(Float64(Float64(fma(-0.001388888888888889, Float64(a * a), 0.041666666666666664) * Float64(a * a)) - 0.5), Float64(a * a), 1.0)) - Float64(sin(b) * sin(a)))));
      	else
      		tmp = t_0;
      	end
      	return tmp
      end
      
      code[r_, a_, b_] := Block[{t$95$0 = N[(r * N[(b / N[(N[(N[Cos[b], $MachinePrecision] * N[Cos[a], $MachinePrecision]), $MachinePrecision] - N[(b * N[Sin[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -1.76], t$95$0, If[LessEqual[a, 3.9], N[(r * N[(N[Sin[b], $MachinePrecision] / N[(N[(N[Cos[b], $MachinePrecision] * N[(N[(N[(N[(-0.001388888888888889 * N[(a * a), $MachinePrecision] + 0.041666666666666664), $MachinePrecision] * N[(a * a), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision] * N[(a * a), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] - N[(N[Sin[b], $MachinePrecision] * N[Sin[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := r \cdot \frac{b}{\cos b \cdot \cos a - b \cdot \sin a}\\
      \mathbf{if}\;a \leq -1.76:\\
      \;\;\;\;t\_0\\
      
      \mathbf{elif}\;a \leq 3.9:\\
      \;\;\;\;r \cdot \frac{\sin b}{\cos b \cdot \mathsf{fma}\left(\mathsf{fma}\left(-0.001388888888888889, a \cdot a, 0.041666666666666664\right) \cdot \left(a \cdot a\right) - 0.5, a \cdot a, 1\right) - \sin b \cdot \sin a}\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_0\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if a < -1.76000000000000001 or 3.89999999999999991 < a

        1. Initial program 54.0%

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

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

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

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

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

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

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

            \[\leadsto r \cdot \frac{\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 r \cdot \frac{\sin b}{\cos b \cdot \color{blue}{\cos a} - \sin b \cdot \sin a} \]
          10. lower-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

            if -1.76000000000000001 < a < 3.89999999999999991

            1. Initial program 98.5%

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

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

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

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

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

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

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

                \[\leadsto r \cdot \frac{\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 r \cdot \frac{\sin b}{\cos b \cdot \color{blue}{\cos a} - \sin b \cdot \sin a} \]
              10. lower-*.f64N/A

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

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

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

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

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

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

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

              \[\leadsto r \cdot \frac{\sin b}{\cos b \cdot \color{blue}{\left(1 + {a}^{2} \cdot \left({a}^{2} \cdot \left(\frac{1}{24} + \frac{-1}{720} \cdot {a}^{2}\right) - \frac{1}{2}\right)\right)} - \sin b \cdot \sin a} \]
            5. Step-by-step derivation
              1. +-commutativeN/A

                \[\leadsto r \cdot \frac{\sin b}{\cos b \cdot \left({a}^{2} \cdot \left({a}^{2} \cdot \left(\frac{1}{24} + \frac{-1}{720} \cdot {a}^{2}\right) - \frac{1}{2}\right) + \color{blue}{1}\right) - \sin b \cdot \sin a} \]
              2. *-commutativeN/A

                \[\leadsto r \cdot \frac{\sin b}{\cos b \cdot \left(\left({a}^{2} \cdot \left(\frac{1}{24} + \frac{-1}{720} \cdot {a}^{2}\right) - \frac{1}{2}\right) \cdot {a}^{2} + 1\right) - \sin b \cdot \sin a} \]
              3. lower-fma.f64N/A

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

                \[\leadsto r \cdot \frac{\sin b}{\cos b \cdot \mathsf{fma}\left({a}^{2} \cdot \left(\frac{1}{24} + \frac{-1}{720} \cdot {a}^{2}\right) - \frac{1}{2}, {\color{blue}{a}}^{2}, 1\right) - \sin b \cdot \sin a} \]
              5. *-commutativeN/A

                \[\leadsto r \cdot \frac{\sin b}{\cos b \cdot \mathsf{fma}\left(\left(\frac{1}{24} + \frac{-1}{720} \cdot {a}^{2}\right) \cdot {a}^{2} - \frac{1}{2}, {a}^{2}, 1\right) - \sin b \cdot \sin a} \]
              6. lower-*.f64N/A

                \[\leadsto r \cdot \frac{\sin b}{\cos b \cdot \mathsf{fma}\left(\left(\frac{1}{24} + \frac{-1}{720} \cdot {a}^{2}\right) \cdot {a}^{2} - \frac{1}{2}, {a}^{2}, 1\right) - \sin b \cdot \sin a} \]
              7. +-commutativeN/A

                \[\leadsto r \cdot \frac{\sin b}{\cos b \cdot \mathsf{fma}\left(\left(\frac{-1}{720} \cdot {a}^{2} + \frac{1}{24}\right) \cdot {a}^{2} - \frac{1}{2}, {a}^{2}, 1\right) - \sin b \cdot \sin a} \]
              8. lower-fma.f64N/A

                \[\leadsto r \cdot \frac{\sin b}{\cos b \cdot \mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{720}, {a}^{2}, \frac{1}{24}\right) \cdot {a}^{2} - \frac{1}{2}, {a}^{2}, 1\right) - \sin b \cdot \sin a} \]
              9. unpow2N/A

                \[\leadsto r \cdot \frac{\sin b}{\cos b \cdot \mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{720}, a \cdot a, \frac{1}{24}\right) \cdot {a}^{2} - \frac{1}{2}, {a}^{2}, 1\right) - \sin b \cdot \sin a} \]
              10. lower-*.f64N/A

                \[\leadsto r \cdot \frac{\sin b}{\cos b \cdot \mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{720}, a \cdot a, \frac{1}{24}\right) \cdot {a}^{2} - \frac{1}{2}, {a}^{2}, 1\right) - \sin b \cdot \sin a} \]
              11. unpow2N/A

                \[\leadsto r \cdot \frac{\sin b}{\cos b \cdot \mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{720}, a \cdot a, \frac{1}{24}\right) \cdot \left(a \cdot a\right) - \frac{1}{2}, {a}^{2}, 1\right) - \sin b \cdot \sin a} \]
              12. lower-*.f64N/A

                \[\leadsto r \cdot \frac{\sin b}{\cos b \cdot \mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{720}, a \cdot a, \frac{1}{24}\right) \cdot \left(a \cdot a\right) - \frac{1}{2}, {a}^{2}, 1\right) - \sin b \cdot \sin a} \]
              13. unpow2N/A

                \[\leadsto r \cdot \frac{\sin b}{\cos b \cdot \mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{720}, a \cdot a, \frac{1}{24}\right) \cdot \left(a \cdot a\right) - \frac{1}{2}, a \cdot \color{blue}{a}, 1\right) - \sin b \cdot \sin a} \]
              14. lower-*.f6499.5

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

              \[\leadsto r \cdot \frac{\sin b}{\cos b \cdot \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(-0.001388888888888889, a \cdot a, 0.041666666666666664\right) \cdot \left(a \cdot a\right) - 0.5, a \cdot a, 1\right)} - \sin b \cdot \sin a} \]
          4. Recombined 2 regimes into one program.
          5. Add Preprocessing

          Alternative 5: 78.2% accurate, 0.4× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} t_0 := r \cdot \frac{b}{\cos b \cdot \cos a - b \cdot \sin a}\\ \mathbf{if}\;a \leq -3.5:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;a \leq 3.9:\\ \;\;\;\;r \cdot \frac{\sin b}{\mathsf{fma}\left(\cos b, \cos a, \left(-\sin b\right) \cdot \left(\mathsf{fma}\left(0.008333333333333333 \cdot \left(a \cdot a\right) - 0.16666666666666666, a \cdot a, 1\right) \cdot a\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
          (FPCore (r a b)
           :precision binary64
           (let* ((t_0 (* r (/ b (- (* (cos b) (cos a)) (* b (sin a)))))))
             (if (<= a -3.5)
               t_0
               (if (<= a 3.9)
                 (*
                  r
                  (/
                   (sin b)
                   (fma
                    (cos b)
                    (cos a)
                    (*
                     (- (sin b))
                     (*
                      (fma
                       (- (* 0.008333333333333333 (* a a)) 0.16666666666666666)
                       (* a a)
                       1.0)
                      a)))))
                 t_0))))
          double code(double r, double a, double b) {
          	double t_0 = r * (b / ((cos(b) * cos(a)) - (b * sin(a))));
          	double tmp;
          	if (a <= -3.5) {
          		tmp = t_0;
          	} else if (a <= 3.9) {
          		tmp = r * (sin(b) / fma(cos(b), cos(a), (-sin(b) * (fma(((0.008333333333333333 * (a * a)) - 0.16666666666666666), (a * a), 1.0) * a))));
          	} else {
          		tmp = t_0;
          	}
          	return tmp;
          }
          
          function code(r, a, b)
          	t_0 = Float64(r * Float64(b / Float64(Float64(cos(b) * cos(a)) - Float64(b * sin(a)))))
          	tmp = 0.0
          	if (a <= -3.5)
          		tmp = t_0;
          	elseif (a <= 3.9)
          		tmp = Float64(r * Float64(sin(b) / fma(cos(b), cos(a), Float64(Float64(-sin(b)) * Float64(fma(Float64(Float64(0.008333333333333333 * Float64(a * a)) - 0.16666666666666666), Float64(a * a), 1.0) * a)))));
          	else
          		tmp = t_0;
          	end
          	return tmp
          end
          
          code[r_, a_, b_] := Block[{t$95$0 = N[(r * N[(b / N[(N[(N[Cos[b], $MachinePrecision] * N[Cos[a], $MachinePrecision]), $MachinePrecision] - N[(b * N[Sin[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -3.5], t$95$0, If[LessEqual[a, 3.9], N[(r * N[(N[Sin[b], $MachinePrecision] / N[(N[Cos[b], $MachinePrecision] * N[Cos[a], $MachinePrecision] + N[((-N[Sin[b], $MachinePrecision]) * N[(N[(N[(N[(0.008333333333333333 * N[(a * a), $MachinePrecision]), $MachinePrecision] - 0.16666666666666666), $MachinePrecision] * N[(a * a), $MachinePrecision] + 1.0), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          t_0 := r \cdot \frac{b}{\cos b \cdot \cos a - b \cdot \sin a}\\
          \mathbf{if}\;a \leq -3.5:\\
          \;\;\;\;t\_0\\
          
          \mathbf{elif}\;a \leq 3.9:\\
          \;\;\;\;r \cdot \frac{\sin b}{\mathsf{fma}\left(\cos b, \cos a, \left(-\sin b\right) \cdot \left(\mathsf{fma}\left(0.008333333333333333 \cdot \left(a \cdot a\right) - 0.16666666666666666, a \cdot a, 1\right) \cdot a\right)\right)}\\
          
          \mathbf{else}:\\
          \;\;\;\;t\_0\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if a < -3.5 or 3.89999999999999991 < a

            1. Initial program 54.0%

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

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

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

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

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

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

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

                \[\leadsto r \cdot \frac{\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 r \cdot \frac{\sin b}{\cos b \cdot \color{blue}{\cos a} - \sin b \cdot \sin a} \]
              10. lower-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

                if -3.5 < a < 3.89999999999999991

                1. Initial program 98.5%

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

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

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

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

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

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

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

                    \[\leadsto r \cdot \frac{\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 r \cdot \frac{\sin b}{\cos b \cdot \color{blue}{\cos a} - \sin b \cdot \sin a} \]
                  10. lower-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto r \cdot \frac{\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 r \cdot \frac{\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 r \cdot \frac{\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 r \cdot \frac{\sin b}{\mathsf{fma}\left(\cos b, \color{blue}{\cos a}, \left(\mathsf{neg}\left(\sin b\right)\right) \cdot \sin a\right)} \]
                  12. lower-*.f64N/A

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

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

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

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

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

                  \[\leadsto r \cdot \frac{\sin b}{\mathsf{fma}\left(\cos b, \cos a, \left(-\sin b\right) \cdot \color{blue}{\left(a \cdot \left(1 + {a}^{2} \cdot \left(\frac{1}{120} \cdot {a}^{2} - \frac{1}{6}\right)\right)\right)}\right)} \]
                7. Step-by-step derivation
                  1. *-commutativeN/A

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

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

                    \[\leadsto r \cdot \frac{\sin b}{\mathsf{fma}\left(\cos b, \cos a, \left(-\sin b\right) \cdot \left(\left({a}^{2} \cdot \left(\frac{1}{120} \cdot {a}^{2} - \frac{1}{6}\right) + 1\right) \cdot a\right)\right)} \]
                  4. *-commutativeN/A

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

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

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

                    \[\leadsto r \cdot \frac{\sin b}{\mathsf{fma}\left(\cos b, \cos a, \left(-\sin b\right) \cdot \left(\mathsf{fma}\left(\frac{1}{120} \cdot {a}^{2} - \frac{1}{6}, {a}^{2}, 1\right) \cdot a\right)\right)} \]
                  8. unpow2N/A

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

                    \[\leadsto r \cdot \frac{\sin b}{\mathsf{fma}\left(\cos b, \cos a, \left(-\sin b\right) \cdot \left(\mathsf{fma}\left(\frac{1}{120} \cdot \left(a \cdot a\right) - \frac{1}{6}, {a}^{2}, 1\right) \cdot a\right)\right)} \]
                  10. unpow2N/A

                    \[\leadsto r \cdot \frac{\sin b}{\mathsf{fma}\left(\cos b, \cos a, \left(-\sin b\right) \cdot \left(\mathsf{fma}\left(\frac{1}{120} \cdot \left(a \cdot a\right) - \frac{1}{6}, a \cdot a, 1\right) \cdot a\right)\right)} \]
                  11. lower-*.f6499.5

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

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

              Alternative 6: 78.1% accurate, 0.4× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos b \cdot \cos a\\ t_1 := r \cdot \frac{b}{t\_0 - b \cdot \sin a}\\ \mathbf{if}\;a \leq -3.5:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;a \leq 3.9:\\ \;\;\;\;r \cdot \frac{\sin b}{t\_0 - \sin b \cdot \left(\mathsf{fma}\left(\left(a \cdot a\right) \cdot 0.008333333333333333 - 0.16666666666666666, a \cdot a, 1\right) \cdot a\right)}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
              (FPCore (r a b)
               :precision binary64
               (let* ((t_0 (* (cos b) (cos a))) (t_1 (* r (/ b (- t_0 (* b (sin a)))))))
                 (if (<= a -3.5)
                   t_1
                   (if (<= a 3.9)
                     (*
                      r
                      (/
                       (sin b)
                       (-
                        t_0
                        (*
                         (sin b)
                         (*
                          (fma
                           (- (* (* a a) 0.008333333333333333) 0.16666666666666666)
                           (* a a)
                           1.0)
                          a)))))
                     t_1))))
              double code(double r, double a, double b) {
              	double t_0 = cos(b) * cos(a);
              	double t_1 = r * (b / (t_0 - (b * sin(a))));
              	double tmp;
              	if (a <= -3.5) {
              		tmp = t_1;
              	} else if (a <= 3.9) {
              		tmp = r * (sin(b) / (t_0 - (sin(b) * (fma((((a * a) * 0.008333333333333333) - 0.16666666666666666), (a * a), 1.0) * a))));
              	} else {
              		tmp = t_1;
              	}
              	return tmp;
              }
              
              function code(r, a, b)
              	t_0 = Float64(cos(b) * cos(a))
              	t_1 = Float64(r * Float64(b / Float64(t_0 - Float64(b * sin(a)))))
              	tmp = 0.0
              	if (a <= -3.5)
              		tmp = t_1;
              	elseif (a <= 3.9)
              		tmp = Float64(r * Float64(sin(b) / Float64(t_0 - Float64(sin(b) * Float64(fma(Float64(Float64(Float64(a * a) * 0.008333333333333333) - 0.16666666666666666), Float64(a * a), 1.0) * a)))));
              	else
              		tmp = t_1;
              	end
              	return tmp
              end
              
              code[r_, a_, b_] := Block[{t$95$0 = N[(N[Cos[b], $MachinePrecision] * N[Cos[a], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(r * N[(b / N[(t$95$0 - N[(b * N[Sin[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -3.5], t$95$1, If[LessEqual[a, 3.9], N[(r * N[(N[Sin[b], $MachinePrecision] / N[(t$95$0 - N[(N[Sin[b], $MachinePrecision] * N[(N[(N[(N[(N[(a * a), $MachinePrecision] * 0.008333333333333333), $MachinePrecision] - 0.16666666666666666), $MachinePrecision] * N[(a * a), $MachinePrecision] + 1.0), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              t_0 := \cos b \cdot \cos a\\
              t_1 := r \cdot \frac{b}{t\_0 - b \cdot \sin a}\\
              \mathbf{if}\;a \leq -3.5:\\
              \;\;\;\;t\_1\\
              
              \mathbf{elif}\;a \leq 3.9:\\
              \;\;\;\;r \cdot \frac{\sin b}{t\_0 - \sin b \cdot \left(\mathsf{fma}\left(\left(a \cdot a\right) \cdot 0.008333333333333333 - 0.16666666666666666, a \cdot a, 1\right) \cdot a\right)}\\
              
              \mathbf{else}:\\
              \;\;\;\;t\_1\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if a < -3.5 or 3.89999999999999991 < a

                1. Initial program 54.0%

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

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

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

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

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

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

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

                    \[\leadsto r \cdot \frac{\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 r \cdot \frac{\sin b}{\cos b \cdot \color{blue}{\cos a} - \sin b \cdot \sin a} \]
                  10. lower-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

                    if -3.5 < a < 3.89999999999999991

                    1. Initial program 98.5%

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

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

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

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

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

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

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

                        \[\leadsto r \cdot \frac{\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 r \cdot \frac{\sin b}{\cos b \cdot \color{blue}{\cos a} - \sin b \cdot \sin a} \]
                      10. lower-*.f64N/A

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

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

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

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

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

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

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

                      \[\leadsto r \cdot \frac{\sin b}{\cos b \cdot \cos a - \sin b \cdot \color{blue}{\left(a \cdot \left(1 + {a}^{2} \cdot \left(\frac{1}{120} \cdot {a}^{2} - \frac{1}{6}\right)\right)\right)}} \]
                    5. Step-by-step derivation
                      1. *-commutativeN/A

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

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

                        \[\leadsto r \cdot \frac{\sin b}{\cos b \cdot \cos a - \sin b \cdot \left(\left({a}^{2} \cdot \left(\frac{1}{120} \cdot {a}^{2} - \frac{1}{6}\right) + 1\right) \cdot a\right)} \]
                      4. *-commutativeN/A

                        \[\leadsto r \cdot \frac{\sin b}{\cos b \cdot \cos a - \sin b \cdot \left(\left(\left(\frac{1}{120} \cdot {a}^{2} - \frac{1}{6}\right) \cdot {a}^{2} + 1\right) \cdot a\right)} \]
                      5. lower-fma.f64N/A

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

                        \[\leadsto r \cdot \frac{\sin b}{\cos b \cdot \cos a - \sin b \cdot \left(\mathsf{fma}\left(\frac{1}{120} \cdot {a}^{2} - \frac{1}{6}, {a}^{2}, 1\right) \cdot a\right)} \]
                      7. *-commutativeN/A

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

                        \[\leadsto r \cdot \frac{\sin b}{\cos b \cdot \cos a - \sin b \cdot \left(\mathsf{fma}\left({a}^{2} \cdot \frac{1}{120} - \frac{1}{6}, {a}^{2}, 1\right) \cdot a\right)} \]
                      9. unpow2N/A

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

                        \[\leadsto r \cdot \frac{\sin b}{\cos b \cdot \cos a - \sin b \cdot \left(\mathsf{fma}\left(\left(a \cdot a\right) \cdot \frac{1}{120} - \frac{1}{6}, {a}^{2}, 1\right) \cdot a\right)} \]
                      11. unpow2N/A

                        \[\leadsto r \cdot \frac{\sin b}{\cos b \cdot \cos a - \sin b \cdot \left(\mathsf{fma}\left(\left(a \cdot a\right) \cdot \frac{1}{120} - \frac{1}{6}, a \cdot a, 1\right) \cdot a\right)} \]
                      12. lower-*.f6499.5

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

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

                  Alternative 7: 78.1% accurate, 0.4× speedup?

                  \[\begin{array}{l} \\ \begin{array}{l} t_0 := r \cdot \frac{b}{\cos b \cdot \cos a - b \cdot \sin a}\\ \mathbf{if}\;a \leq -0.22:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;a \leq 0.35:\\ \;\;\;\;r \cdot \frac{\sin b}{\cos b \cdot \mathsf{fma}\left(0.041666666666666664 \cdot \left(a \cdot a\right) - 0.5, a \cdot a, 1\right) - \sin b \cdot \sin a}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
                  (FPCore (r a b)
                   :precision binary64
                   (let* ((t_0 (* r (/ b (- (* (cos b) (cos a)) (* b (sin a)))))))
                     (if (<= a -0.22)
                       t_0
                       (if (<= a 0.35)
                         (*
                          r
                          (/
                           (sin b)
                           (-
                            (*
                             (cos b)
                             (fma (- (* 0.041666666666666664 (* a a)) 0.5) (* a a) 1.0))
                            (* (sin b) (sin a)))))
                         t_0))))
                  double code(double r, double a, double b) {
                  	double t_0 = r * (b / ((cos(b) * cos(a)) - (b * sin(a))));
                  	double tmp;
                  	if (a <= -0.22) {
                  		tmp = t_0;
                  	} else if (a <= 0.35) {
                  		tmp = r * (sin(b) / ((cos(b) * fma(((0.041666666666666664 * (a * a)) - 0.5), (a * a), 1.0)) - (sin(b) * sin(a))));
                  	} else {
                  		tmp = t_0;
                  	}
                  	return tmp;
                  }
                  
                  function code(r, a, b)
                  	t_0 = Float64(r * Float64(b / Float64(Float64(cos(b) * cos(a)) - Float64(b * sin(a)))))
                  	tmp = 0.0
                  	if (a <= -0.22)
                  		tmp = t_0;
                  	elseif (a <= 0.35)
                  		tmp = Float64(r * Float64(sin(b) / Float64(Float64(cos(b) * fma(Float64(Float64(0.041666666666666664 * Float64(a * a)) - 0.5), Float64(a * a), 1.0)) - Float64(sin(b) * sin(a)))));
                  	else
                  		tmp = t_0;
                  	end
                  	return tmp
                  end
                  
                  code[r_, a_, b_] := Block[{t$95$0 = N[(r * N[(b / N[(N[(N[Cos[b], $MachinePrecision] * N[Cos[a], $MachinePrecision]), $MachinePrecision] - N[(b * N[Sin[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -0.22], t$95$0, If[LessEqual[a, 0.35], N[(r * N[(N[Sin[b], $MachinePrecision] / N[(N[(N[Cos[b], $MachinePrecision] * N[(N[(N[(0.041666666666666664 * N[(a * a), $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision] * N[(a * a), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] - N[(N[Sin[b], $MachinePrecision] * N[Sin[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
                  
                  \begin{array}{l}
                  
                  \\
                  \begin{array}{l}
                  t_0 := r \cdot \frac{b}{\cos b \cdot \cos a - b \cdot \sin a}\\
                  \mathbf{if}\;a \leq -0.22:\\
                  \;\;\;\;t\_0\\
                  
                  \mathbf{elif}\;a \leq 0.35:\\
                  \;\;\;\;r \cdot \frac{\sin b}{\cos b \cdot \mathsf{fma}\left(0.041666666666666664 \cdot \left(a \cdot a\right) - 0.5, a \cdot a, 1\right) - \sin b \cdot \sin a}\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;t\_0\\
                  
                  
                  \end{array}
                  \end{array}
                  
                  Derivation
                  1. Split input into 2 regimes
                  2. if a < -0.220000000000000001 or 0.34999999999999998 < a

                    1. Initial program 54.0%

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

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

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

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

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

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

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

                        \[\leadsto r \cdot \frac{\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 r \cdot \frac{\sin b}{\cos b \cdot \color{blue}{\cos a} - \sin b \cdot \sin a} \]
                      10. lower-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

                        if -0.220000000000000001 < a < 0.34999999999999998

                        1. Initial program 98.6%

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

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

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

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

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

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

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

                            \[\leadsto r \cdot \frac{\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 r \cdot \frac{\sin b}{\cos b \cdot \color{blue}{\cos a} - \sin b \cdot \sin a} \]
                          10. lower-*.f64N/A

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

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

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

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

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

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

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

                          \[\leadsto r \cdot \frac{\sin b}{\cos b \cdot \color{blue}{\left(1 + {a}^{2} \cdot \left(\frac{1}{24} \cdot {a}^{2} - \frac{1}{2}\right)\right)} - \sin b \cdot \sin a} \]
                        5. Step-by-step derivation
                          1. +-commutativeN/A

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

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

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

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

                            \[\leadsto r \cdot \frac{\sin b}{\cos b \cdot \mathsf{fma}\left(\frac{1}{24} \cdot {a}^{2} - \frac{1}{2}, {a}^{2}, 1\right) - \sin b \cdot \sin a} \]
                          6. unpow2N/A

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

                            \[\leadsto r \cdot \frac{\sin b}{\cos b \cdot \mathsf{fma}\left(\frac{1}{24} \cdot \left(a \cdot a\right) - \frac{1}{2}, {a}^{2}, 1\right) - \sin b \cdot \sin a} \]
                          8. unpow2N/A

                            \[\leadsto r \cdot \frac{\sin b}{\cos b \cdot \mathsf{fma}\left(\frac{1}{24} \cdot \left(a \cdot a\right) - \frac{1}{2}, a \cdot \color{blue}{a}, 1\right) - \sin b \cdot \sin a} \]
                          9. lower-*.f6499.6

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

                          \[\leadsto r \cdot \frac{\sin b}{\cos b \cdot \color{blue}{\mathsf{fma}\left(0.041666666666666664 \cdot \left(a \cdot a\right) - 0.5, a \cdot a, 1\right)} - \sin b \cdot \sin a} \]
                      4. Recombined 2 regimes into one program.
                      5. Add Preprocessing

                      Alternative 8: 78.1% accurate, 0.5× speedup?

                      \[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos b \cdot \cos a\\ t_1 := r \cdot \frac{b}{t\_0 - b \cdot \sin a}\\ \mathbf{if}\;a \leq -1.35:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;a \leq 4.1:\\ \;\;\;\;r \cdot \frac{\sin b}{t\_0 - \sin b \cdot \left(\mathsf{fma}\left(-0.16666666666666666, a \cdot a, 1\right) \cdot a\right)}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
                      (FPCore (r a b)
                       :precision binary64
                       (let* ((t_0 (* (cos b) (cos a))) (t_1 (* r (/ b (- t_0 (* b (sin a)))))))
                         (if (<= a -1.35)
                           t_1
                           (if (<= a 4.1)
                             (*
                              r
                              (/
                               (sin b)
                               (- t_0 (* (sin b) (* (fma -0.16666666666666666 (* a a) 1.0) a)))))
                             t_1))))
                      double code(double r, double a, double b) {
                      	double t_0 = cos(b) * cos(a);
                      	double t_1 = r * (b / (t_0 - (b * sin(a))));
                      	double tmp;
                      	if (a <= -1.35) {
                      		tmp = t_1;
                      	} else if (a <= 4.1) {
                      		tmp = r * (sin(b) / (t_0 - (sin(b) * (fma(-0.16666666666666666, (a * a), 1.0) * a))));
                      	} else {
                      		tmp = t_1;
                      	}
                      	return tmp;
                      }
                      
                      function code(r, a, b)
                      	t_0 = Float64(cos(b) * cos(a))
                      	t_1 = Float64(r * Float64(b / Float64(t_0 - Float64(b * sin(a)))))
                      	tmp = 0.0
                      	if (a <= -1.35)
                      		tmp = t_1;
                      	elseif (a <= 4.1)
                      		tmp = Float64(r * Float64(sin(b) / Float64(t_0 - Float64(sin(b) * Float64(fma(-0.16666666666666666, Float64(a * a), 1.0) * a)))));
                      	else
                      		tmp = t_1;
                      	end
                      	return tmp
                      end
                      
                      code[r_, a_, b_] := Block[{t$95$0 = N[(N[Cos[b], $MachinePrecision] * N[Cos[a], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(r * N[(b / N[(t$95$0 - N[(b * N[Sin[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -1.35], t$95$1, If[LessEqual[a, 4.1], N[(r * N[(N[Sin[b], $MachinePrecision] / N[(t$95$0 - N[(N[Sin[b], $MachinePrecision] * N[(N[(-0.16666666666666666 * N[(a * a), $MachinePrecision] + 1.0), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
                      
                      \begin{array}{l}
                      
                      \\
                      \begin{array}{l}
                      t_0 := \cos b \cdot \cos a\\
                      t_1 := r \cdot \frac{b}{t\_0 - b \cdot \sin a}\\
                      \mathbf{if}\;a \leq -1.35:\\
                      \;\;\;\;t\_1\\
                      
                      \mathbf{elif}\;a \leq 4.1:\\
                      \;\;\;\;r \cdot \frac{\sin b}{t\_0 - \sin b \cdot \left(\mathsf{fma}\left(-0.16666666666666666, a \cdot a, 1\right) \cdot a\right)}\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;t\_1\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 2 regimes
                      2. if a < -1.3500000000000001 or 4.0999999999999996 < a

                        1. Initial program 54.0%

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

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

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

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

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

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

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

                            \[\leadsto r \cdot \frac{\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 r \cdot \frac{\sin b}{\cos b \cdot \color{blue}{\cos a} - \sin b \cdot \sin a} \]
                          10. lower-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

                            if -1.3500000000000001 < a < 4.0999999999999996

                            1. Initial program 98.5%

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

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

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

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

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

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

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

                                \[\leadsto r \cdot \frac{\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 r \cdot \frac{\sin b}{\cos b \cdot \color{blue}{\cos a} - \sin b \cdot \sin a} \]
                              10. lower-*.f64N/A

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

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

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

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

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

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

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

                              \[\leadsto r \cdot \frac{\sin b}{\cos b \cdot \cos a - \sin b \cdot \color{blue}{\left(a \cdot \left(1 + \frac{-1}{6} \cdot {a}^{2}\right)\right)}} \]
                            5. Step-by-step derivation
                              1. *-commutativeN/A

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

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

                                \[\leadsto r \cdot \frac{\sin b}{\cos b \cdot \cos a - \sin b \cdot \left(\left(\frac{-1}{6} \cdot {a}^{2} + 1\right) \cdot a\right)} \]
                              4. lower-fma.f64N/A

                                \[\leadsto r \cdot \frac{\sin b}{\cos b \cdot \cos a - \sin b \cdot \left(\mathsf{fma}\left(\frac{-1}{6}, {a}^{2}, 1\right) \cdot a\right)} \]
                              5. unpow2N/A

                                \[\leadsto r \cdot \frac{\sin b}{\cos b \cdot \cos a - \sin b \cdot \left(\mathsf{fma}\left(\frac{-1}{6}, a \cdot a, 1\right) \cdot a\right)} \]
                              6. lower-*.f6499.5

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

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

                          Alternative 9: 78.1% accurate, 0.5× speedup?

                          \[\begin{array}{l} \\ \begin{array}{l} t_0 := r \cdot \frac{b}{\cos b \cdot \cos a - b \cdot \sin a}\\ \mathbf{if}\;a \leq -0.16:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;a \leq 0.285:\\ \;\;\;\;r \cdot \frac{\sin b}{\cos b \cdot \mathsf{fma}\left(a \cdot a, -0.5, 1\right) - \sin b \cdot \sin a}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
                          (FPCore (r a b)
                           :precision binary64
                           (let* ((t_0 (* r (/ b (- (* (cos b) (cos a)) (* b (sin a)))))))
                             (if (<= a -0.16)
                               t_0
                               (if (<= a 0.285)
                                 (*
                                  r
                                  (/ (sin b) (- (* (cos b) (fma (* a a) -0.5 1.0)) (* (sin b) (sin a)))))
                                 t_0))))
                          double code(double r, double a, double b) {
                          	double t_0 = r * (b / ((cos(b) * cos(a)) - (b * sin(a))));
                          	double tmp;
                          	if (a <= -0.16) {
                          		tmp = t_0;
                          	} else if (a <= 0.285) {
                          		tmp = r * (sin(b) / ((cos(b) * fma((a * a), -0.5, 1.0)) - (sin(b) * sin(a))));
                          	} else {
                          		tmp = t_0;
                          	}
                          	return tmp;
                          }
                          
                          function code(r, a, b)
                          	t_0 = Float64(r * Float64(b / Float64(Float64(cos(b) * cos(a)) - Float64(b * sin(a)))))
                          	tmp = 0.0
                          	if (a <= -0.16)
                          		tmp = t_0;
                          	elseif (a <= 0.285)
                          		tmp = Float64(r * Float64(sin(b) / Float64(Float64(cos(b) * fma(Float64(a * a), -0.5, 1.0)) - Float64(sin(b) * sin(a)))));
                          	else
                          		tmp = t_0;
                          	end
                          	return tmp
                          end
                          
                          code[r_, a_, b_] := Block[{t$95$0 = N[(r * N[(b / N[(N[(N[Cos[b], $MachinePrecision] * N[Cos[a], $MachinePrecision]), $MachinePrecision] - N[(b * N[Sin[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -0.16], t$95$0, If[LessEqual[a, 0.285], N[(r * N[(N[Sin[b], $MachinePrecision] / N[(N[(N[Cos[b], $MachinePrecision] * N[(N[(a * a), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision]), $MachinePrecision] - N[(N[Sin[b], $MachinePrecision] * N[Sin[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
                          
                          \begin{array}{l}
                          
                          \\
                          \begin{array}{l}
                          t_0 := r \cdot \frac{b}{\cos b \cdot \cos a - b \cdot \sin a}\\
                          \mathbf{if}\;a \leq -0.16:\\
                          \;\;\;\;t\_0\\
                          
                          \mathbf{elif}\;a \leq 0.285:\\
                          \;\;\;\;r \cdot \frac{\sin b}{\cos b \cdot \mathsf{fma}\left(a \cdot a, -0.5, 1\right) - \sin b \cdot \sin a}\\
                          
                          \mathbf{else}:\\
                          \;\;\;\;t\_0\\
                          
                          
                          \end{array}
                          \end{array}
                          
                          Derivation
                          1. Split input into 2 regimes
                          2. if a < -0.160000000000000003 or 0.284999999999999976 < a

                            1. Initial program 54.0%

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

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

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

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

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

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

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

                                \[\leadsto r \cdot \frac{\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 r \cdot \frac{\sin b}{\cos b \cdot \color{blue}{\cos a} - \sin b \cdot \sin a} \]
                              10. lower-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

                                if -0.160000000000000003 < a < 0.284999999999999976

                                1. Initial program 98.6%

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

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

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

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

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

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

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

                                    \[\leadsto r \cdot \frac{\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 r \cdot \frac{\sin b}{\cos b \cdot \color{blue}{\cos a} - \sin b \cdot \sin a} \]
                                  10. lower-*.f64N/A

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

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

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

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

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

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

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

                                  \[\leadsto r \cdot \frac{\sin b}{\cos b \cdot \color{blue}{\left(1 + \frac{-1}{2} \cdot {a}^{2}\right)} - \sin b \cdot \sin a} \]
                                5. Step-by-step derivation
                                  1. +-commutativeN/A

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

                                    \[\leadsto r \cdot \frac{\sin b}{\cos b \cdot \left({a}^{2} \cdot \frac{-1}{2} + 1\right) - \sin b \cdot \sin a} \]
                                  3. lower-fma.f64N/A

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

                                    \[\leadsto r \cdot \frac{\sin b}{\cos b \cdot \mathsf{fma}\left(a \cdot a, \frac{-1}{2}, 1\right) - \sin b \cdot \sin a} \]
                                  5. lower-*.f6499.4

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

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

                              Alternative 10: 78.0% accurate, 0.5× speedup?

                              \[\begin{array}{l} \\ \begin{array}{l} t_0 := r \cdot \frac{b}{\cos b \cdot \cos a - b \cdot \sin a}\\ \mathbf{if}\;a \leq -0.16:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;a \leq 0.26:\\ \;\;\;\;r \cdot \frac{\sin b}{\mathsf{fma}\left(a, \left(\cos b \cdot a\right) \cdot -0.5 - \sin b, \cos b\right)}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
                              (FPCore (r a b)
                               :precision binary64
                               (let* ((t_0 (* r (/ b (- (* (cos b) (cos a)) (* b (sin a)))))))
                                 (if (<= a -0.16)
                                   t_0
                                   (if (<= a 0.26)
                                     (* r (/ (sin b) (fma a (- (* (* (cos b) a) -0.5) (sin b)) (cos b))))
                                     t_0))))
                              double code(double r, double a, double b) {
                              	double t_0 = r * (b / ((cos(b) * cos(a)) - (b * sin(a))));
                              	double tmp;
                              	if (a <= -0.16) {
                              		tmp = t_0;
                              	} else if (a <= 0.26) {
                              		tmp = r * (sin(b) / fma(a, (((cos(b) * a) * -0.5) - sin(b)), cos(b)));
                              	} else {
                              		tmp = t_0;
                              	}
                              	return tmp;
                              }
                              
                              function code(r, a, b)
                              	t_0 = Float64(r * Float64(b / Float64(Float64(cos(b) * cos(a)) - Float64(b * sin(a)))))
                              	tmp = 0.0
                              	if (a <= -0.16)
                              		tmp = t_0;
                              	elseif (a <= 0.26)
                              		tmp = Float64(r * Float64(sin(b) / fma(a, Float64(Float64(Float64(cos(b) * a) * -0.5) - sin(b)), cos(b))));
                              	else
                              		tmp = t_0;
                              	end
                              	return tmp
                              end
                              
                              code[r_, a_, b_] := Block[{t$95$0 = N[(r * N[(b / N[(N[(N[Cos[b], $MachinePrecision] * N[Cos[a], $MachinePrecision]), $MachinePrecision] - N[(b * N[Sin[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -0.16], t$95$0, If[LessEqual[a, 0.26], N[(r * N[(N[Sin[b], $MachinePrecision] / N[(a * N[(N[(N[(N[Cos[b], $MachinePrecision] * a), $MachinePrecision] * -0.5), $MachinePrecision] - N[Sin[b], $MachinePrecision]), $MachinePrecision] + N[Cos[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
                              
                              \begin{array}{l}
                              
                              \\
                              \begin{array}{l}
                              t_0 := r \cdot \frac{b}{\cos b \cdot \cos a - b \cdot \sin a}\\
                              \mathbf{if}\;a \leq -0.16:\\
                              \;\;\;\;t\_0\\
                              
                              \mathbf{elif}\;a \leq 0.26:\\
                              \;\;\;\;r \cdot \frac{\sin b}{\mathsf{fma}\left(a, \left(\cos b \cdot a\right) \cdot -0.5 - \sin b, \cos b\right)}\\
                              
                              \mathbf{else}:\\
                              \;\;\;\;t\_0\\
                              
                              
                              \end{array}
                              \end{array}
                              
                              Derivation
                              1. Split input into 2 regimes
                              2. if a < -0.160000000000000003 or 0.26000000000000001 < a

                                1. Initial program 54.0%

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

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

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

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

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

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

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

                                    \[\leadsto r \cdot \frac{\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 r \cdot \frac{\sin b}{\cos b \cdot \color{blue}{\cos a} - \sin b \cdot \sin a} \]
                                  10. lower-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

                                    if -0.160000000000000003 < a < 0.26000000000000001

                                    1. Initial program 98.6%

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

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

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

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

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

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

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

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

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

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

                                        \[\leadsto r \cdot \frac{\sin b}{\mathsf{fma}\left(a, \left(\cos b \cdot a\right) \cdot \frac{-1}{2} - \sin b, \cos b\right)} \]
                                      10. lower-cos.f6499.3

                                        \[\leadsto r \cdot \frac{\sin b}{\mathsf{fma}\left(a, \left(\cos b \cdot a\right) \cdot -0.5 - \sin b, \cos b\right)} \]
                                    4. Applied rewrites99.3%

                                      \[\leadsto r \cdot \frac{\sin b}{\color{blue}{\mathsf{fma}\left(a, \left(\cos b \cdot a\right) \cdot -0.5 - \sin b, \cos b\right)}} \]
                                  4. Recombined 2 regimes into one program.
                                  5. Add Preprocessing

                                  Alternative 11: 78.0% accurate, 0.5× speedup?

                                  \[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos b \cdot \cos a\\ t_1 := r \cdot \frac{b}{t\_0 - b \cdot \sin a}\\ \mathbf{if}\;a \leq -1.25:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;a \leq 1.1:\\ \;\;\;\;r \cdot \frac{\sin b}{t\_0 - \sin b \cdot a}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
                                  (FPCore (r a b)
                                   :precision binary64
                                   (let* ((t_0 (* (cos b) (cos a))) (t_1 (* r (/ b (- t_0 (* b (sin a)))))))
                                     (if (<= a -1.25)
                                       t_1
                                       (if (<= a 1.1) (* r (/ (sin b) (- t_0 (* (sin b) a)))) t_1))))
                                  double code(double r, double a, double b) {
                                  	double t_0 = cos(b) * cos(a);
                                  	double t_1 = r * (b / (t_0 - (b * sin(a))));
                                  	double tmp;
                                  	if (a <= -1.25) {
                                  		tmp = t_1;
                                  	} else if (a <= 1.1) {
                                  		tmp = r * (sin(b) / (t_0 - (sin(b) * a)));
                                  	} else {
                                  		tmp = t_1;
                                  	}
                                  	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) :: t_0
                                      real(8) :: t_1
                                      real(8) :: tmp
                                      t_0 = cos(b) * cos(a)
                                      t_1 = r * (b / (t_0 - (b * sin(a))))
                                      if (a <= (-1.25d0)) then
                                          tmp = t_1
                                      else if (a <= 1.1d0) then
                                          tmp = r * (sin(b) / (t_0 - (sin(b) * a)))
                                      else
                                          tmp = t_1
                                      end if
                                      code = tmp
                                  end function
                                  
                                  public static double code(double r, double a, double b) {
                                  	double t_0 = Math.cos(b) * Math.cos(a);
                                  	double t_1 = r * (b / (t_0 - (b * Math.sin(a))));
                                  	double tmp;
                                  	if (a <= -1.25) {
                                  		tmp = t_1;
                                  	} else if (a <= 1.1) {
                                  		tmp = r * (Math.sin(b) / (t_0 - (Math.sin(b) * a)));
                                  	} else {
                                  		tmp = t_1;
                                  	}
                                  	return tmp;
                                  }
                                  
                                  def code(r, a, b):
                                  	t_0 = math.cos(b) * math.cos(a)
                                  	t_1 = r * (b / (t_0 - (b * math.sin(a))))
                                  	tmp = 0
                                  	if a <= -1.25:
                                  		tmp = t_1
                                  	elif a <= 1.1:
                                  		tmp = r * (math.sin(b) / (t_0 - (math.sin(b) * a)))
                                  	else:
                                  		tmp = t_1
                                  	return tmp
                                  
                                  function code(r, a, b)
                                  	t_0 = Float64(cos(b) * cos(a))
                                  	t_1 = Float64(r * Float64(b / Float64(t_0 - Float64(b * sin(a)))))
                                  	tmp = 0.0
                                  	if (a <= -1.25)
                                  		tmp = t_1;
                                  	elseif (a <= 1.1)
                                  		tmp = Float64(r * Float64(sin(b) / Float64(t_0 - Float64(sin(b) * a))));
                                  	else
                                  		tmp = t_1;
                                  	end
                                  	return tmp
                                  end
                                  
                                  function tmp_2 = code(r, a, b)
                                  	t_0 = cos(b) * cos(a);
                                  	t_1 = r * (b / (t_0 - (b * sin(a))));
                                  	tmp = 0.0;
                                  	if (a <= -1.25)
                                  		tmp = t_1;
                                  	elseif (a <= 1.1)
                                  		tmp = r * (sin(b) / (t_0 - (sin(b) * a)));
                                  	else
                                  		tmp = t_1;
                                  	end
                                  	tmp_2 = tmp;
                                  end
                                  
                                  code[r_, a_, b_] := Block[{t$95$0 = N[(N[Cos[b], $MachinePrecision] * N[Cos[a], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(r * N[(b / N[(t$95$0 - N[(b * N[Sin[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -1.25], t$95$1, If[LessEqual[a, 1.1], N[(r * N[(N[Sin[b], $MachinePrecision] / N[(t$95$0 - N[(N[Sin[b], $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
                                  
                                  \begin{array}{l}
                                  
                                  \\
                                  \begin{array}{l}
                                  t_0 := \cos b \cdot \cos a\\
                                  t_1 := r \cdot \frac{b}{t\_0 - b \cdot \sin a}\\
                                  \mathbf{if}\;a \leq -1.25:\\
                                  \;\;\;\;t\_1\\
                                  
                                  \mathbf{elif}\;a \leq 1.1:\\
                                  \;\;\;\;r \cdot \frac{\sin b}{t\_0 - \sin b \cdot a}\\
                                  
                                  \mathbf{else}:\\
                                  \;\;\;\;t\_1\\
                                  
                                  
                                  \end{array}
                                  \end{array}
                                  
                                  Derivation
                                  1. Split input into 2 regimes
                                  2. if a < -1.25 or 1.1000000000000001 < a

                                    1. Initial program 54.0%

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

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

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

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

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

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

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

                                        \[\leadsto r \cdot \frac{\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 r \cdot \frac{\sin b}{\cos b \cdot \color{blue}{\cos a} - \sin b \cdot \sin a} \]
                                      10. lower-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

                                        if -1.25 < a < 1.1000000000000001

                                        1. Initial program 98.5%

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

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

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

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

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

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

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

                                            \[\leadsto r \cdot \frac{\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 r \cdot \frac{\sin b}{\cos b \cdot \color{blue}{\cos a} - \sin b \cdot \sin a} \]
                                          10. lower-*.f64N/A

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

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

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

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

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

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

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

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

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

                                        Alternative 12: 76.4% accurate, 1.0× speedup?

                                        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \tan b \cdot r\\ \mathbf{if}\;b \leq -0.44:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;b \leq 7.2 \cdot 10^{-12}:\\ \;\;\;\;r \cdot \frac{\mathsf{fma}\left(\mathsf{fma}\left(-0.0001984126984126984, b \cdot b, 0.008333333333333333\right) \cdot \left(b \cdot b\right) - 0.16666666666666666, b \cdot b, 1\right) \cdot b}{\cos \left(a + b\right)}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
                                        (FPCore (r a b)
                                         :precision binary64
                                         (let* ((t_0 (* (tan b) r)))
                                           (if (<= b -0.44)
                                             t_0
                                             (if (<= b 7.2e-12)
                                               (*
                                                r
                                                (/
                                                 (*
                                                  (fma
                                                   (-
                                                    (*
                                                     (fma -0.0001984126984126984 (* b b) 0.008333333333333333)
                                                     (* b b))
                                                    0.16666666666666666)
                                                   (* b b)
                                                   1.0)
                                                  b)
                                                 (cos (+ a b))))
                                               t_0))))
                                        double code(double r, double a, double b) {
                                        	double t_0 = tan(b) * r;
                                        	double tmp;
                                        	if (b <= -0.44) {
                                        		tmp = t_0;
                                        	} else if (b <= 7.2e-12) {
                                        		tmp = r * ((fma(((fma(-0.0001984126984126984, (b * b), 0.008333333333333333) * (b * b)) - 0.16666666666666666), (b * b), 1.0) * b) / cos((a + b)));
                                        	} else {
                                        		tmp = t_0;
                                        	}
                                        	return tmp;
                                        }
                                        
                                        function code(r, a, b)
                                        	t_0 = Float64(tan(b) * r)
                                        	tmp = 0.0
                                        	if (b <= -0.44)
                                        		tmp = t_0;
                                        	elseif (b <= 7.2e-12)
                                        		tmp = Float64(r * Float64(Float64(fma(Float64(Float64(fma(-0.0001984126984126984, Float64(b * b), 0.008333333333333333) * Float64(b * b)) - 0.16666666666666666), Float64(b * b), 1.0) * b) / cos(Float64(a + b))));
                                        	else
                                        		tmp = t_0;
                                        	end
                                        	return tmp
                                        end
                                        
                                        code[r_, a_, b_] := Block[{t$95$0 = N[(N[Tan[b], $MachinePrecision] * r), $MachinePrecision]}, If[LessEqual[b, -0.44], t$95$0, If[LessEqual[b, 7.2e-12], N[(r * N[(N[(N[(N[(N[(N[(-0.0001984126984126984 * N[(b * b), $MachinePrecision] + 0.008333333333333333), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision] - 0.16666666666666666), $MachinePrecision] * N[(b * b), $MachinePrecision] + 1.0), $MachinePrecision] * b), $MachinePrecision] / N[Cos[N[(a + b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
                                        
                                        \begin{array}{l}
                                        
                                        \\
                                        \begin{array}{l}
                                        t_0 := \tan b \cdot r\\
                                        \mathbf{if}\;b \leq -0.44:\\
                                        \;\;\;\;t\_0\\
                                        
                                        \mathbf{elif}\;b \leq 7.2 \cdot 10^{-12}:\\
                                        \;\;\;\;r \cdot \frac{\mathsf{fma}\left(\mathsf{fma}\left(-0.0001984126984126984, b \cdot b, 0.008333333333333333\right) \cdot \left(b \cdot b\right) - 0.16666666666666666, b \cdot b, 1\right) \cdot b}{\cos \left(a + b\right)}\\
                                        
                                        \mathbf{else}:\\
                                        \;\;\;\;t\_0\\
                                        
                                        
                                        \end{array}
                                        \end{array}
                                        
                                        Derivation
                                        1. Split input into 2 regimes
                                        2. if b < -0.440000000000000002 or 7.2e-12 < b

                                          1. Initial program 55.0%

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

                                            \[\leadsto r \cdot \color{blue}{\frac{\sin b}{\cos b}} \]
                                          3. Step-by-step derivation
                                            1. quot-tanN/A

                                              \[\leadsto r \cdot \tan b \]
                                            2. lower-tan.f6454.6

                                              \[\leadsto r \cdot \tan b \]
                                          4. Applied rewrites54.6%

                                            \[\leadsto r \cdot \color{blue}{\tan b} \]
                                          5. Step-by-step derivation
                                            1. lift-*.f64N/A

                                              \[\leadsto \color{blue}{r \cdot \tan b} \]
                                            2. *-commutativeN/A

                                              \[\leadsto \color{blue}{\tan b \cdot r} \]
                                            3. lower-*.f6454.6

                                              \[\leadsto \color{blue}{\tan b \cdot r} \]
                                            4. cos-sum-rev54.6

                                              \[\leadsto \tan b \cdot r \]
                                            5. *-commutative54.6

                                              \[\leadsto \tan b \cdot r \]
                                            6. *-commutative54.6

                                              \[\leadsto \tan b \cdot r \]
                                          6. Applied rewrites54.6%

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

                                          if -0.440000000000000002 < b < 7.2e-12

                                          1. Initial program 99.3%

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

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

                                              \[\leadsto r \cdot \frac{\left(1 + {b}^{2} \cdot \left({b}^{2} \cdot \left(\frac{1}{120} + \frac{-1}{5040} \cdot {b}^{2}\right) - \frac{1}{6}\right)\right) \cdot \color{blue}{b}}{\cos \left(a + b\right)} \]
                                            2. lower-*.f64N/A

                                              \[\leadsto r \cdot \frac{\left(1 + {b}^{2} \cdot \left({b}^{2} \cdot \left(\frac{1}{120} + \frac{-1}{5040} \cdot {b}^{2}\right) - \frac{1}{6}\right)\right) \cdot \color{blue}{b}}{\cos \left(a + b\right)} \]
                                          4. Applied rewrites99.3%

                                            \[\leadsto r \cdot \frac{\color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(-0.0001984126984126984, b \cdot b, 0.008333333333333333\right) \cdot \left(b \cdot b\right) - 0.16666666666666666, b \cdot b, 1\right) \cdot b}}{\cos \left(a + b\right)} \]
                                        3. Recombined 2 regimes into one program.
                                        4. Add Preprocessing

                                        Alternative 13: 76.2% accurate, 1.0× speedup?

                                        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \tan b \cdot r\\ \mathbf{if}\;b \leq -0.44:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;b \leq 7.2 \cdot 10^{-12}:\\ \;\;\;\;r \cdot \frac{\mathsf{fma}\left(\left(b \cdot b\right) \cdot 0.008333333333333333 - 0.16666666666666666, b \cdot b, 1\right) \cdot b}{\cos \left(\left(\frac{b}{a} + 1\right) \cdot a\right)}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
                                        (FPCore (r a b)
                                         :precision binary64
                                         (let* ((t_0 (* (tan b) r)))
                                           (if (<= b -0.44)
                                             t_0
                                             (if (<= b 7.2e-12)
                                               (*
                                                r
                                                (/
                                                 (*
                                                  (fma
                                                   (- (* (* b b) 0.008333333333333333) 0.16666666666666666)
                                                   (* b b)
                                                   1.0)
                                                  b)
                                                 (cos (* (+ (/ b a) 1.0) a))))
                                               t_0))))
                                        double code(double r, double a, double b) {
                                        	double t_0 = tan(b) * r;
                                        	double tmp;
                                        	if (b <= -0.44) {
                                        		tmp = t_0;
                                        	} else if (b <= 7.2e-12) {
                                        		tmp = r * ((fma((((b * b) * 0.008333333333333333) - 0.16666666666666666), (b * b), 1.0) * b) / cos((((b / a) + 1.0) * a)));
                                        	} else {
                                        		tmp = t_0;
                                        	}
                                        	return tmp;
                                        }
                                        
                                        function code(r, a, b)
                                        	t_0 = Float64(tan(b) * r)
                                        	tmp = 0.0
                                        	if (b <= -0.44)
                                        		tmp = t_0;
                                        	elseif (b <= 7.2e-12)
                                        		tmp = Float64(r * Float64(Float64(fma(Float64(Float64(Float64(b * b) * 0.008333333333333333) - 0.16666666666666666), Float64(b * b), 1.0) * b) / cos(Float64(Float64(Float64(b / a) + 1.0) * a))));
                                        	else
                                        		tmp = t_0;
                                        	end
                                        	return tmp
                                        end
                                        
                                        code[r_, a_, b_] := Block[{t$95$0 = N[(N[Tan[b], $MachinePrecision] * r), $MachinePrecision]}, If[LessEqual[b, -0.44], t$95$0, If[LessEqual[b, 7.2e-12], N[(r * N[(N[(N[(N[(N[(N[(b * b), $MachinePrecision] * 0.008333333333333333), $MachinePrecision] - 0.16666666666666666), $MachinePrecision] * N[(b * b), $MachinePrecision] + 1.0), $MachinePrecision] * b), $MachinePrecision] / N[Cos[N[(N[(N[(b / a), $MachinePrecision] + 1.0), $MachinePrecision] * a), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
                                        
                                        \begin{array}{l}
                                        
                                        \\
                                        \begin{array}{l}
                                        t_0 := \tan b \cdot r\\
                                        \mathbf{if}\;b \leq -0.44:\\
                                        \;\;\;\;t\_0\\
                                        
                                        \mathbf{elif}\;b \leq 7.2 \cdot 10^{-12}:\\
                                        \;\;\;\;r \cdot \frac{\mathsf{fma}\left(\left(b \cdot b\right) \cdot 0.008333333333333333 - 0.16666666666666666, b \cdot b, 1\right) \cdot b}{\cos \left(\left(\frac{b}{a} + 1\right) \cdot a\right)}\\
                                        
                                        \mathbf{else}:\\
                                        \;\;\;\;t\_0\\
                                        
                                        
                                        \end{array}
                                        \end{array}
                                        
                                        Derivation
                                        1. Split input into 2 regimes
                                        2. if b < -0.440000000000000002 or 7.2e-12 < b

                                          1. Initial program 55.0%

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

                                            \[\leadsto r \cdot \color{blue}{\frac{\sin b}{\cos b}} \]
                                          3. Step-by-step derivation
                                            1. quot-tanN/A

                                              \[\leadsto r \cdot \tan b \]
                                            2. lower-tan.f6454.6

                                              \[\leadsto r \cdot \tan b \]
                                          4. Applied rewrites54.6%

                                            \[\leadsto r \cdot \color{blue}{\tan b} \]
                                          5. Step-by-step derivation
                                            1. lift-*.f64N/A

                                              \[\leadsto \color{blue}{r \cdot \tan b} \]
                                            2. *-commutativeN/A

                                              \[\leadsto \color{blue}{\tan b \cdot r} \]
                                            3. lower-*.f6454.6

                                              \[\leadsto \color{blue}{\tan b \cdot r} \]
                                            4. cos-sum-rev54.6

                                              \[\leadsto \tan b \cdot r \]
                                            5. *-commutative54.6

                                              \[\leadsto \tan b \cdot r \]
                                            6. *-commutative54.6

                                              \[\leadsto \tan b \cdot r \]
                                          6. Applied rewrites54.6%

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

                                          if -0.440000000000000002 < b < 7.2e-12

                                          1. Initial program 99.3%

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

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

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

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

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

                                              \[\leadsto r \cdot \frac{\sin b}{\cos \left(\left(\frac{b}{a} + 1\right) \cdot a\right)} \]
                                            5. lower-/.f6499.3

                                              \[\leadsto r \cdot \frac{\sin b}{\cos \left(\left(\frac{b}{a} + 1\right) \cdot a\right)} \]
                                          4. Applied rewrites99.3%

                                            \[\leadsto r \cdot \frac{\sin b}{\cos \color{blue}{\left(\left(\frac{b}{a} + 1\right) \cdot a\right)}} \]
                                          5. Taylor expanded in b around 0

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

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

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

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

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

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

                                              \[\leadsto r \cdot \frac{\mathsf{fma}\left(\frac{1}{120} \cdot {b}^{2} - \frac{1}{6}, {b}^{2}, 1\right) \cdot b}{\cos \left(\left(\frac{b}{a} + 1\right) \cdot a\right)} \]
                                            7. *-commutativeN/A

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

                                              \[\leadsto r \cdot \frac{\mathsf{fma}\left({b}^{2} \cdot \frac{1}{120} - \frac{1}{6}, {b}^{2}, 1\right) \cdot b}{\cos \left(\left(\frac{b}{a} + 1\right) \cdot a\right)} \]
                                            9. pow2N/A

                                              \[\leadsto r \cdot \frac{\mathsf{fma}\left(\left(b \cdot b\right) \cdot \frac{1}{120} - \frac{1}{6}, {b}^{2}, 1\right) \cdot b}{\cos \left(\left(\frac{b}{a} + 1\right) \cdot a\right)} \]
                                            10. lift-*.f64N/A

                                              \[\leadsto r \cdot \frac{\mathsf{fma}\left(\left(b \cdot b\right) \cdot \frac{1}{120} - \frac{1}{6}, {b}^{2}, 1\right) \cdot b}{\cos \left(\left(\frac{b}{a} + 1\right) \cdot a\right)} \]
                                            11. pow2N/A

                                              \[\leadsto r \cdot \frac{\mathsf{fma}\left(\left(b \cdot b\right) \cdot \frac{1}{120} - \frac{1}{6}, b \cdot b, 1\right) \cdot b}{\cos \left(\left(\frac{b}{a} + 1\right) \cdot a\right)} \]
                                            12. lift-*.f6499.3

                                              \[\leadsto r \cdot \frac{\mathsf{fma}\left(\left(b \cdot b\right) \cdot 0.008333333333333333 - 0.16666666666666666, b \cdot b, 1\right) \cdot b}{\cos \left(\left(\frac{b}{a} + 1\right) \cdot a\right)} \]
                                          7. Applied rewrites99.3%

                                            \[\leadsto r \cdot \frac{\color{blue}{\mathsf{fma}\left(\left(b \cdot b\right) \cdot 0.008333333333333333 - 0.16666666666666666, b \cdot b, 1\right) \cdot b}}{\cos \left(\left(\frac{b}{a} + 1\right) \cdot a\right)} \]
                                        3. Recombined 2 regimes into one program.
                                        4. Add Preprocessing

                                        Alternative 14: 76.2% accurate, 1.1× speedup?

                                        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \tan b \cdot r\\ \mathbf{if}\;b \leq -0.44:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;b \leq 7.2 \cdot 10^{-12}:\\ \;\;\;\;r \cdot \frac{\mathsf{fma}\left(0.008333333333333333 \cdot \left(b \cdot b\right) - 0.16666666666666666, b \cdot b, 1\right) \cdot b}{\cos \left(a + b\right)}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
                                        (FPCore (r a b)
                                         :precision binary64
                                         (let* ((t_0 (* (tan b) r)))
                                           (if (<= b -0.44)
                                             t_0
                                             (if (<= b 7.2e-12)
                                               (*
                                                r
                                                (/
                                                 (*
                                                  (fma
                                                   (- (* 0.008333333333333333 (* b b)) 0.16666666666666666)
                                                   (* b b)
                                                   1.0)
                                                  b)
                                                 (cos (+ a b))))
                                               t_0))))
                                        double code(double r, double a, double b) {
                                        	double t_0 = tan(b) * r;
                                        	double tmp;
                                        	if (b <= -0.44) {
                                        		tmp = t_0;
                                        	} else if (b <= 7.2e-12) {
                                        		tmp = r * ((fma(((0.008333333333333333 * (b * b)) - 0.16666666666666666), (b * b), 1.0) * b) / cos((a + b)));
                                        	} else {
                                        		tmp = t_0;
                                        	}
                                        	return tmp;
                                        }
                                        
                                        function code(r, a, b)
                                        	t_0 = Float64(tan(b) * r)
                                        	tmp = 0.0
                                        	if (b <= -0.44)
                                        		tmp = t_0;
                                        	elseif (b <= 7.2e-12)
                                        		tmp = Float64(r * Float64(Float64(fma(Float64(Float64(0.008333333333333333 * Float64(b * b)) - 0.16666666666666666), Float64(b * b), 1.0) * b) / cos(Float64(a + b))));
                                        	else
                                        		tmp = t_0;
                                        	end
                                        	return tmp
                                        end
                                        
                                        code[r_, a_, b_] := Block[{t$95$0 = N[(N[Tan[b], $MachinePrecision] * r), $MachinePrecision]}, If[LessEqual[b, -0.44], t$95$0, If[LessEqual[b, 7.2e-12], N[(r * N[(N[(N[(N[(N[(0.008333333333333333 * N[(b * b), $MachinePrecision]), $MachinePrecision] - 0.16666666666666666), $MachinePrecision] * N[(b * b), $MachinePrecision] + 1.0), $MachinePrecision] * b), $MachinePrecision] / N[Cos[N[(a + b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
                                        
                                        \begin{array}{l}
                                        
                                        \\
                                        \begin{array}{l}
                                        t_0 := \tan b \cdot r\\
                                        \mathbf{if}\;b \leq -0.44:\\
                                        \;\;\;\;t\_0\\
                                        
                                        \mathbf{elif}\;b \leq 7.2 \cdot 10^{-12}:\\
                                        \;\;\;\;r \cdot \frac{\mathsf{fma}\left(0.008333333333333333 \cdot \left(b \cdot b\right) - 0.16666666666666666, b \cdot b, 1\right) \cdot b}{\cos \left(a + b\right)}\\
                                        
                                        \mathbf{else}:\\
                                        \;\;\;\;t\_0\\
                                        
                                        
                                        \end{array}
                                        \end{array}
                                        
                                        Derivation
                                        1. Split input into 2 regimes
                                        2. if b < -0.440000000000000002 or 7.2e-12 < b

                                          1. Initial program 55.0%

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

                                            \[\leadsto r \cdot \color{blue}{\frac{\sin b}{\cos b}} \]
                                          3. Step-by-step derivation
                                            1. quot-tanN/A

                                              \[\leadsto r \cdot \tan b \]
                                            2. lower-tan.f6454.6

                                              \[\leadsto r \cdot \tan b \]
                                          4. Applied rewrites54.6%

                                            \[\leadsto r \cdot \color{blue}{\tan b} \]
                                          5. Step-by-step derivation
                                            1. lift-*.f64N/A

                                              \[\leadsto \color{blue}{r \cdot \tan b} \]
                                            2. *-commutativeN/A

                                              \[\leadsto \color{blue}{\tan b \cdot r} \]
                                            3. lower-*.f6454.6

                                              \[\leadsto \color{blue}{\tan b \cdot r} \]
                                            4. cos-sum-rev54.6

                                              \[\leadsto \tan b \cdot r \]
                                            5. *-commutative54.6

                                              \[\leadsto \tan b \cdot r \]
                                            6. *-commutative54.6

                                              \[\leadsto \tan b \cdot r \]
                                          6. Applied rewrites54.6%

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

                                          if -0.440000000000000002 < b < 7.2e-12

                                          1. Initial program 99.3%

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

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

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

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

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

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

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

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

                                              \[\leadsto r \cdot \frac{\mathsf{fma}\left(\frac{1}{120} \cdot {b}^{2} - \frac{1}{6}, {b}^{2}, 1\right) \cdot b}{\cos \left(a + b\right)} \]
                                            8. unpow2N/A

                                              \[\leadsto r \cdot \frac{\mathsf{fma}\left(\frac{1}{120} \cdot \left(b \cdot b\right) - \frac{1}{6}, {b}^{2}, 1\right) \cdot b}{\cos \left(a + b\right)} \]
                                            9. lower-*.f64N/A

                                              \[\leadsto r \cdot \frac{\mathsf{fma}\left(\frac{1}{120} \cdot \left(b \cdot b\right) - \frac{1}{6}, {b}^{2}, 1\right) \cdot b}{\cos \left(a + b\right)} \]
                                            10. unpow2N/A

                                              \[\leadsto r \cdot \frac{\mathsf{fma}\left(\frac{1}{120} \cdot \left(b \cdot b\right) - \frac{1}{6}, b \cdot b, 1\right) \cdot b}{\cos \left(a + b\right)} \]
                                            11. lower-*.f6499.3

                                              \[\leadsto r \cdot \frac{\mathsf{fma}\left(0.008333333333333333 \cdot \left(b \cdot b\right) - 0.16666666666666666, b \cdot b, 1\right) \cdot b}{\cos \left(a + b\right)} \]
                                          4. Applied rewrites99.3%

                                            \[\leadsto r \cdot \frac{\color{blue}{\mathsf{fma}\left(0.008333333333333333 \cdot \left(b \cdot b\right) - 0.16666666666666666, b \cdot b, 1\right) \cdot b}}{\cos \left(a + b\right)} \]
                                        3. Recombined 2 regimes into one program.
                                        4. Add Preprocessing

                                        Alternative 15: 76.2% accurate, 1.1× speedup?

                                        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \tan b \cdot r\\ \mathbf{if}\;b \leq -0.44:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;b \leq 7.2 \cdot 10^{-12}:\\ \;\;\;\;\frac{r \cdot \left(\mathsf{fma}\left(b \cdot b, \left(0.008333333333333333 \cdot b\right) \cdot b - 0.16666666666666666, 1\right) \cdot b\right)}{\cos \left(a + b\right)}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
                                        (FPCore (r a b)
                                         :precision binary64
                                         (let* ((t_0 (* (tan b) r)))
                                           (if (<= b -0.44)
                                             t_0
                                             (if (<= b 7.2e-12)
                                               (/
                                                (*
                                                 r
                                                 (*
                                                  (fma
                                                   (* b b)
                                                   (- (* (* 0.008333333333333333 b) b) 0.16666666666666666)
                                                   1.0)
                                                  b))
                                                (cos (+ a b)))
                                               t_0))))
                                        double code(double r, double a, double b) {
                                        	double t_0 = tan(b) * r;
                                        	double tmp;
                                        	if (b <= -0.44) {
                                        		tmp = t_0;
                                        	} else if (b <= 7.2e-12) {
                                        		tmp = (r * (fma((b * b), (((0.008333333333333333 * b) * b) - 0.16666666666666666), 1.0) * b)) / cos((a + b));
                                        	} else {
                                        		tmp = t_0;
                                        	}
                                        	return tmp;
                                        }
                                        
                                        function code(r, a, b)
                                        	t_0 = Float64(tan(b) * r)
                                        	tmp = 0.0
                                        	if (b <= -0.44)
                                        		tmp = t_0;
                                        	elseif (b <= 7.2e-12)
                                        		tmp = Float64(Float64(r * Float64(fma(Float64(b * b), Float64(Float64(Float64(0.008333333333333333 * b) * b) - 0.16666666666666666), 1.0) * b)) / cos(Float64(a + b)));
                                        	else
                                        		tmp = t_0;
                                        	end
                                        	return tmp
                                        end
                                        
                                        code[r_, a_, b_] := Block[{t$95$0 = N[(N[Tan[b], $MachinePrecision] * r), $MachinePrecision]}, If[LessEqual[b, -0.44], t$95$0, If[LessEqual[b, 7.2e-12], N[(N[(r * N[(N[(N[(b * b), $MachinePrecision] * N[(N[(N[(0.008333333333333333 * b), $MachinePrecision] * b), $MachinePrecision] - 0.16666666666666666), $MachinePrecision] + 1.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision] / N[Cos[N[(a + b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$0]]]
                                        
                                        \begin{array}{l}
                                        
                                        \\
                                        \begin{array}{l}
                                        t_0 := \tan b \cdot r\\
                                        \mathbf{if}\;b \leq -0.44:\\
                                        \;\;\;\;t\_0\\
                                        
                                        \mathbf{elif}\;b \leq 7.2 \cdot 10^{-12}:\\
                                        \;\;\;\;\frac{r \cdot \left(\mathsf{fma}\left(b \cdot b, \left(0.008333333333333333 \cdot b\right) \cdot b - 0.16666666666666666, 1\right) \cdot b\right)}{\cos \left(a + b\right)}\\
                                        
                                        \mathbf{else}:\\
                                        \;\;\;\;t\_0\\
                                        
                                        
                                        \end{array}
                                        \end{array}
                                        
                                        Derivation
                                        1. Split input into 2 regimes
                                        2. if b < -0.440000000000000002 or 7.2e-12 < b

                                          1. Initial program 55.0%

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

                                            \[\leadsto r \cdot \color{blue}{\frac{\sin b}{\cos b}} \]
                                          3. Step-by-step derivation
                                            1. quot-tanN/A

                                              \[\leadsto r \cdot \tan b \]
                                            2. lower-tan.f6454.6

                                              \[\leadsto r \cdot \tan b \]
                                          4. Applied rewrites54.6%

                                            \[\leadsto r \cdot \color{blue}{\tan b} \]
                                          5. Step-by-step derivation
                                            1. lift-*.f64N/A

                                              \[\leadsto \color{blue}{r \cdot \tan b} \]
                                            2. *-commutativeN/A

                                              \[\leadsto \color{blue}{\tan b \cdot r} \]
                                            3. lower-*.f6454.6

                                              \[\leadsto \color{blue}{\tan b \cdot r} \]
                                            4. cos-sum-rev54.6

                                              \[\leadsto \tan b \cdot r \]
                                            5. *-commutative54.6

                                              \[\leadsto \tan b \cdot r \]
                                            6. *-commutative54.6

                                              \[\leadsto \tan b \cdot r \]
                                          6. Applied rewrites54.6%

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

                                          if -0.440000000000000002 < b < 7.2e-12

                                          1. Initial program 99.3%

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

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

                                              \[\leadsto r \cdot \frac{\left(1 + {b}^{2} \cdot \left({b}^{2} \cdot \left(\frac{1}{120} + \frac{-1}{5040} \cdot {b}^{2}\right) - \frac{1}{6}\right)\right) \cdot \color{blue}{b}}{\cos \left(a + b\right)} \]
                                            2. lower-*.f64N/A

                                              \[\leadsto r \cdot \frac{\left(1 + {b}^{2} \cdot \left({b}^{2} \cdot \left(\frac{1}{120} + \frac{-1}{5040} \cdot {b}^{2}\right) - \frac{1}{6}\right)\right) \cdot \color{blue}{b}}{\cos \left(a + b\right)} \]
                                          4. Applied rewrites99.3%

                                            \[\leadsto r \cdot \frac{\color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(-0.0001984126984126984, b \cdot b, 0.008333333333333333\right) \cdot \left(b \cdot b\right) - 0.16666666666666666, b \cdot b, 1\right) \cdot b}}{\cos \left(a + b\right)} \]
                                          5. Taylor expanded in b around 0

                                            \[\leadsto r \cdot \frac{\mathsf{fma}\left(\frac{1}{120} \cdot \left(b \cdot b\right) - \frac{1}{6}, b \cdot b, 1\right) \cdot b}{\cos \left(a + b\right)} \]
                                          6. Step-by-step derivation
                                            1. Applied rewrites99.3%

                                              \[\leadsto r \cdot \frac{\mathsf{fma}\left(0.008333333333333333 \cdot \left(b \cdot b\right) - 0.16666666666666666, b \cdot b, 1\right) \cdot b}{\cos \left(a + b\right)} \]
                                            2. Applied rewrites99.3%

                                              \[\leadsto \color{blue}{\frac{r \cdot \left(\mathsf{fma}\left(b \cdot b, \left(0.008333333333333333 \cdot b\right) \cdot b - 0.16666666666666666, 1\right) \cdot b\right)}{\cos \left(a + b\right)}} \]
                                          7. Recombined 2 regimes into one program.
                                          8. Add Preprocessing

                                          Alternative 16: 76.2% accurate, 1.2× speedup?

                                          \[\begin{array}{l} \\ \begin{array}{l} t_0 := \tan b \cdot r\\ \mathbf{if}\;b \leq -0.44:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;b \leq 7.2 \cdot 10^{-12}:\\ \;\;\;\;r \cdot \frac{\mathsf{fma}\left(b \cdot b, -0.16666666666666666, 1\right) \cdot b}{\cos \left(a + b\right)}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
                                          (FPCore (r a b)
                                           :precision binary64
                                           (let* ((t_0 (* (tan b) r)))
                                             (if (<= b -0.44)
                                               t_0
                                               (if (<= b 7.2e-12)
                                                 (* r (/ (* (fma (* b b) -0.16666666666666666 1.0) b) (cos (+ a b))))
                                                 t_0))))
                                          double code(double r, double a, double b) {
                                          	double t_0 = tan(b) * r;
                                          	double tmp;
                                          	if (b <= -0.44) {
                                          		tmp = t_0;
                                          	} else if (b <= 7.2e-12) {
                                          		tmp = r * ((fma((b * b), -0.16666666666666666, 1.0) * b) / cos((a + b)));
                                          	} else {
                                          		tmp = t_0;
                                          	}
                                          	return tmp;
                                          }
                                          
                                          function code(r, a, b)
                                          	t_0 = Float64(tan(b) * r)
                                          	tmp = 0.0
                                          	if (b <= -0.44)
                                          		tmp = t_0;
                                          	elseif (b <= 7.2e-12)
                                          		tmp = Float64(r * Float64(Float64(fma(Float64(b * b), -0.16666666666666666, 1.0) * b) / cos(Float64(a + b))));
                                          	else
                                          		tmp = t_0;
                                          	end
                                          	return tmp
                                          end
                                          
                                          code[r_, a_, b_] := Block[{t$95$0 = N[(N[Tan[b], $MachinePrecision] * r), $MachinePrecision]}, If[LessEqual[b, -0.44], t$95$0, If[LessEqual[b, 7.2e-12], N[(r * N[(N[(N[(N[(b * b), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * b), $MachinePrecision] / N[Cos[N[(a + b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
                                          
                                          \begin{array}{l}
                                          
                                          \\
                                          \begin{array}{l}
                                          t_0 := \tan b \cdot r\\
                                          \mathbf{if}\;b \leq -0.44:\\
                                          \;\;\;\;t\_0\\
                                          
                                          \mathbf{elif}\;b \leq 7.2 \cdot 10^{-12}:\\
                                          \;\;\;\;r \cdot \frac{\mathsf{fma}\left(b \cdot b, -0.16666666666666666, 1\right) \cdot b}{\cos \left(a + b\right)}\\
                                          
                                          \mathbf{else}:\\
                                          \;\;\;\;t\_0\\
                                          
                                          
                                          \end{array}
                                          \end{array}
                                          
                                          Derivation
                                          1. Split input into 2 regimes
                                          2. if b < -0.440000000000000002 or 7.2e-12 < b

                                            1. Initial program 55.0%

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

                                              \[\leadsto r \cdot \color{blue}{\frac{\sin b}{\cos b}} \]
                                            3. Step-by-step derivation
                                              1. quot-tanN/A

                                                \[\leadsto r \cdot \tan b \]
                                              2. lower-tan.f6454.6

                                                \[\leadsto r \cdot \tan b \]
                                            4. Applied rewrites54.6%

                                              \[\leadsto r \cdot \color{blue}{\tan b} \]
                                            5. Step-by-step derivation
                                              1. lift-*.f64N/A

                                                \[\leadsto \color{blue}{r \cdot \tan b} \]
                                              2. *-commutativeN/A

                                                \[\leadsto \color{blue}{\tan b \cdot r} \]
                                              3. lower-*.f6454.6

                                                \[\leadsto \color{blue}{\tan b \cdot r} \]
                                              4. cos-sum-rev54.6

                                                \[\leadsto \tan b \cdot r \]
                                              5. *-commutative54.6

                                                \[\leadsto \tan b \cdot r \]
                                              6. *-commutative54.6

                                                \[\leadsto \tan b \cdot r \]
                                            6. Applied rewrites54.6%

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

                                            if -0.440000000000000002 < b < 7.2e-12

                                            1. Initial program 99.3%

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

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

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

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

                                                \[\leadsto r \cdot \frac{\left(\frac{-1}{6} \cdot {b}^{2} + 1\right) \cdot b}{\cos \left(a + b\right)} \]
                                              4. *-commutativeN/A

                                                \[\leadsto r \cdot \frac{\left({b}^{2} \cdot \frac{-1}{6} + 1\right) \cdot b}{\cos \left(a + b\right)} \]
                                              5. lower-fma.f64N/A

                                                \[\leadsto r \cdot \frac{\mathsf{fma}\left({b}^{2}, \frac{-1}{6}, 1\right) \cdot b}{\cos \left(a + b\right)} \]
                                              6. unpow2N/A

                                                \[\leadsto r \cdot \frac{\mathsf{fma}\left(b \cdot b, \frac{-1}{6}, 1\right) \cdot b}{\cos \left(a + b\right)} \]
                                              7. lower-*.f6499.2

                                                \[\leadsto r \cdot \frac{\mathsf{fma}\left(b \cdot b, -0.16666666666666666, 1\right) \cdot b}{\cos \left(a + b\right)} \]
                                            4. Applied rewrites99.2%

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

                                          Alternative 17: 76.1% accurate, 1.5× speedup?

                                          \[\begin{array}{l} \\ \begin{array}{l} t_0 := \tan b \cdot r\\ \mathbf{if}\;b \leq -0.44:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;b \leq 7.2 \cdot 10^{-12}:\\ \;\;\;\;r \cdot \frac{b}{\cos \left(a + b\right)}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
                                          (FPCore (r a b)
                                           :precision binary64
                                           (let* ((t_0 (* (tan b) r)))
                                             (if (<= b -0.44) t_0 (if (<= b 7.2e-12) (* r (/ b (cos (+ a b)))) t_0))))
                                          double code(double r, double a, double b) {
                                          	double t_0 = tan(b) * r;
                                          	double tmp;
                                          	if (b <= -0.44) {
                                          		tmp = t_0;
                                          	} else if (b <= 7.2e-12) {
                                          		tmp = r * (b / cos((a + b)));
                                          	} else {
                                          		tmp = t_0;
                                          	}
                                          	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) :: t_0
                                              real(8) :: tmp
                                              t_0 = tan(b) * r
                                              if (b <= (-0.44d0)) then
                                                  tmp = t_0
                                              else if (b <= 7.2d-12) then
                                                  tmp = r * (b / cos((a + b)))
                                              else
                                                  tmp = t_0
                                              end if
                                              code = tmp
                                          end function
                                          
                                          public static double code(double r, double a, double b) {
                                          	double t_0 = Math.tan(b) * r;
                                          	double tmp;
                                          	if (b <= -0.44) {
                                          		tmp = t_0;
                                          	} else if (b <= 7.2e-12) {
                                          		tmp = r * (b / Math.cos((a + b)));
                                          	} else {
                                          		tmp = t_0;
                                          	}
                                          	return tmp;
                                          }
                                          
                                          def code(r, a, b):
                                          	t_0 = math.tan(b) * r
                                          	tmp = 0
                                          	if b <= -0.44:
                                          		tmp = t_0
                                          	elif b <= 7.2e-12:
                                          		tmp = r * (b / math.cos((a + b)))
                                          	else:
                                          		tmp = t_0
                                          	return tmp
                                          
                                          function code(r, a, b)
                                          	t_0 = Float64(tan(b) * r)
                                          	tmp = 0.0
                                          	if (b <= -0.44)
                                          		tmp = t_0;
                                          	elseif (b <= 7.2e-12)
                                          		tmp = Float64(r * Float64(b / cos(Float64(a + b))));
                                          	else
                                          		tmp = t_0;
                                          	end
                                          	return tmp
                                          end
                                          
                                          function tmp_2 = code(r, a, b)
                                          	t_0 = tan(b) * r;
                                          	tmp = 0.0;
                                          	if (b <= -0.44)
                                          		tmp = t_0;
                                          	elseif (b <= 7.2e-12)
                                          		tmp = r * (b / cos((a + b)));
                                          	else
                                          		tmp = t_0;
                                          	end
                                          	tmp_2 = tmp;
                                          end
                                          
                                          code[r_, a_, b_] := Block[{t$95$0 = N[(N[Tan[b], $MachinePrecision] * r), $MachinePrecision]}, If[LessEqual[b, -0.44], t$95$0, If[LessEqual[b, 7.2e-12], N[(r * N[(b / N[Cos[N[(a + b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
                                          
                                          \begin{array}{l}
                                          
                                          \\
                                          \begin{array}{l}
                                          t_0 := \tan b \cdot r\\
                                          \mathbf{if}\;b \leq -0.44:\\
                                          \;\;\;\;t\_0\\
                                          
                                          \mathbf{elif}\;b \leq 7.2 \cdot 10^{-12}:\\
                                          \;\;\;\;r \cdot \frac{b}{\cos \left(a + b\right)}\\
                                          
                                          \mathbf{else}:\\
                                          \;\;\;\;t\_0\\
                                          
                                          
                                          \end{array}
                                          \end{array}
                                          
                                          Derivation
                                          1. Split input into 2 regimes
                                          2. if b < -0.440000000000000002 or 7.2e-12 < b

                                            1. Initial program 55.0%

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

                                              \[\leadsto r \cdot \color{blue}{\frac{\sin b}{\cos b}} \]
                                            3. Step-by-step derivation
                                              1. quot-tanN/A

                                                \[\leadsto r \cdot \tan b \]
                                              2. lower-tan.f6454.6

                                                \[\leadsto r \cdot \tan b \]
                                            4. Applied rewrites54.6%

                                              \[\leadsto r \cdot \color{blue}{\tan b} \]
                                            5. Step-by-step derivation
                                              1. lift-*.f64N/A

                                                \[\leadsto \color{blue}{r \cdot \tan b} \]
                                              2. *-commutativeN/A

                                                \[\leadsto \color{blue}{\tan b \cdot r} \]
                                              3. lower-*.f6454.6

                                                \[\leadsto \color{blue}{\tan b \cdot r} \]
                                              4. cos-sum-rev54.6

                                                \[\leadsto \tan b \cdot r \]
                                              5. *-commutative54.6

                                                \[\leadsto \tan b \cdot r \]
                                              6. *-commutative54.6

                                                \[\leadsto \tan b \cdot r \]
                                            6. Applied rewrites54.6%

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

                                            if -0.440000000000000002 < b < 7.2e-12

                                            1. Initial program 99.3%

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

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

                                                \[\leadsto r \cdot \frac{\color{blue}{b}}{\cos \left(a + b\right)} \]
                                            4. Recombined 2 regimes into one program.
                                            5. Add Preprocessing

                                            Alternative 18: 76.1% accurate, 1.6× speedup?

                                            \[\begin{array}{l} \\ \begin{array}{l} t_0 := \tan b \cdot r\\ \mathbf{if}\;b \leq -0.44:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;b \leq 7.2 \cdot 10^{-12}:\\ \;\;\;\;r \cdot \frac{b}{\cos a}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
                                            (FPCore (r a b)
                                             :precision binary64
                                             (let* ((t_0 (* (tan b) r)))
                                               (if (<= b -0.44) t_0 (if (<= b 7.2e-12) (* r (/ b (cos a))) t_0))))
                                            double code(double r, double a, double b) {
                                            	double t_0 = tan(b) * r;
                                            	double tmp;
                                            	if (b <= -0.44) {
                                            		tmp = t_0;
                                            	} else if (b <= 7.2e-12) {
                                            		tmp = r * (b / cos(a));
                                            	} else {
                                            		tmp = t_0;
                                            	}
                                            	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) :: t_0
                                                real(8) :: tmp
                                                t_0 = tan(b) * r
                                                if (b <= (-0.44d0)) then
                                                    tmp = t_0
                                                else if (b <= 7.2d-12) then
                                                    tmp = r * (b / cos(a))
                                                else
                                                    tmp = t_0
                                                end if
                                                code = tmp
                                            end function
                                            
                                            public static double code(double r, double a, double b) {
                                            	double t_0 = Math.tan(b) * r;
                                            	double tmp;
                                            	if (b <= -0.44) {
                                            		tmp = t_0;
                                            	} else if (b <= 7.2e-12) {
                                            		tmp = r * (b / Math.cos(a));
                                            	} else {
                                            		tmp = t_0;
                                            	}
                                            	return tmp;
                                            }
                                            
                                            def code(r, a, b):
                                            	t_0 = math.tan(b) * r
                                            	tmp = 0
                                            	if b <= -0.44:
                                            		tmp = t_0
                                            	elif b <= 7.2e-12:
                                            		tmp = r * (b / math.cos(a))
                                            	else:
                                            		tmp = t_0
                                            	return tmp
                                            
                                            function code(r, a, b)
                                            	t_0 = Float64(tan(b) * r)
                                            	tmp = 0.0
                                            	if (b <= -0.44)
                                            		tmp = t_0;
                                            	elseif (b <= 7.2e-12)
                                            		tmp = Float64(r * Float64(b / cos(a)));
                                            	else
                                            		tmp = t_0;
                                            	end
                                            	return tmp
                                            end
                                            
                                            function tmp_2 = code(r, a, b)
                                            	t_0 = tan(b) * r;
                                            	tmp = 0.0;
                                            	if (b <= -0.44)
                                            		tmp = t_0;
                                            	elseif (b <= 7.2e-12)
                                            		tmp = r * (b / cos(a));
                                            	else
                                            		tmp = t_0;
                                            	end
                                            	tmp_2 = tmp;
                                            end
                                            
                                            code[r_, a_, b_] := Block[{t$95$0 = N[(N[Tan[b], $MachinePrecision] * r), $MachinePrecision]}, If[LessEqual[b, -0.44], t$95$0, If[LessEqual[b, 7.2e-12], N[(r * N[(b / N[Cos[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
                                            
                                            \begin{array}{l}
                                            
                                            \\
                                            \begin{array}{l}
                                            t_0 := \tan b \cdot r\\
                                            \mathbf{if}\;b \leq -0.44:\\
                                            \;\;\;\;t\_0\\
                                            
                                            \mathbf{elif}\;b \leq 7.2 \cdot 10^{-12}:\\
                                            \;\;\;\;r \cdot \frac{b}{\cos a}\\
                                            
                                            \mathbf{else}:\\
                                            \;\;\;\;t\_0\\
                                            
                                            
                                            \end{array}
                                            \end{array}
                                            
                                            Derivation
                                            1. Split input into 2 regimes
                                            2. if b < -0.440000000000000002 or 7.2e-12 < b

                                              1. Initial program 55.0%

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

                                                \[\leadsto r \cdot \color{blue}{\frac{\sin b}{\cos b}} \]
                                              3. Step-by-step derivation
                                                1. quot-tanN/A

                                                  \[\leadsto r \cdot \tan b \]
                                                2. lower-tan.f6454.6

                                                  \[\leadsto r \cdot \tan b \]
                                              4. Applied rewrites54.6%

                                                \[\leadsto r \cdot \color{blue}{\tan b} \]
                                              5. Step-by-step derivation
                                                1. lift-*.f64N/A

                                                  \[\leadsto \color{blue}{r \cdot \tan b} \]
                                                2. *-commutativeN/A

                                                  \[\leadsto \color{blue}{\tan b \cdot r} \]
                                                3. lower-*.f6454.6

                                                  \[\leadsto \color{blue}{\tan b \cdot r} \]
                                                4. cos-sum-rev54.6

                                                  \[\leadsto \tan b \cdot r \]
                                                5. *-commutative54.6

                                                  \[\leadsto \tan b \cdot r \]
                                                6. *-commutative54.6

                                                  \[\leadsto \tan b \cdot r \]
                                              6. Applied rewrites54.6%

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

                                              if -0.440000000000000002 < b < 7.2e-12

                                              1. Initial program 99.3%

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

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

                                                  \[\leadsto r \cdot \frac{b}{\color{blue}{\cos a}} \]
                                                2. lower-cos.f6499.1

                                                  \[\leadsto r \cdot \frac{b}{\cos a} \]
                                              4. Applied rewrites99.1%

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

                                            Alternative 19: 76.1% accurate, 1.6× speedup?

                                            \[\begin{array}{l} \\ \begin{array}{l} t_0 := \tan b \cdot r\\ \mathbf{if}\;b \leq -0.44:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;b \leq 7.2 \cdot 10^{-12}:\\ \;\;\;\;b \cdot \frac{r}{\cos a}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
                                            (FPCore (r a b)
                                             :precision binary64
                                             (let* ((t_0 (* (tan b) r)))
                                               (if (<= b -0.44) t_0 (if (<= b 7.2e-12) (* b (/ r (cos a))) t_0))))
                                            double code(double r, double a, double b) {
                                            	double t_0 = tan(b) * r;
                                            	double tmp;
                                            	if (b <= -0.44) {
                                            		tmp = t_0;
                                            	} else if (b <= 7.2e-12) {
                                            		tmp = b * (r / cos(a));
                                            	} else {
                                            		tmp = t_0;
                                            	}
                                            	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) :: t_0
                                                real(8) :: tmp
                                                t_0 = tan(b) * r
                                                if (b <= (-0.44d0)) then
                                                    tmp = t_0
                                                else if (b <= 7.2d-12) then
                                                    tmp = b * (r / cos(a))
                                                else
                                                    tmp = t_0
                                                end if
                                                code = tmp
                                            end function
                                            
                                            public static double code(double r, double a, double b) {
                                            	double t_0 = Math.tan(b) * r;
                                            	double tmp;
                                            	if (b <= -0.44) {
                                            		tmp = t_0;
                                            	} else if (b <= 7.2e-12) {
                                            		tmp = b * (r / Math.cos(a));
                                            	} else {
                                            		tmp = t_0;
                                            	}
                                            	return tmp;
                                            }
                                            
                                            def code(r, a, b):
                                            	t_0 = math.tan(b) * r
                                            	tmp = 0
                                            	if b <= -0.44:
                                            		tmp = t_0
                                            	elif b <= 7.2e-12:
                                            		tmp = b * (r / math.cos(a))
                                            	else:
                                            		tmp = t_0
                                            	return tmp
                                            
                                            function code(r, a, b)
                                            	t_0 = Float64(tan(b) * r)
                                            	tmp = 0.0
                                            	if (b <= -0.44)
                                            		tmp = t_0;
                                            	elseif (b <= 7.2e-12)
                                            		tmp = Float64(b * Float64(r / cos(a)));
                                            	else
                                            		tmp = t_0;
                                            	end
                                            	return tmp
                                            end
                                            
                                            function tmp_2 = code(r, a, b)
                                            	t_0 = tan(b) * r;
                                            	tmp = 0.0;
                                            	if (b <= -0.44)
                                            		tmp = t_0;
                                            	elseif (b <= 7.2e-12)
                                            		tmp = b * (r / cos(a));
                                            	else
                                            		tmp = t_0;
                                            	end
                                            	tmp_2 = tmp;
                                            end
                                            
                                            code[r_, a_, b_] := Block[{t$95$0 = N[(N[Tan[b], $MachinePrecision] * r), $MachinePrecision]}, If[LessEqual[b, -0.44], t$95$0, If[LessEqual[b, 7.2e-12], N[(b * N[(r / N[Cos[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
                                            
                                            \begin{array}{l}
                                            
                                            \\
                                            \begin{array}{l}
                                            t_0 := \tan b \cdot r\\
                                            \mathbf{if}\;b \leq -0.44:\\
                                            \;\;\;\;t\_0\\
                                            
                                            \mathbf{elif}\;b \leq 7.2 \cdot 10^{-12}:\\
                                            \;\;\;\;b \cdot \frac{r}{\cos a}\\
                                            
                                            \mathbf{else}:\\
                                            \;\;\;\;t\_0\\
                                            
                                            
                                            \end{array}
                                            \end{array}
                                            
                                            Derivation
                                            1. Split input into 2 regimes
                                            2. if b < -0.440000000000000002 or 7.2e-12 < b

                                              1. Initial program 55.0%

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

                                                \[\leadsto r \cdot \color{blue}{\frac{\sin b}{\cos b}} \]
                                              3. Step-by-step derivation
                                                1. quot-tanN/A

                                                  \[\leadsto r \cdot \tan b \]
                                                2. lower-tan.f6454.6

                                                  \[\leadsto r \cdot \tan b \]
                                              4. Applied rewrites54.6%

                                                \[\leadsto r \cdot \color{blue}{\tan b} \]
                                              5. Step-by-step derivation
                                                1. lift-*.f64N/A

                                                  \[\leadsto \color{blue}{r \cdot \tan b} \]
                                                2. *-commutativeN/A

                                                  \[\leadsto \color{blue}{\tan b \cdot r} \]
                                                3. lower-*.f6454.6

                                                  \[\leadsto \color{blue}{\tan b \cdot r} \]
                                                4. cos-sum-rev54.6

                                                  \[\leadsto \tan b \cdot r \]
                                                5. *-commutative54.6

                                                  \[\leadsto \tan b \cdot r \]
                                                6. *-commutative54.6

                                                  \[\leadsto \tan b \cdot r \]
                                              6. Applied rewrites54.6%

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

                                              if -0.440000000000000002 < b < 7.2e-12

                                              1. Initial program 99.3%

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

                                                \[\leadsto \color{blue}{\frac{b \cdot r}{\cos a}} \]
                                              3. Step-by-step derivation
                                                1. associate-/l*N/A

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

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

                                                  \[\leadsto b \cdot \frac{r}{\color{blue}{\cos a}} \]
                                                4. lower-cos.f6499.1

                                                  \[\leadsto b \cdot \frac{r}{\cos a} \]
                                              4. Applied rewrites99.1%

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

                                            Alternative 20: 76.1% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                            Alternative 21: 60.3% accurate, 1.9× speedup?

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

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

                                              \[\leadsto r \cdot \color{blue}{\frac{\sin b}{\cos b}} \]
                                            3. Step-by-step derivation
                                              1. quot-tanN/A

                                                \[\leadsto r \cdot \tan b \]
                                              2. lower-tan.f6460.3

                                                \[\leadsto r \cdot \tan b \]
                                            4. Applied rewrites60.3%

                                              \[\leadsto r \cdot \color{blue}{\tan b} \]
                                            5. Step-by-step derivation
                                              1. lift-*.f64N/A

                                                \[\leadsto \color{blue}{r \cdot \tan b} \]
                                              2. *-commutativeN/A

                                                \[\leadsto \color{blue}{\tan b \cdot r} \]
                                              3. lower-*.f6460.3

                                                \[\leadsto \color{blue}{\tan b \cdot r} \]
                                              4. cos-sum-rev60.3

                                                \[\leadsto \tan b \cdot r \]
                                              5. *-commutative60.3

                                                \[\leadsto \tan b \cdot r \]
                                              6. *-commutative60.3

                                                \[\leadsto \tan b \cdot r \]
                                            6. Applied rewrites60.3%

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

                                            Alternative 22: 34.2% accurate, 18.6× 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.4%

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

                                              \[\leadsto r \cdot \color{blue}{\frac{\sin b}{\cos b}} \]
                                            3. Step-by-step derivation
                                              1. quot-tanN/A

                                                \[\leadsto r \cdot \tan b \]
                                              2. lower-tan.f6460.3

                                                \[\leadsto r \cdot \tan b \]
                                            4. Applied rewrites60.3%

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

                                              \[\leadsto r \cdot b \]
                                            6. Step-by-step derivation
                                              1. Applied rewrites34.2%

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

                                              Reproduce

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