rsin B (should all be same)

Percentage Accurate: 77.5% → 99.5%
Time: 9.1s
Alternatives: 6
Speedup: N/A×

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}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 6 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: 77.5% 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, N/A× 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 78.6%

    \[r \cdot \frac{\sin b}{\cos \left(a + b\right)} \]
  2. Add Preprocessing
  3. 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}} \]
  4. Applied rewrites99.5%

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

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

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\sin b}^{2}\\ t_1 := \frac{\sin b}{\cos \left(a + b\right)}\\ t_2 := {\sin a}^{3}\\ t_3 := {\cos a}^{2}\\ t_4 := {\cos b}^{2}\\ t_5 := r \cdot \left(\sin b \cdot \mathsf{fma}\left(\cos a, \cos b \cdot \left(\sin a \cdot \sin b\right), \mathsf{fma}\left(t\_3, t\_4, {\sin a}^{2} \cdot t\_0\right)\right)\right)\\ \mathbf{if}\;t\_1 \leq -0.01 \lor \neg \left(t\_1 \leq 0.04\right):\\ \;\;\;\;\frac{t\_5}{{t\_3}^{1.5} \cdot {\cos b}^{3} - t\_2 \cdot {\sin b}^{3}}\\ \mathbf{else}:\\ \;\;\;\;\frac{t\_5}{\left(t\_3 \cdot \cos a\right) \cdot {t\_4}^{1.5} - t\_2 \cdot {t\_0}^{1.5}}\\ \end{array} \end{array} \]
(FPCore (r a b)
 :precision binary64
 (let* ((t_0 (pow (sin b) 2.0))
        (t_1 (/ (sin b) (cos (+ a b))))
        (t_2 (pow (sin a) 3.0))
        (t_3 (pow (cos a) 2.0))
        (t_4 (pow (cos b) 2.0))
        (t_5
         (*
          r
          (*
           (sin b)
           (fma
            (cos a)
            (* (cos b) (* (sin a) (sin b)))
            (fma t_3 t_4 (* (pow (sin a) 2.0) t_0)))))))
   (if (or (<= t_1 -0.01) (not (<= t_1 0.04)))
     (/ t_5 (- (* (pow t_3 1.5) (pow (cos b) 3.0)) (* t_2 (pow (sin b) 3.0))))
     (/ t_5 (- (* (* t_3 (cos a)) (pow t_4 1.5)) (* t_2 (pow t_0 1.5)))))))
double code(double r, double a, double b) {
	double t_0 = pow(sin(b), 2.0);
	double t_1 = sin(b) / cos((a + b));
	double t_2 = pow(sin(a), 3.0);
	double t_3 = pow(cos(a), 2.0);
	double t_4 = pow(cos(b), 2.0);
	double t_5 = r * (sin(b) * fma(cos(a), (cos(b) * (sin(a) * sin(b))), fma(t_3, t_4, (pow(sin(a), 2.0) * t_0))));
	double tmp;
	if ((t_1 <= -0.01) || !(t_1 <= 0.04)) {
		tmp = t_5 / ((pow(t_3, 1.5) * pow(cos(b), 3.0)) - (t_2 * pow(sin(b), 3.0)));
	} else {
		tmp = t_5 / (((t_3 * cos(a)) * pow(t_4, 1.5)) - (t_2 * pow(t_0, 1.5)));
	}
	return tmp;
}
function code(r, a, b)
	t_0 = sin(b) ^ 2.0
	t_1 = Float64(sin(b) / cos(Float64(a + b)))
	t_2 = sin(a) ^ 3.0
	t_3 = cos(a) ^ 2.0
	t_4 = cos(b) ^ 2.0
	t_5 = Float64(r * Float64(sin(b) * fma(cos(a), Float64(cos(b) * Float64(sin(a) * sin(b))), fma(t_3, t_4, Float64((sin(a) ^ 2.0) * t_0)))))
	tmp = 0.0
	if ((t_1 <= -0.01) || !(t_1 <= 0.04))
		tmp = Float64(t_5 / Float64(Float64((t_3 ^ 1.5) * (cos(b) ^ 3.0)) - Float64(t_2 * (sin(b) ^ 3.0))));
	else
		tmp = Float64(t_5 / Float64(Float64(Float64(t_3 * cos(a)) * (t_4 ^ 1.5)) - Float64(t_2 * (t_0 ^ 1.5))));
	end
	return tmp
end
code[r_, a_, b_] := Block[{t$95$0 = N[Power[N[Sin[b], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[(N[Sin[b], $MachinePrecision] / N[Cos[N[(a + b), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Power[N[Sin[a], $MachinePrecision], 3.0], $MachinePrecision]}, Block[{t$95$3 = N[Power[N[Cos[a], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$4 = N[Power[N[Cos[b], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$5 = N[(r * N[(N[Sin[b], $MachinePrecision] * N[(N[Cos[a], $MachinePrecision] * N[(N[Cos[b], $MachinePrecision] * N[(N[Sin[a], $MachinePrecision] * N[Sin[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$3 * t$95$4 + N[(N[Power[N[Sin[a], $MachinePrecision], 2.0], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -0.01], N[Not[LessEqual[t$95$1, 0.04]], $MachinePrecision]], N[(t$95$5 / N[(N[(N[Power[t$95$3, 1.5], $MachinePrecision] * N[Power[N[Cos[b], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision] - N[(t$95$2 * N[Power[N[Sin[b], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$5 / N[(N[(N[(t$95$3 * N[Cos[a], $MachinePrecision]), $MachinePrecision] * N[Power[t$95$4, 1.5], $MachinePrecision]), $MachinePrecision] - N[(t$95$2 * N[Power[t$95$0, 1.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {\sin b}^{2}\\
t_1 := \frac{\sin b}{\cos \left(a + b\right)}\\
t_2 := {\sin a}^{3}\\
t_3 := {\cos a}^{2}\\
t_4 := {\cos b}^{2}\\
t_5 := r \cdot \left(\sin b \cdot \mathsf{fma}\left(\cos a, \cos b \cdot \left(\sin a \cdot \sin b\right), \mathsf{fma}\left(t\_3, t\_4, {\sin a}^{2} \cdot t\_0\right)\right)\right)\\
\mathbf{if}\;t\_1 \leq -0.01 \lor \neg \left(t\_1 \leq 0.04\right):\\
\;\;\;\;\frac{t\_5}{{t\_3}^{1.5} \cdot {\cos b}^{3} - t\_2 \cdot {\sin b}^{3}}\\

\mathbf{else}:\\
\;\;\;\;\frac{t\_5}{\left(t\_3 \cdot \cos a\right) \cdot {t\_4}^{1.5} - t\_2 \cdot {t\_0}^{1.5}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (sin.f64 b) (cos.f64 (+.f64 a b))) < -0.0100000000000000002 or 0.0400000000000000008 < (/.f64 (sin.f64 b) (cos.f64 (+.f64 a b)))

    1. Initial program 62.8%

      \[r \cdot \frac{\sin b}{\cos \left(a + b\right)} \]
    2. Add Preprocessing
    3. 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. cos-sumN/A

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

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

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

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

      \[\leadsto \color{blue}{\frac{r \cdot \left(\sin b \cdot \left(\cos a \cdot \left(\cos b \cdot \left(\sin a \cdot \sin b\right)\right) + \left({\cos a}^{2} \cdot {\cos b}^{2} + {\sin a}^{2} \cdot {\sin b}^{2}\right)\right)\right)}{{\cos a}^{3} \cdot {\cos b}^{3} - {\sin a}^{3} \cdot {\sin b}^{3}}} \]
    6. Applied rewrites45.0%

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

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

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

        \[\leadsto \frac{r \cdot \left(\sin b \cdot \mathsf{fma}\left(\cos a, \cos b \cdot \left(\sin a \cdot \sin b\right), \mathsf{fma}\left({\cos a}^{2}, {\cos b}^{2}, {\sin a}^{2} \cdot {\sin b}^{2}\right)\right)\right)}{{\left({\cos a}^{2}\right)}^{\frac{3}{2}} \cdot {\left({\cos b}^{2}\right)}^{\frac{3}{2}} - {\sin a}^{3} \cdot {\left({\sin b}^{2}\right)}^{\frac{3}{2}}} \]
      4. pow-powN/A

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

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

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

        \[\leadsto \frac{r \cdot \left(\sin b \cdot \mathsf{fma}\left(\cos a, \cos b \cdot \left(\sin a \cdot \sin b\right), \mathsf{fma}\left({\cos a}^{2}, {\cos b}^{2}, {\sin a}^{2} \cdot {\sin b}^{2}\right)\right)\right)}{{\left({\cos a}^{2}\right)}^{1.5} \cdot {\left({\cos b}^{2}\right)}^{1.5} - {\sin a}^{3} \cdot {\sin b}^{3}} \]
    8. Applied rewrites53.7%

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

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

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

        \[\leadsto \frac{r \cdot \left(\sin b \cdot \mathsf{fma}\left(\cos a, \cos b \cdot \left(\sin a \cdot \sin b\right), \mathsf{fma}\left({\cos a}^{2}, {\cos b}^{2}, {\sin a}^{2} \cdot {\sin b}^{2}\right)\right)\right)}{{\left({\cos a}^{2}\right)}^{\frac{3}{2}} \cdot {\left({\cos b}^{2}\right)}^{\frac{3}{2}} - {\sin a}^{3} \cdot {\sin b}^{3}} \]
      4. pow-powN/A

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

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

        \[\leadsto \frac{r \cdot \left(\sin b \cdot \mathsf{fma}\left(\cos a, \cos b \cdot \left(\sin a \cdot \sin b\right), \mathsf{fma}\left({\cos a}^{2}, {\cos b}^{2}, {\sin a}^{2} \cdot {\sin b}^{2}\right)\right)\right)}{{\left({\cos a}^{2}\right)}^{\frac{3}{2}} \cdot {\cos b}^{3} - {\sin a}^{\color{blue}{3}} \cdot {\sin b}^{3}} \]
      7. lift-cos.f6482.9

        \[\leadsto \frac{r \cdot \left(\sin b \cdot \mathsf{fma}\left(\cos a, \cos b \cdot \left(\sin a \cdot \sin b\right), \mathsf{fma}\left({\cos a}^{2}, {\cos b}^{2}, {\sin a}^{2} \cdot {\sin b}^{2}\right)\right)\right)}{{\left({\cos a}^{2}\right)}^{1.5} \cdot {\cos b}^{3} - {\sin a}^{3} \cdot {\sin b}^{3}} \]
    10. Applied rewrites82.9%

      \[\leadsto \frac{r \cdot \left(\sin b \cdot \mathsf{fma}\left(\cos a, \cos b \cdot \left(\sin a \cdot \sin b\right), \mathsf{fma}\left({\cos a}^{2}, {\cos b}^{2}, {\sin a}^{2} \cdot {\sin b}^{2}\right)\right)\right)}{{\left({\cos a}^{2}\right)}^{1.5} \cdot {\cos b}^{3} - {\sin a}^{\color{blue}{3}} \cdot {\sin b}^{3}} \]

    if -0.0100000000000000002 < (/.f64 (sin.f64 b) (cos.f64 (+.f64 a b))) < 0.0400000000000000008

    1. Initial program 97.7%

      \[r \cdot \frac{\sin b}{\cos \left(a + b\right)} \]
    2. Add Preprocessing
    3. 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. cos-sumN/A

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

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

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

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

      \[\leadsto \color{blue}{\frac{r \cdot \left(\sin b \cdot \left(\cos a \cdot \left(\cos b \cdot \left(\sin a \cdot \sin b\right)\right) + \left({\cos a}^{2} \cdot {\cos b}^{2} + {\sin a}^{2} \cdot {\sin b}^{2}\right)\right)\right)}{{\cos a}^{3} \cdot {\cos b}^{3} - {\sin a}^{3} \cdot {\sin b}^{3}}} \]
    6. Applied rewrites80.8%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{r \cdot \left(\sin b \cdot \mathsf{fma}\left(\cos a, \cos b \cdot \left(\sin a \cdot \sin b\right), \mathsf{fma}\left({\cos a}^{2}, {\cos b}^{2}, {\sin a}^{2} \cdot {\sin b}^{2}\right)\right)\right)}{\left({\cos a}^{2} \cdot \cos a\right) \cdot {\left({\cos b}^{2}\right)}^{\frac{3}{2}} - {\sin a}^{3} \cdot {\left({\sin b}^{2}\right)}^{\frac{3}{2}}} \]
      11. lift-cos.f6498.9

        \[\leadsto \frac{r \cdot \left(\sin b \cdot \mathsf{fma}\left(\cos a, \cos b \cdot \left(\sin a \cdot \sin b\right), \mathsf{fma}\left({\cos a}^{2}, {\cos b}^{2}, {\sin a}^{2} \cdot {\sin b}^{2}\right)\right)\right)}{\left({\cos a}^{2} \cdot \cos a\right) \cdot {\left({\cos b}^{2}\right)}^{1.5} - {\sin a}^{3} \cdot {\left({\sin b}^{2}\right)}^{1.5}} \]
    8. Applied rewrites98.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\sin b}{\cos \left(a + b\right)} \leq -0.01 \lor \neg \left(\frac{\sin b}{\cos \left(a + b\right)} \leq 0.04\right):\\ \;\;\;\;\frac{r \cdot \left(\sin b \cdot \mathsf{fma}\left(\cos a, \cos b \cdot \left(\sin a \cdot \sin b\right), \mathsf{fma}\left({\cos a}^{2}, {\cos b}^{2}, {\sin a}^{2} \cdot {\sin b}^{2}\right)\right)\right)}{{\left({\cos a}^{2}\right)}^{1.5} \cdot {\cos b}^{3} - {\sin a}^{3} \cdot {\sin b}^{3}}\\ \mathbf{else}:\\ \;\;\;\;\frac{r \cdot \left(\sin b \cdot \mathsf{fma}\left(\cos a, \cos b \cdot \left(\sin a \cdot \sin b\right), \mathsf{fma}\left({\cos a}^{2}, {\cos b}^{2}, {\sin a}^{2} \cdot {\sin b}^{2}\right)\right)\right)}{\left({\cos a}^{2} \cdot \cos a\right) \cdot {\left({\cos b}^{2}\right)}^{1.5} - {\sin a}^{3} \cdot {\left({\sin b}^{2}\right)}^{1.5}}\\ \end{array} \]
  5. Add Preprocessing

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

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\cos a}^{2}\\ t_1 := {\sin b}^{2}\\ t_2 := {t\_1}^{1.5}\\ t_3 := -0.5 \cdot \left(\sin b \cdot r\right)\\ t_4 := t\_1 \cdot r\\ t_5 := \frac{t\_4}{\cos b}\\ t_6 := {\cos b}^{2}\\ t_7 := {t\_6}^{1.5}\\ t_8 := t\_2 \cdot r\\ \mathbf{if}\;a \leq -2.3 \cdot 10^{-5} \lor \neg \left(a \leq 530000000\right):\\ \;\;\;\;\frac{r \cdot \left(\sin b \cdot \mathsf{fma}\left(\cos a, \cos b \cdot \left(\sin a \cdot \sin b\right), \mathsf{fma}\left(t\_0, t\_6, {\sin a}^{2} \cdot t\_1\right)\right)\right)}{\left(t\_0 \cdot \cos a\right) \cdot t\_7 - {\sin a}^{3} \cdot t\_2}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\left(-1 \cdot a\right) \cdot \mathsf{fma}\left(\frac{-0.5}{\cos b}, t\_5, \mathsf{fma}\left(\frac{0.16666666666666666}{\cos b}, t\_5, \frac{\frac{-1 \cdot t\_8}{t\_7} \cdot \sin b}{\cos b} + \frac{\frac{t\_3}{\cos b} \cdot \sin b}{\cos b}\right)\right) - \frac{\mathsf{fma}\left(t\_3, t\_7, \left(-1 \cdot \cos b\right) \cdot t\_8\right)}{\cos b \cdot t\_7}, a, \frac{2 \cdot t\_4}{2 \cdot t\_6}\right), a, r \cdot \tan b\right)\\ \end{array} \end{array} \]
(FPCore (r a b)
 :precision binary64
 (let* ((t_0 (pow (cos a) 2.0))
        (t_1 (pow (sin b) 2.0))
        (t_2 (pow t_1 1.5))
        (t_3 (* -0.5 (* (sin b) r)))
        (t_4 (* t_1 r))
        (t_5 (/ t_4 (cos b)))
        (t_6 (pow (cos b) 2.0))
        (t_7 (pow t_6 1.5))
        (t_8 (* t_2 r)))
   (if (or (<= a -2.3e-5) (not (<= a 530000000.0)))
     (/
      (*
       r
       (*
        (sin b)
        (fma
         (cos a)
         (* (cos b) (* (sin a) (sin b)))
         (fma t_0 t_6 (* (pow (sin a) 2.0) t_1)))))
      (- (* (* t_0 (cos a)) t_7) (* (pow (sin a) 3.0) t_2)))
     (fma
      (fma
       (-
        (*
         (* -1.0 a)
         (fma
          (/ -0.5 (cos b))
          t_5
          (fma
           (/ 0.16666666666666666 (cos b))
           t_5
           (+
            (/ (* (/ (* -1.0 t_8) t_7) (sin b)) (cos b))
            (/ (* (/ t_3 (cos b)) (sin b)) (cos b))))))
        (/ (fma t_3 t_7 (* (* -1.0 (cos b)) t_8)) (* (cos b) t_7)))
       a
       (/ (* 2.0 t_4) (* 2.0 t_6)))
      a
      (* r (tan b))))))
double code(double r, double a, double b) {
	double t_0 = pow(cos(a), 2.0);
	double t_1 = pow(sin(b), 2.0);
	double t_2 = pow(t_1, 1.5);
	double t_3 = -0.5 * (sin(b) * r);
	double t_4 = t_1 * r;
	double t_5 = t_4 / cos(b);
	double t_6 = pow(cos(b), 2.0);
	double t_7 = pow(t_6, 1.5);
	double t_8 = t_2 * r;
	double tmp;
	if ((a <= -2.3e-5) || !(a <= 530000000.0)) {
		tmp = (r * (sin(b) * fma(cos(a), (cos(b) * (sin(a) * sin(b))), fma(t_0, t_6, (pow(sin(a), 2.0) * t_1))))) / (((t_0 * cos(a)) * t_7) - (pow(sin(a), 3.0) * t_2));
	} else {
		tmp = fma(fma((((-1.0 * a) * fma((-0.5 / cos(b)), t_5, fma((0.16666666666666666 / cos(b)), t_5, (((((-1.0 * t_8) / t_7) * sin(b)) / cos(b)) + (((t_3 / cos(b)) * sin(b)) / cos(b)))))) - (fma(t_3, t_7, ((-1.0 * cos(b)) * t_8)) / (cos(b) * t_7))), a, ((2.0 * t_4) / (2.0 * t_6))), a, (r * tan(b)));
	}
	return tmp;
}
function code(r, a, b)
	t_0 = cos(a) ^ 2.0
	t_1 = sin(b) ^ 2.0
	t_2 = t_1 ^ 1.5
	t_3 = Float64(-0.5 * Float64(sin(b) * r))
	t_4 = Float64(t_1 * r)
	t_5 = Float64(t_4 / cos(b))
	t_6 = cos(b) ^ 2.0
	t_7 = t_6 ^ 1.5
	t_8 = Float64(t_2 * r)
	tmp = 0.0
	if ((a <= -2.3e-5) || !(a <= 530000000.0))
		tmp = Float64(Float64(r * Float64(sin(b) * fma(cos(a), Float64(cos(b) * Float64(sin(a) * sin(b))), fma(t_0, t_6, Float64((sin(a) ^ 2.0) * t_1))))) / Float64(Float64(Float64(t_0 * cos(a)) * t_7) - Float64((sin(a) ^ 3.0) * t_2)));
	else
		tmp = fma(fma(Float64(Float64(Float64(-1.0 * a) * fma(Float64(-0.5 / cos(b)), t_5, fma(Float64(0.16666666666666666 / cos(b)), t_5, Float64(Float64(Float64(Float64(Float64(-1.0 * t_8) / t_7) * sin(b)) / cos(b)) + Float64(Float64(Float64(t_3 / cos(b)) * sin(b)) / cos(b)))))) - Float64(fma(t_3, t_7, Float64(Float64(-1.0 * cos(b)) * t_8)) / Float64(cos(b) * t_7))), a, Float64(Float64(2.0 * t_4) / Float64(2.0 * t_6))), a, Float64(r * tan(b)));
	end
	return tmp
end
code[r_, a_, b_] := Block[{t$95$0 = N[Power[N[Cos[a], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[Power[N[Sin[b], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[Power[t$95$1, 1.5], $MachinePrecision]}, Block[{t$95$3 = N[(-0.5 * N[(N[Sin[b], $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$1 * r), $MachinePrecision]}, Block[{t$95$5 = N[(t$95$4 / N[Cos[b], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[Power[N[Cos[b], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$7 = N[Power[t$95$6, 1.5], $MachinePrecision]}, Block[{t$95$8 = N[(t$95$2 * r), $MachinePrecision]}, If[Or[LessEqual[a, -2.3e-5], N[Not[LessEqual[a, 530000000.0]], $MachinePrecision]], N[(N[(r * N[(N[Sin[b], $MachinePrecision] * N[(N[Cos[a], $MachinePrecision] * N[(N[Cos[b], $MachinePrecision] * N[(N[Sin[a], $MachinePrecision] * N[Sin[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$0 * t$95$6 + N[(N[Power[N[Sin[a], $MachinePrecision], 2.0], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(t$95$0 * N[Cos[a], $MachinePrecision]), $MachinePrecision] * t$95$7), $MachinePrecision] - N[(N[Power[N[Sin[a], $MachinePrecision], 3.0], $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(-1.0 * a), $MachinePrecision] * N[(N[(-0.5 / N[Cos[b], $MachinePrecision]), $MachinePrecision] * t$95$5 + N[(N[(0.16666666666666666 / N[Cos[b], $MachinePrecision]), $MachinePrecision] * t$95$5 + N[(N[(N[(N[(N[(-1.0 * t$95$8), $MachinePrecision] / t$95$7), $MachinePrecision] * N[Sin[b], $MachinePrecision]), $MachinePrecision] / N[Cos[b], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(t$95$3 / N[Cos[b], $MachinePrecision]), $MachinePrecision] * N[Sin[b], $MachinePrecision]), $MachinePrecision] / N[Cos[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(t$95$3 * t$95$7 + N[(N[(-1.0 * N[Cos[b], $MachinePrecision]), $MachinePrecision] * t$95$8), $MachinePrecision]), $MachinePrecision] / N[(N[Cos[b], $MachinePrecision] * t$95$7), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * a + N[(N[(2.0 * t$95$4), $MachinePrecision] / N[(2.0 * t$95$6), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * a + N[(r * N[Tan[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {\cos a}^{2}\\
t_1 := {\sin b}^{2}\\
t_2 := {t\_1}^{1.5}\\
t_3 := -0.5 \cdot \left(\sin b \cdot r\right)\\
t_4 := t\_1 \cdot r\\
t_5 := \frac{t\_4}{\cos b}\\
t_6 := {\cos b}^{2}\\
t_7 := {t\_6}^{1.5}\\
t_8 := t\_2 \cdot r\\
\mathbf{if}\;a \leq -2.3 \cdot 10^{-5} \lor \neg \left(a \leq 530000000\right):\\
\;\;\;\;\frac{r \cdot \left(\sin b \cdot \mathsf{fma}\left(\cos a, \cos b \cdot \left(\sin a \cdot \sin b\right), \mathsf{fma}\left(t\_0, t\_6, {\sin a}^{2} \cdot t\_1\right)\right)\right)}{\left(t\_0 \cdot \cos a\right) \cdot t\_7 - {\sin a}^{3} \cdot t\_2}\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\left(-1 \cdot a\right) \cdot \mathsf{fma}\left(\frac{-0.5}{\cos b}, t\_5, \mathsf{fma}\left(\frac{0.16666666666666666}{\cos b}, t\_5, \frac{\frac{-1 \cdot t\_8}{t\_7} \cdot \sin b}{\cos b} + \frac{\frac{t\_3}{\cos b} \cdot \sin b}{\cos b}\right)\right) - \frac{\mathsf{fma}\left(t\_3, t\_7, \left(-1 \cdot \cos b\right) \cdot t\_8\right)}{\cos b \cdot t\_7}, a, \frac{2 \cdot t\_4}{2 \cdot t\_6}\right), a, r \cdot \tan b\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if a < -2.3e-5 or 5.3e8 < a

    1. Initial program 54.2%

      \[r \cdot \frac{\sin b}{\cos \left(a + b\right)} \]
    2. Add Preprocessing
    3. 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. cos-sumN/A

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

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

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

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

      \[\leadsto \color{blue}{\frac{r \cdot \left(\sin b \cdot \left(\cos a \cdot \left(\cos b \cdot \left(\sin a \cdot \sin b\right)\right) + \left({\cos a}^{2} \cdot {\cos b}^{2} + {\sin a}^{2} \cdot {\sin b}^{2}\right)\right)\right)}{{\cos a}^{3} \cdot {\cos b}^{3} - {\sin a}^{3} \cdot {\sin b}^{3}}} \]
    6. Applied rewrites45.9%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{r \cdot \left(\sin b \cdot \mathsf{fma}\left(\cos a, \cos b \cdot \left(\sin a \cdot \sin b\right), \mathsf{fma}\left({\cos a}^{2}, {\cos b}^{2}, {\sin a}^{2} \cdot {\sin b}^{2}\right)\right)\right)}{\left({\cos a}^{2} \cdot \cos a\right) \cdot {\left({\cos b}^{2}\right)}^{\frac{3}{2}} - {\sin a}^{3} \cdot {\left({\sin b}^{2}\right)}^{\frac{3}{2}}} \]
      11. lift-cos.f6469.0

        \[\leadsto \frac{r \cdot \left(\sin b \cdot \mathsf{fma}\left(\cos a, \cos b \cdot \left(\sin a \cdot \sin b\right), \mathsf{fma}\left({\cos a}^{2}, {\cos b}^{2}, {\sin a}^{2} \cdot {\sin b}^{2}\right)\right)\right)}{\left({\cos a}^{2} \cdot \cos a\right) \cdot {\left({\cos b}^{2}\right)}^{1.5} - {\sin a}^{3} \cdot {\left({\sin b}^{2}\right)}^{1.5}} \]
    8. Applied rewrites69.0%

      \[\leadsto \frac{r \cdot \left(\sin b \cdot \mathsf{fma}\left(\cos a, \cos b \cdot \left(\sin a \cdot \sin b\right), \mathsf{fma}\left({\cos a}^{2}, {\cos b}^{2}, {\sin a}^{2} \cdot {\sin b}^{2}\right)\right)\right)}{\left({\cos a}^{2} \cdot \cos a\right) \cdot {\left({\cos b}^{2}\right)}^{1.5} - {\color{blue}{\sin a}}^{3} \cdot {\left({\sin b}^{2}\right)}^{1.5}} \]

    if -2.3e-5 < a < 5.3e8

    1. Initial program 98.8%

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(\left(-1 \cdot a\right) \cdot \mathsf{fma}\left(\frac{-0.5}{\cos b}, \frac{{\sin b}^{2} \cdot r}{\cos b}, \mathsf{fma}\left(\frac{0.16666666666666666}{\cos b}, \frac{{\sin b}^{2} \cdot r}{\cos b}, \frac{\frac{-1 \cdot \left({\left({\sin b}^{2}\right)}^{1.5} \cdot r\right)}{{\left({\cos b}^{2}\right)}^{1.5}} \cdot \sin b}{\cos b} + \frac{\frac{-0.5 \cdot \left(\sin b \cdot r\right)}{\cos b} \cdot \sin b}{\cos b}\right)\right) - \frac{\mathsf{fma}\left(-0.5 \cdot \left(\sin b \cdot r\right), {\left({\cos b}^{2}\right)}^{1.5}, \cos b \cdot \left(-1 \cdot \left({\left({\sin b}^{2}\right)}^{1.5} \cdot r\right)\right)\right)}{\cos b \cdot {\left({\cos b}^{2}\right)}^{1.5}}, a, \frac{2 \cdot \left({\sin b}^{2} \cdot r\right)}{2 \cdot {\cos b}^{2}}\right), a, r \cdot \tan b\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification85.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -2.3 \cdot 10^{-5} \lor \neg \left(a \leq 530000000\right):\\ \;\;\;\;\frac{r \cdot \left(\sin b \cdot \mathsf{fma}\left(\cos a, \cos b \cdot \left(\sin a \cdot \sin b\right), \mathsf{fma}\left({\cos a}^{2}, {\cos b}^{2}, {\sin a}^{2} \cdot {\sin b}^{2}\right)\right)\right)}{\left({\cos a}^{2} \cdot \cos a\right) \cdot {\left({\cos b}^{2}\right)}^{1.5} - {\sin a}^{3} \cdot {\left({\sin b}^{2}\right)}^{1.5}}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\left(-1 \cdot a\right) \cdot \mathsf{fma}\left(\frac{-0.5}{\cos b}, \frac{{\sin b}^{2} \cdot r}{\cos b}, \mathsf{fma}\left(\frac{0.16666666666666666}{\cos b}, \frac{{\sin b}^{2} \cdot r}{\cos b}, \frac{\frac{-1 \cdot \left({\left({\sin b}^{2}\right)}^{1.5} \cdot r\right)}{{\left({\cos b}^{2}\right)}^{1.5}} \cdot \sin b}{\cos b} + \frac{\frac{-0.5 \cdot \left(\sin b \cdot r\right)}{\cos b} \cdot \sin b}{\cos b}\right)\right) - \frac{\mathsf{fma}\left(-0.5 \cdot \left(\sin b \cdot r\right), {\left({\cos b}^{2}\right)}^{1.5}, \left(-1 \cdot \cos b\right) \cdot \left({\left({\sin b}^{2}\right)}^{1.5} \cdot r\right)\right)}{\cos b \cdot {\left({\cos b}^{2}\right)}^{1.5}}, a, \frac{2 \cdot \left({\sin b}^{2} \cdot r\right)}{2 \cdot {\cos b}^{2}}\right), a, r \cdot \tan b\right)\\ \end{array} \]
  5. Add Preprocessing

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

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

\\
\frac{r \cdot \sin b}{\mathsf{fma}\left(\sin \left(\mathsf{fma}\left(0.5, \pi, \frac{\pi}{2}\right)\right), \sin \left(b + a\right), \cos \left(b + a\right) \cdot \sin \left(0.5 \cdot \pi\right)\right)}
\end{array}
Derivation
  1. Initial program 78.6%

    \[r \cdot \frac{\sin b}{\cos \left(a + b\right)} \]
  2. Add Preprocessing
  3. 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. sin-+PI/2-revN/A

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto r \cdot \frac{\sin b}{\mathsf{fma}\left(\sin \left(a + b\right), \cos \left(\frac{\pi}{2}\right), \cos \left(a + b\right) \cdot \sin \color{blue}{\left(\frac{\mathsf{PI}\left(\right)}{2}\right)}\right)} \]
    16. lower-PI.f6478.3

      \[\leadsto r \cdot \frac{\sin b}{\mathsf{fma}\left(\sin \left(a + b\right), \cos \left(\frac{\pi}{2}\right), \cos \left(a + b\right) \cdot \sin \left(\frac{\color{blue}{\pi}}{2}\right)\right)} \]
  4. Applied rewrites78.3%

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

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

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

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

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

      \[\leadsto \frac{r \cdot \sin b}{\mathsf{fma}\left(\cos \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right), \color{blue}{\sin \left(b - -1 \cdot a\right)}, \cos \left(b - -1 \cdot a\right) \cdot \sin \left(\frac{1}{2} \cdot \mathsf{PI}\left(\right)\right)\right)} \]
  7. Applied rewrites77.9%

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

    \[\leadsto \frac{r \cdot \sin b}{\mathsf{fma}\left(\sin \left(\mathsf{fma}\left(0.5, \pi, \frac{\pi}{2}\right)\right), \sin \left(b + a\right), \cos \left(b + a\right) \cdot \sin \left(0.5 \cdot \pi\right)\right)} \]
  9. Add Preprocessing

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

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -0.5 \cdot \left(\sin b \cdot r\right)\\ t_1 := {\sin b}^{2}\\ t_2 := {t\_1}^{1.5} \cdot r\\ t_3 := t\_1 \cdot r\\ t_4 := \frac{t\_3}{\cos b}\\ t_5 := {\cos b}^{2}\\ t_6 := {t\_5}^{1.5}\\ \mathsf{fma}\left(\mathsf{fma}\left(\left(-1 \cdot a\right) \cdot \mathsf{fma}\left(\frac{-0.5}{\cos b}, t\_4, \mathsf{fma}\left(\frac{0.16666666666666666}{\cos b}, t\_4, \frac{\frac{-1 \cdot t\_2}{t\_6} \cdot \sin b}{\cos b} + \frac{\frac{t\_0}{\cos b} \cdot \sin b}{\cos b}\right)\right) - \frac{\mathsf{fma}\left(t\_0, t\_6, \left(-1 \cdot \cos b\right) \cdot t\_2\right)}{\cos b \cdot t\_6}, a, \frac{2 \cdot t\_3}{2 \cdot t\_5}\right), a, r \cdot \tan b\right) \end{array} \end{array} \]
(FPCore (r a b)
 :precision binary64
 (let* ((t_0 (* -0.5 (* (sin b) r)))
        (t_1 (pow (sin b) 2.0))
        (t_2 (* (pow t_1 1.5) r))
        (t_3 (* t_1 r))
        (t_4 (/ t_3 (cos b)))
        (t_5 (pow (cos b) 2.0))
        (t_6 (pow t_5 1.5)))
   (fma
    (fma
     (-
      (*
       (* -1.0 a)
       (fma
        (/ -0.5 (cos b))
        t_4
        (fma
         (/ 0.16666666666666666 (cos b))
         t_4
         (+
          (/ (* (/ (* -1.0 t_2) t_6) (sin b)) (cos b))
          (/ (* (/ t_0 (cos b)) (sin b)) (cos b))))))
      (/ (fma t_0 t_6 (* (* -1.0 (cos b)) t_2)) (* (cos b) t_6)))
     a
     (/ (* 2.0 t_3) (* 2.0 t_5)))
    a
    (* r (tan b)))))
double code(double r, double a, double b) {
	double t_0 = -0.5 * (sin(b) * r);
	double t_1 = pow(sin(b), 2.0);
	double t_2 = pow(t_1, 1.5) * r;
	double t_3 = t_1 * r;
	double t_4 = t_3 / cos(b);
	double t_5 = pow(cos(b), 2.0);
	double t_6 = pow(t_5, 1.5);
	return fma(fma((((-1.0 * a) * fma((-0.5 / cos(b)), t_4, fma((0.16666666666666666 / cos(b)), t_4, (((((-1.0 * t_2) / t_6) * sin(b)) / cos(b)) + (((t_0 / cos(b)) * sin(b)) / cos(b)))))) - (fma(t_0, t_6, ((-1.0 * cos(b)) * t_2)) / (cos(b) * t_6))), a, ((2.0 * t_3) / (2.0 * t_5))), a, (r * tan(b)));
}
function code(r, a, b)
	t_0 = Float64(-0.5 * Float64(sin(b) * r))
	t_1 = sin(b) ^ 2.0
	t_2 = Float64((t_1 ^ 1.5) * r)
	t_3 = Float64(t_1 * r)
	t_4 = Float64(t_3 / cos(b))
	t_5 = cos(b) ^ 2.0
	t_6 = t_5 ^ 1.5
	return fma(fma(Float64(Float64(Float64(-1.0 * a) * fma(Float64(-0.5 / cos(b)), t_4, fma(Float64(0.16666666666666666 / cos(b)), t_4, Float64(Float64(Float64(Float64(Float64(-1.0 * t_2) / t_6) * sin(b)) / cos(b)) + Float64(Float64(Float64(t_0 / cos(b)) * sin(b)) / cos(b)))))) - Float64(fma(t_0, t_6, Float64(Float64(-1.0 * cos(b)) * t_2)) / Float64(cos(b) * t_6))), a, Float64(Float64(2.0 * t_3) / Float64(2.0 * t_5))), a, Float64(r * tan(b)))
end
code[r_, a_, b_] := Block[{t$95$0 = N[(-0.5 * N[(N[Sin[b], $MachinePrecision] * r), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Power[N[Sin[b], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[(N[Power[t$95$1, 1.5], $MachinePrecision] * r), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$1 * r), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$3 / N[Cos[b], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[Power[N[Cos[b], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$6 = N[Power[t$95$5, 1.5], $MachinePrecision]}, N[(N[(N[(N[(N[(-1.0 * a), $MachinePrecision] * N[(N[(-0.5 / N[Cos[b], $MachinePrecision]), $MachinePrecision] * t$95$4 + N[(N[(0.16666666666666666 / N[Cos[b], $MachinePrecision]), $MachinePrecision] * t$95$4 + N[(N[(N[(N[(N[(-1.0 * t$95$2), $MachinePrecision] / t$95$6), $MachinePrecision] * N[Sin[b], $MachinePrecision]), $MachinePrecision] / N[Cos[b], $MachinePrecision]), $MachinePrecision] + N[(N[(N[(t$95$0 / N[Cos[b], $MachinePrecision]), $MachinePrecision] * N[Sin[b], $MachinePrecision]), $MachinePrecision] / N[Cos[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(t$95$0 * t$95$6 + N[(N[(-1.0 * N[Cos[b], $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision] / N[(N[Cos[b], $MachinePrecision] * t$95$6), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * a + N[(N[(2.0 * t$95$3), $MachinePrecision] / N[(2.0 * t$95$5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * a + N[(r * N[Tan[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := -0.5 \cdot \left(\sin b \cdot r\right)\\
t_1 := {\sin b}^{2}\\
t_2 := {t\_1}^{1.5} \cdot r\\
t_3 := t\_1 \cdot r\\
t_4 := \frac{t\_3}{\cos b}\\
t_5 := {\cos b}^{2}\\
t_6 := {t\_5}^{1.5}\\
\mathsf{fma}\left(\mathsf{fma}\left(\left(-1 \cdot a\right) \cdot \mathsf{fma}\left(\frac{-0.5}{\cos b}, t\_4, \mathsf{fma}\left(\frac{0.16666666666666666}{\cos b}, t\_4, \frac{\frac{-1 \cdot t\_2}{t\_6} \cdot \sin b}{\cos b} + \frac{\frac{t\_0}{\cos b} \cdot \sin b}{\cos b}\right)\right) - \frac{\mathsf{fma}\left(t\_0, t\_6, \left(-1 \cdot \cos b\right) \cdot t\_2\right)}{\cos b \cdot t\_6}, a, \frac{2 \cdot t\_3}{2 \cdot t\_5}\right), a, r \cdot \tan b\right)
\end{array}
\end{array}
Derivation
  1. Initial program 78.6%

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

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(\left(-1 \cdot a\right) \cdot \mathsf{fma}\left(\frac{-0.5}{\cos b}, \frac{{\sin b}^{2} \cdot r}{\cos b}, \mathsf{fma}\left(\frac{0.16666666666666666}{\cos b}, \frac{{\sin b}^{2} \cdot r}{\cos b}, \frac{\frac{-1 \cdot \left({\left({\sin b}^{2}\right)}^{1.5} \cdot r\right)}{{\left({\cos b}^{2}\right)}^{1.5}} \cdot \sin b}{\cos b} + \frac{\frac{-0.5 \cdot \left(\sin b \cdot r\right)}{\cos b} \cdot \sin b}{\cos b}\right)\right) - \frac{\mathsf{fma}\left(-0.5 \cdot \left(\sin b \cdot r\right), {\left({\cos b}^{2}\right)}^{1.5}, \cos b \cdot \left(-1 \cdot \left({\left({\sin b}^{2}\right)}^{1.5} \cdot r\right)\right)\right)}{\cos b \cdot {\left({\cos b}^{2}\right)}^{1.5}}, a, \frac{2 \cdot \left({\sin b}^{2} \cdot r\right)}{2 \cdot {\cos b}^{2}}\right), a, r \cdot \tan b\right)} \]
  5. Final simplification59.6%

    \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\left(-1 \cdot a\right) \cdot \mathsf{fma}\left(\frac{-0.5}{\cos b}, \frac{{\sin b}^{2} \cdot r}{\cos b}, \mathsf{fma}\left(\frac{0.16666666666666666}{\cos b}, \frac{{\sin b}^{2} \cdot r}{\cos b}, \frac{\frac{-1 \cdot \left({\left({\sin b}^{2}\right)}^{1.5} \cdot r\right)}{{\left({\cos b}^{2}\right)}^{1.5}} \cdot \sin b}{\cos b} + \frac{\frac{-0.5 \cdot \left(\sin b \cdot r\right)}{\cos b} \cdot \sin b}{\cos b}\right)\right) - \frac{\mathsf{fma}\left(-0.5 \cdot \left(\sin b \cdot r\right), {\left({\cos b}^{2}\right)}^{1.5}, \left(-1 \cdot \cos b\right) \cdot \left({\left({\sin b}^{2}\right)}^{1.5} \cdot r\right)\right)}{\cos b \cdot {\left({\cos b}^{2}\right)}^{1.5}}, a, \frac{2 \cdot \left({\sin b}^{2} \cdot r\right)}{2 \cdot {\cos b}^{2}}\right), a, r \cdot \tan b\right) \]
  6. Add Preprocessing

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

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\cos b}^{2}\\ t_1 := {\sin b}^{2}\\ t_2 := r \cdot t\_1\\ t_3 := \frac{t\_2}{t\_0}\\ \left(-1 \cdot \left(\left(a \cdot a\right) \cdot a\right)\right) \cdot \mathsf{fma}\left(-1, t\_3, \mathsf{fma}\left(-1, \frac{r \cdot {\sin b}^{4}}{{\cos b}^{4}}, \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{r \cdot {t\_1}^{1.5}}{{t\_0}^{1.5}}, -0.5 \cdot \frac{r \cdot \sin b}{\cos b}\right) - \frac{\mathsf{fma}\left(-1, \frac{r}{a} \cdot \tan b, \frac{-1 \cdot t\_2}{t\_0}\right)}{-1 \cdot a}}{-1 \cdot a}, 0.16666666666666666 \cdot t\_3\right)\right)\right) \end{array} \end{array} \]
(FPCore (r a b)
 :precision binary64
 (let* ((t_0 (pow (cos b) 2.0))
        (t_1 (pow (sin b) 2.0))
        (t_2 (* r t_1))
        (t_3 (/ t_2 t_0)))
   (*
    (* -1.0 (* (* a a) a))
    (fma
     -1.0
     t_3
     (fma
      -1.0
      (/ (* r (pow (sin b) 4.0)) (pow (cos b) 4.0))
      (fma
       -1.0
       (/
        (-
         (fma
          -1.0
          (/ (* r (pow t_1 1.5)) (pow t_0 1.5))
          (* -0.5 (/ (* r (sin b)) (cos b))))
         (/ (fma -1.0 (* (/ r a) (tan b)) (/ (* -1.0 t_2) t_0)) (* -1.0 a)))
        (* -1.0 a))
       (* 0.16666666666666666 t_3)))))))
double code(double r, double a, double b) {
	double t_0 = pow(cos(b), 2.0);
	double t_1 = pow(sin(b), 2.0);
	double t_2 = r * t_1;
	double t_3 = t_2 / t_0;
	return (-1.0 * ((a * a) * a)) * fma(-1.0, t_3, fma(-1.0, ((r * pow(sin(b), 4.0)) / pow(cos(b), 4.0)), fma(-1.0, ((fma(-1.0, ((r * pow(t_1, 1.5)) / pow(t_0, 1.5)), (-0.5 * ((r * sin(b)) / cos(b)))) - (fma(-1.0, ((r / a) * tan(b)), ((-1.0 * t_2) / t_0)) / (-1.0 * a))) / (-1.0 * a)), (0.16666666666666666 * t_3))));
}
function code(r, a, b)
	t_0 = cos(b) ^ 2.0
	t_1 = sin(b) ^ 2.0
	t_2 = Float64(r * t_1)
	t_3 = Float64(t_2 / t_0)
	return Float64(Float64(-1.0 * Float64(Float64(a * a) * a)) * fma(-1.0, t_3, fma(-1.0, Float64(Float64(r * (sin(b) ^ 4.0)) / (cos(b) ^ 4.0)), fma(-1.0, Float64(Float64(fma(-1.0, Float64(Float64(r * (t_1 ^ 1.5)) / (t_0 ^ 1.5)), Float64(-0.5 * Float64(Float64(r * sin(b)) / cos(b)))) - Float64(fma(-1.0, Float64(Float64(r / a) * tan(b)), Float64(Float64(-1.0 * t_2) / t_0)) / Float64(-1.0 * a))) / Float64(-1.0 * a)), Float64(0.16666666666666666 * t_3)))))
end
code[r_, a_, b_] := Block[{t$95$0 = N[Power[N[Cos[b], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[Power[N[Sin[b], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[(r * t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 / t$95$0), $MachinePrecision]}, N[(N[(-1.0 * N[(N[(a * a), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] * N[(-1.0 * t$95$3 + N[(-1.0 * N[(N[(r * N[Power[N[Sin[b], $MachinePrecision], 4.0], $MachinePrecision]), $MachinePrecision] / N[Power[N[Cos[b], $MachinePrecision], 4.0], $MachinePrecision]), $MachinePrecision] + N[(-1.0 * N[(N[(N[(-1.0 * N[(N[(r * N[Power[t$95$1, 1.5], $MachinePrecision]), $MachinePrecision] / N[Power[t$95$0, 1.5], $MachinePrecision]), $MachinePrecision] + N[(-0.5 * N[(N[(r * N[Sin[b], $MachinePrecision]), $MachinePrecision] / N[Cos[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(-1.0 * N[(N[(r / a), $MachinePrecision] * N[Tan[b], $MachinePrecision]), $MachinePrecision] + N[(N[(-1.0 * t$95$2), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision] / N[(-1.0 * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(-1.0 * a), $MachinePrecision]), $MachinePrecision] + N[(0.16666666666666666 * t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {\cos b}^{2}\\
t_1 := {\sin b}^{2}\\
t_2 := r \cdot t\_1\\
t_3 := \frac{t\_2}{t\_0}\\
\left(-1 \cdot \left(\left(a \cdot a\right) \cdot a\right)\right) \cdot \mathsf{fma}\left(-1, t\_3, \mathsf{fma}\left(-1, \frac{r \cdot {\sin b}^{4}}{{\cos b}^{4}}, \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{r \cdot {t\_1}^{1.5}}{{t\_0}^{1.5}}, -0.5 \cdot \frac{r \cdot \sin b}{\cos b}\right) - \frac{\mathsf{fma}\left(-1, \frac{r}{a} \cdot \tan b, \frac{-1 \cdot t\_2}{t\_0}\right)}{-1 \cdot a}}{-1 \cdot a}, 0.16666666666666666 \cdot t\_3\right)\right)\right)
\end{array}
\end{array}
Derivation
  1. Initial program 78.6%

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

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(\left(-1 \cdot a\right) \cdot \mathsf{fma}\left(\frac{-0.5}{\cos b}, \frac{{\sin b}^{2} \cdot r}{\cos b}, \mathsf{fma}\left(\frac{0.16666666666666666}{\cos b}, \frac{{\sin b}^{2} \cdot r}{\cos b}, \frac{\frac{-1 \cdot \left({\left({\sin b}^{2}\right)}^{1.5} \cdot r\right)}{{\left({\cos b}^{2}\right)}^{1.5}} \cdot \sin b}{\cos b} + \frac{\frac{-0.5 \cdot \left(\sin b \cdot r\right)}{\cos b} \cdot \sin b}{\cos b}\right)\right) - \frac{\mathsf{fma}\left(-0.5 \cdot \left(\sin b \cdot r\right), {\left({\cos b}^{2}\right)}^{1.5}, \cos b \cdot \left(-1 \cdot \left({\left({\sin b}^{2}\right)}^{1.5} \cdot r\right)\right)\right)}{\cos b \cdot {\left({\cos b}^{2}\right)}^{1.5}}, a, \frac{2 \cdot \left({\sin b}^{2} \cdot r\right)}{2 \cdot {\cos b}^{2}}\right), a, r \cdot \tan b\right)} \]
  5. Taylor expanded in a around -inf

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

    \[\leadsto -1 \cdot \color{blue}{\left(\left(\left(a \cdot a\right) \cdot a\right) \cdot \mathsf{fma}\left(-1, \frac{r \cdot {\sin b}^{2}}{{\cos b}^{2}}, \mathsf{fma}\left(-1, \frac{r \cdot {\sin b}^{4}}{{\cos b}^{4}}, \mathsf{fma}\left(-1, \frac{-1 \cdot \mathsf{fma}\left(-1, \frac{r \cdot {\left({\sin b}^{2}\right)}^{1.5}}{{\left({\cos b}^{2}\right)}^{1.5}}, -0.5 \cdot \frac{r \cdot \sin b}{\cos b}\right) + -1 \cdot \frac{\mathsf{fma}\left(-1, \frac{r}{a} \cdot \tan b, -1 \cdot \frac{r \cdot {\sin b}^{2}}{{\cos b}^{2}}\right)}{a}}{a}, 0.16666666666666666 \cdot \frac{r \cdot {\sin b}^{2}}{{\cos b}^{2}}\right)\right)\right)\right)} \]
  7. Final simplification19.7%

    \[\leadsto \left(-1 \cdot \left(\left(a \cdot a\right) \cdot a\right)\right) \cdot \mathsf{fma}\left(-1, \frac{r \cdot {\sin b}^{2}}{{\cos b}^{2}}, \mathsf{fma}\left(-1, \frac{r \cdot {\sin b}^{4}}{{\cos b}^{4}}, \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-1, \frac{r \cdot {\left({\sin b}^{2}\right)}^{1.5}}{{\left({\cos b}^{2}\right)}^{1.5}}, -0.5 \cdot \frac{r \cdot \sin b}{\cos b}\right) - \frac{\mathsf{fma}\left(-1, \frac{r}{a} \cdot \tan b, \frac{-1 \cdot \left(r \cdot {\sin b}^{2}\right)}{{\cos b}^{2}}\right)}{-1 \cdot a}}{-1 \cdot a}, 0.16666666666666666 \cdot \frac{r \cdot {\sin b}^{2}}{{\cos b}^{2}}\right)\right)\right) \]
  8. Add Preprocessing

Reproduce

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