rsin B (should all be same)

Percentage Accurate: 76.6% → 99.5%
Time: 13.3s
Alternatives: 12
Speedup: 1.0×

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)));
}
real(8) function code(r, a, b)
    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 12 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.6% 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)));
}
real(8) function code(r, a, b)
    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.3× speedup?

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

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

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

      \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(b\right), \left(\cos a \cdot \cos b - \color{blue}{\sin a \cdot \sin b}\right)\right)\right) \]
    2. --lowering--.f64N/A

      \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(b\right), \mathsf{\_.f64}\left(\left(\cos a \cdot \cos b\right), \color{blue}{\left(\sin a \cdot \sin b\right)}\right)\right)\right) \]
    3. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(b\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos a, \cos b\right), \left(\color{blue}{\sin a} \cdot \sin b\right)\right)\right)\right) \]
    4. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(b\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(a\right), \cos b\right), \left(\sin \color{blue}{a} \cdot \sin b\right)\right)\right)\right) \]
    5. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(b\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(a\right), \mathsf{cos.f64}\left(b\right)\right), \left(\sin a \cdot \sin b\right)\right)\right)\right) \]
    6. *-commutativeN/A

      \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(b\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(a\right), \mathsf{cos.f64}\left(b\right)\right), \left(\sin b \cdot \color{blue}{\sin a}\right)\right)\right)\right) \]
    7. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(b\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(a\right), \mathsf{cos.f64}\left(b\right)\right), \mathsf{*.f64}\left(\sin b, \color{blue}{\sin a}\right)\right)\right)\right) \]
    8. sin-lowering-sin.f64N/A

      \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(b\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(a\right), \mathsf{cos.f64}\left(b\right)\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(b\right), \sin \color{blue}{a}\right)\right)\right)\right) \]
    9. sin-lowering-sin.f6499.5%

      \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(b\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(a\right), \mathsf{cos.f64}\left(b\right)\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(b\right), \mathsf{sin.f64}\left(a\right)\right)\right)\right)\right) \]
  4. Applied egg-rr99.5%

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

      \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(b\right), \left(\cos a \cdot \cos b + \color{blue}{\left(\mathsf{neg}\left(\sin b \cdot \sin a\right)\right)}\right)\right)\right) \]
    2. +-commutativeN/A

      \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(b\right), \left(\left(\mathsf{neg}\left(\sin b \cdot \sin a\right)\right) + \color{blue}{\cos a \cdot \cos b}\right)\right)\right) \]
    3. distribute-lft-neg-inN/A

      \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(b\right), \left(\left(\mathsf{neg}\left(\sin b\right)\right) \cdot \sin a + \color{blue}{\cos a} \cdot \cos b\right)\right)\right) \]
    4. fma-defineN/A

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

      \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(b\right), \mathsf{fma.f64}\left(\left(\mathsf{neg}\left(\sin b\right)\right), \color{blue}{\sin a}, \left(\cos a \cdot \cos b\right)\right)\right)\right) \]
    6. sub0-negN/A

      \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(b\right), \mathsf{fma.f64}\left(\left(0 - \sin b\right), \sin \color{blue}{a}, \left(\cos a \cdot \cos b\right)\right)\right)\right) \]
    7. --lowering--.f64N/A

      \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(b\right), \mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \sin b\right), \sin \color{blue}{a}, \left(\cos a \cdot \cos b\right)\right)\right)\right) \]
    8. sin-lowering-sin.f64N/A

      \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(b\right), \mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(b\right)\right), \sin a, \left(\cos a \cdot \cos b\right)\right)\right)\right) \]
    9. sin-lowering-sin.f64N/A

      \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(b\right), \mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(b\right)\right), \mathsf{sin.f64}\left(a\right), \left(\cos a \cdot \cos b\right)\right)\right)\right) \]
    10. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(b\right), \mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(b\right)\right), \mathsf{sin.f64}\left(a\right), \mathsf{*.f64}\left(\cos a, \cos b\right)\right)\right)\right) \]
    11. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(b\right), \mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(b\right)\right), \mathsf{sin.f64}\left(a\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(a\right), \cos b\right)\right)\right)\right) \]
    12. cos-lowering-cos.f6499.5%

      \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(b\right), \mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(b\right)\right), \mathsf{sin.f64}\left(a\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(a\right), \mathsf{cos.f64}\left(b\right)\right)\right)\right)\right) \]
  6. Applied egg-rr99.5%

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

Alternative 2: 99.5% accurate, 0.4× speedup?

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

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

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

      \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(b\right), \left(\cos a \cdot \cos b - \color{blue}{\sin a \cdot \sin b}\right)\right)\right) \]
    2. --lowering--.f64N/A

      \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(b\right), \mathsf{\_.f64}\left(\left(\cos a \cdot \cos b\right), \color{blue}{\left(\sin a \cdot \sin b\right)}\right)\right)\right) \]
    3. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(b\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos a, \cos b\right), \left(\color{blue}{\sin a} \cdot \sin b\right)\right)\right)\right) \]
    4. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(b\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(a\right), \cos b\right), \left(\sin \color{blue}{a} \cdot \sin b\right)\right)\right)\right) \]
    5. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(b\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(a\right), \mathsf{cos.f64}\left(b\right)\right), \left(\sin a \cdot \sin b\right)\right)\right)\right) \]
    6. *-commutativeN/A

      \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(b\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(a\right), \mathsf{cos.f64}\left(b\right)\right), \left(\sin b \cdot \color{blue}{\sin a}\right)\right)\right)\right) \]
    7. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(b\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(a\right), \mathsf{cos.f64}\left(b\right)\right), \mathsf{*.f64}\left(\sin b, \color{blue}{\sin a}\right)\right)\right)\right) \]
    8. sin-lowering-sin.f64N/A

      \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(b\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(a\right), \mathsf{cos.f64}\left(b\right)\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(b\right), \sin \color{blue}{a}\right)\right)\right)\right) \]
    9. sin-lowering-sin.f6499.5%

      \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(b\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(a\right), \mathsf{cos.f64}\left(b\right)\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(b\right), \mathsf{sin.f64}\left(a\right)\right)\right)\right)\right) \]
  4. Applied egg-rr99.5%

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

Alternative 3: 76.5% accurate, 1.0× speedup?

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

\\
\sin b \cdot \frac{r}{\cos \left(b + a\right)}
\end{array}
Derivation
  1. Initial program 75.8%

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

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

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

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

      \[\leadsto \mathsf{*.f64}\left(\left(\frac{r}{\cos \left(a + b\right)}\right), \color{blue}{\sin b}\right) \]
    5. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(r, \cos \left(a + b\right)\right), \sin \color{blue}{b}\right) \]
    6. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(r, \mathsf{cos.f64}\left(\left(a + b\right)\right)\right), \sin b\right) \]
    7. +-commutativeN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(r, \mathsf{cos.f64}\left(\left(b + a\right)\right)\right), \sin b\right) \]
    8. +-lowering-+.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(r, \mathsf{cos.f64}\left(\mathsf{+.f64}\left(b, a\right)\right)\right), \sin b\right) \]
    9. sin-lowering-sin.f6475.8%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(r, \mathsf{cos.f64}\left(\mathsf{+.f64}\left(b, a\right)\right)\right), \mathsf{sin.f64}\left(b\right)\right) \]
  4. Applied egg-rr75.8%

    \[\leadsto \color{blue}{\frac{r}{\cos \left(b + a\right)} \cdot \sin b} \]
  5. Final simplification75.8%

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

Alternative 4: 76.6% accurate, 1.0× speedup?

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

\\
r \cdot \frac{\sin b}{\cos \left(b + a\right)}
\end{array}
Derivation
  1. Initial program 75.8%

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

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

Alternative 5: 76.5% accurate, 1.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -0.062:\\ \;\;\;\;\frac{1}{\frac{\frac{1}{r}}{\tan b}}\\ \mathbf{elif}\;b \leq 0.036:\\ \;\;\;\;r \cdot \frac{b \cdot \left(1 + b \cdot \left(b \cdot \left(-0.16666666666666666 + \left(b \cdot b\right) \cdot 0.008333333333333333\right)\right)\right)}{\cos \left(b + a\right)}\\ \mathbf{else}:\\ \;\;\;\;r \cdot \tan b\\ \end{array} \end{array} \]
(FPCore (r a b)
 :precision binary64
 (if (<= b -0.062)
   (/ 1.0 (/ (/ 1.0 r) (tan b)))
   (if (<= b 0.036)
     (*
      r
      (/
       (*
        b
        (+
         1.0
         (*
          b
          (* b (+ -0.16666666666666666 (* (* b b) 0.008333333333333333))))))
       (cos (+ b a))))
     (* r (tan b)))))
double code(double r, double a, double b) {
	double tmp;
	if (b <= -0.062) {
		tmp = 1.0 / ((1.0 / r) / tan(b));
	} else if (b <= 0.036) {
		tmp = r * ((b * (1.0 + (b * (b * (-0.16666666666666666 + ((b * b) * 0.008333333333333333)))))) / cos((b + a)));
	} else {
		tmp = r * tan(b);
	}
	return tmp;
}
real(8) function code(r, a, b)
    real(8), intent (in) :: r
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: tmp
    if (b <= (-0.062d0)) then
        tmp = 1.0d0 / ((1.0d0 / r) / tan(b))
    else if (b <= 0.036d0) then
        tmp = r * ((b * (1.0d0 + (b * (b * ((-0.16666666666666666d0) + ((b * b) * 0.008333333333333333d0)))))) / cos((b + a)))
    else
        tmp = r * tan(b)
    end if
    code = tmp
end function
public static double code(double r, double a, double b) {
	double tmp;
	if (b <= -0.062) {
		tmp = 1.0 / ((1.0 / r) / Math.tan(b));
	} else if (b <= 0.036) {
		tmp = r * ((b * (1.0 + (b * (b * (-0.16666666666666666 + ((b * b) * 0.008333333333333333)))))) / Math.cos((b + a)));
	} else {
		tmp = r * Math.tan(b);
	}
	return tmp;
}
def code(r, a, b):
	tmp = 0
	if b <= -0.062:
		tmp = 1.0 / ((1.0 / r) / math.tan(b))
	elif b <= 0.036:
		tmp = r * ((b * (1.0 + (b * (b * (-0.16666666666666666 + ((b * b) * 0.008333333333333333)))))) / math.cos((b + a)))
	else:
		tmp = r * math.tan(b)
	return tmp
function code(r, a, b)
	tmp = 0.0
	if (b <= -0.062)
		tmp = Float64(1.0 / Float64(Float64(1.0 / r) / tan(b)));
	elseif (b <= 0.036)
		tmp = Float64(r * Float64(Float64(b * Float64(1.0 + Float64(b * Float64(b * Float64(-0.16666666666666666 + Float64(Float64(b * b) * 0.008333333333333333)))))) / cos(Float64(b + a))));
	else
		tmp = Float64(r * tan(b));
	end
	return tmp
end
function tmp_2 = code(r, a, b)
	tmp = 0.0;
	if (b <= -0.062)
		tmp = 1.0 / ((1.0 / r) / tan(b));
	elseif (b <= 0.036)
		tmp = r * ((b * (1.0 + (b * (b * (-0.16666666666666666 + ((b * b) * 0.008333333333333333)))))) / cos((b + a)));
	else
		tmp = r * tan(b);
	end
	tmp_2 = tmp;
end
code[r_, a_, b_] := If[LessEqual[b, -0.062], N[(1.0 / N[(N[(1.0 / r), $MachinePrecision] / N[Tan[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 0.036], N[(r * N[(N[(b * N[(1.0 + N[(b * N[(b * N[(-0.16666666666666666 + N[(N[(b * b), $MachinePrecision] * 0.008333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Cos[N[(b + a), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(r * N[Tan[b], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq -0.062:\\
\;\;\;\;\frac{1}{\frac{\frac{1}{r}}{\tan b}}\\

\mathbf{elif}\;b \leq 0.036:\\
\;\;\;\;r \cdot \frac{b \cdot \left(1 + b \cdot \left(b \cdot \left(-0.16666666666666666 + \left(b \cdot b\right) \cdot 0.008333333333333333\right)\right)\right)}{\cos \left(b + a\right)}\\

\mathbf{else}:\\
\;\;\;\;r \cdot \tan b\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b < -0.062

    1. Initial program 60.0%

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

      \[\leadsto \mathsf{*.f64}\left(r, \color{blue}{\left(\frac{\sin b}{\cos b}\right)}\right) \]
    4. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\sin b, \color{blue}{\cos b}\right)\right) \]
      2. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(b\right), \cos \color{blue}{b}\right)\right) \]
      3. cos-lowering-cos.f6460.3%

        \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(b\right), \mathsf{cos.f64}\left(b\right)\right)\right) \]
    5. Simplified60.3%

      \[\leadsto r \cdot \color{blue}{\frac{\sin b}{\cos b}} \]
    6. Step-by-step derivation
      1. clear-numN/A

        \[\leadsto r \cdot \frac{1}{\color{blue}{\frac{\cos b}{\sin b}}} \]
      2. un-div-invN/A

        \[\leadsto \frac{r}{\color{blue}{\frac{\cos b}{\sin b}}} \]
      3. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{\frac{\cos b}{\sin b}}{r}}} \]
      4. metadata-evalN/A

        \[\leadsto \frac{\frac{1}{2} \cdot 2}{\frac{\color{blue}{\frac{\cos b}{\sin b}}}{r}} \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{1}{2} \cdot 2\right), \color{blue}{\left(\frac{\frac{\cos b}{\sin b}}{r}\right)}\right) \]
      6. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{\color{blue}{\frac{\cos b}{\sin b}}}{r}\right)\right) \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(\frac{\cos b}{\sin b}\right), \color{blue}{r}\right)\right) \]
      8. clear-numN/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(\frac{1}{\frac{\sin b}{\cos b}}\right), r\right)\right) \]
      9. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(\frac{\frac{1}{2} \cdot 2}{\frac{\sin b}{\cos b}}\right), r\right)\right) \]
      10. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(\frac{1}{2} \cdot 2\right), \left(\frac{\sin b}{\cos b}\right)\right), r\right)\right) \]
      11. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{\sin b}{\cos b}\right)\right), r\right)\right) \]
      12. quot-tanN/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \tan b\right), r\right)\right) \]
      13. tan-lowering-tan.f6460.4%

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{tan.f64}\left(b\right)\right), r\right)\right) \]
    7. Applied egg-rr60.4%

      \[\leadsto \color{blue}{\frac{1}{\frac{\frac{1}{\tan b}}{r}}} \]
    8. Step-by-step derivation
      1. associate-/l/N/A

        \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{1}{\color{blue}{r \cdot \tan b}}\right)\right) \]
      2. associate-/r*N/A

        \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{\frac{1}{r}}{\color{blue}{\tan b}}\right)\right) \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(\frac{1}{r}\right), \color{blue}{\tan b}\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, r\right), \tan \color{blue}{b}\right)\right) \]
      5. tan-lowering-tan.f6460.5%

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, r\right), \mathsf{tan.f64}\left(b\right)\right)\right) \]
    9. Applied egg-rr60.5%

      \[\leadsto \frac{1}{\color{blue}{\frac{\frac{1}{r}}{\tan b}}} \]

    if -0.062 < b < 0.0359999999999999973

    1. Initial program 98.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{*.f64}\left(b, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(b, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\left(b \cdot b\right), \frac{1}{120}\right)\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{+.f64}\left(a, b\right)\right)\right)\right) \]
      14. *-lowering-*.f6498.2%

        \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{*.f64}\left(b, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(b, \mathsf{*.f64}\left(b, \mathsf{+.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(b, b\right), \frac{1}{120}\right)\right)\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{+.f64}\left(a, b\right)\right)\right)\right) \]
    5. Simplified98.2%

      \[\leadsto r \cdot \frac{\color{blue}{b \cdot \left(1 + b \cdot \left(b \cdot \left(-0.16666666666666666 + \left(b \cdot b\right) \cdot 0.008333333333333333\right)\right)\right)}}{\cos \left(a + b\right)} \]

    if 0.0359999999999999973 < b

    1. Initial program 53.4%

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

      \[\leadsto \mathsf{*.f64}\left(r, \color{blue}{\left(\frac{\sin b}{\cos b}\right)}\right) \]
    4. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\sin b, \color{blue}{\cos b}\right)\right) \]
      2. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(b\right), \cos \color{blue}{b}\right)\right) \]
      3. cos-lowering-cos.f6452.4%

        \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(b\right), \mathsf{cos.f64}\left(b\right)\right)\right) \]
    5. Simplified52.4%

      \[\leadsto r \cdot \color{blue}{\frac{\sin b}{\cos b}} \]
    6. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{\sin b}{\cos b}\right), \color{blue}{r}\right) \]
      3. quot-tanN/A

        \[\leadsto \mathsf{*.f64}\left(\tan b, r\right) \]
      4. tan-lowering-tan.f6452.6%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{tan.f64}\left(b\right), r\right) \]
    7. Applied egg-rr52.6%

      \[\leadsto \color{blue}{\tan b \cdot r} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification75.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -0.062:\\ \;\;\;\;\frac{1}{\frac{\frac{1}{r}}{\tan b}}\\ \mathbf{elif}\;b \leq 0.036:\\ \;\;\;\;r \cdot \frac{b \cdot \left(1 + b \cdot \left(b \cdot \left(-0.16666666666666666 + \left(b \cdot b\right) \cdot 0.008333333333333333\right)\right)\right)}{\cos \left(b + a\right)}\\ \mathbf{else}:\\ \;\;\;\;r \cdot \tan b\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 76.5% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -0.062:\\ \;\;\;\;\frac{1}{\frac{\frac{1}{r}}{\tan b}}\\ \mathbf{elif}\;b \leq 0.0052:\\ \;\;\;\;r \cdot \frac{b \cdot \left(1 + -0.16666666666666666 \cdot \left(b \cdot b\right)\right)}{\cos \left(b + a\right)}\\ \mathbf{else}:\\ \;\;\;\;r \cdot \tan b\\ \end{array} \end{array} \]
(FPCore (r a b)
 :precision binary64
 (if (<= b -0.062)
   (/ 1.0 (/ (/ 1.0 r) (tan b)))
   (if (<= b 0.0052)
     (* r (/ (* b (+ 1.0 (* -0.16666666666666666 (* b b)))) (cos (+ b a))))
     (* r (tan b)))))
double code(double r, double a, double b) {
	double tmp;
	if (b <= -0.062) {
		tmp = 1.0 / ((1.0 / r) / tan(b));
	} else if (b <= 0.0052) {
		tmp = r * ((b * (1.0 + (-0.16666666666666666 * (b * b)))) / cos((b + a)));
	} else {
		tmp = r * tan(b);
	}
	return tmp;
}
real(8) function code(r, a, b)
    real(8), intent (in) :: r
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: tmp
    if (b <= (-0.062d0)) then
        tmp = 1.0d0 / ((1.0d0 / r) / tan(b))
    else if (b <= 0.0052d0) then
        tmp = r * ((b * (1.0d0 + ((-0.16666666666666666d0) * (b * b)))) / cos((b + a)))
    else
        tmp = r * tan(b)
    end if
    code = tmp
end function
public static double code(double r, double a, double b) {
	double tmp;
	if (b <= -0.062) {
		tmp = 1.0 / ((1.0 / r) / Math.tan(b));
	} else if (b <= 0.0052) {
		tmp = r * ((b * (1.0 + (-0.16666666666666666 * (b * b)))) / Math.cos((b + a)));
	} else {
		tmp = r * Math.tan(b);
	}
	return tmp;
}
def code(r, a, b):
	tmp = 0
	if b <= -0.062:
		tmp = 1.0 / ((1.0 / r) / math.tan(b))
	elif b <= 0.0052:
		tmp = r * ((b * (1.0 + (-0.16666666666666666 * (b * b)))) / math.cos((b + a)))
	else:
		tmp = r * math.tan(b)
	return tmp
function code(r, a, b)
	tmp = 0.0
	if (b <= -0.062)
		tmp = Float64(1.0 / Float64(Float64(1.0 / r) / tan(b)));
	elseif (b <= 0.0052)
		tmp = Float64(r * Float64(Float64(b * Float64(1.0 + Float64(-0.16666666666666666 * Float64(b * b)))) / cos(Float64(b + a))));
	else
		tmp = Float64(r * tan(b));
	end
	return tmp
end
function tmp_2 = code(r, a, b)
	tmp = 0.0;
	if (b <= -0.062)
		tmp = 1.0 / ((1.0 / r) / tan(b));
	elseif (b <= 0.0052)
		tmp = r * ((b * (1.0 + (-0.16666666666666666 * (b * b)))) / cos((b + a)));
	else
		tmp = r * tan(b);
	end
	tmp_2 = tmp;
end
code[r_, a_, b_] := If[LessEqual[b, -0.062], N[(1.0 / N[(N[(1.0 / r), $MachinePrecision] / N[Tan[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 0.0052], N[(r * N[(N[(b * N[(1.0 + N[(-0.16666666666666666 * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Cos[N[(b + a), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(r * N[Tan[b], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq -0.062:\\
\;\;\;\;\frac{1}{\frac{\frac{1}{r}}{\tan b}}\\

\mathbf{elif}\;b \leq 0.0052:\\
\;\;\;\;r \cdot \frac{b \cdot \left(1 + -0.16666666666666666 \cdot \left(b \cdot b\right)\right)}{\cos \left(b + a\right)}\\

\mathbf{else}:\\
\;\;\;\;r \cdot \tan b\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b < -0.062

    1. Initial program 60.0%

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

      \[\leadsto \mathsf{*.f64}\left(r, \color{blue}{\left(\frac{\sin b}{\cos b}\right)}\right) \]
    4. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\sin b, \color{blue}{\cos b}\right)\right) \]
      2. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(b\right), \cos \color{blue}{b}\right)\right) \]
      3. cos-lowering-cos.f6460.3%

        \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(b\right), \mathsf{cos.f64}\left(b\right)\right)\right) \]
    5. Simplified60.3%

      \[\leadsto r \cdot \color{blue}{\frac{\sin b}{\cos b}} \]
    6. Step-by-step derivation
      1. clear-numN/A

        \[\leadsto r \cdot \frac{1}{\color{blue}{\frac{\cos b}{\sin b}}} \]
      2. un-div-invN/A

        \[\leadsto \frac{r}{\color{blue}{\frac{\cos b}{\sin b}}} \]
      3. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{\frac{\cos b}{\sin b}}{r}}} \]
      4. metadata-evalN/A

        \[\leadsto \frac{\frac{1}{2} \cdot 2}{\frac{\color{blue}{\frac{\cos b}{\sin b}}}{r}} \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{1}{2} \cdot 2\right), \color{blue}{\left(\frac{\frac{\cos b}{\sin b}}{r}\right)}\right) \]
      6. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{\color{blue}{\frac{\cos b}{\sin b}}}{r}\right)\right) \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(\frac{\cos b}{\sin b}\right), \color{blue}{r}\right)\right) \]
      8. clear-numN/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(\frac{1}{\frac{\sin b}{\cos b}}\right), r\right)\right) \]
      9. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(\frac{\frac{1}{2} \cdot 2}{\frac{\sin b}{\cos b}}\right), r\right)\right) \]
      10. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(\frac{1}{2} \cdot 2\right), \left(\frac{\sin b}{\cos b}\right)\right), r\right)\right) \]
      11. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{\sin b}{\cos b}\right)\right), r\right)\right) \]
      12. quot-tanN/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \tan b\right), r\right)\right) \]
      13. tan-lowering-tan.f6460.4%

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{tan.f64}\left(b\right)\right), r\right)\right) \]
    7. Applied egg-rr60.4%

      \[\leadsto \color{blue}{\frac{1}{\frac{\frac{1}{\tan b}}{r}}} \]
    8. Step-by-step derivation
      1. associate-/l/N/A

        \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{1}{\color{blue}{r \cdot \tan b}}\right)\right) \]
      2. associate-/r*N/A

        \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{\frac{1}{r}}{\color{blue}{\tan b}}\right)\right) \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(\frac{1}{r}\right), \color{blue}{\tan b}\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, r\right), \tan \color{blue}{b}\right)\right) \]
      5. tan-lowering-tan.f6460.5%

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, r\right), \mathsf{tan.f64}\left(b\right)\right)\right) \]
    9. Applied egg-rr60.5%

      \[\leadsto \frac{1}{\color{blue}{\frac{\frac{1}{r}}{\tan b}}} \]

    if -0.062 < b < 0.0051999999999999998

    1. Initial program 98.2%

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{*.f64}\left(b, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{6}, \left(b \cdot b\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{+.f64}\left(a, b\right)\right)\right)\right) \]
      5. *-lowering-*.f6498.2%

        \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{*.f64}\left(b, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(b, b\right)\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{+.f64}\left(a, b\right)\right)\right)\right) \]
    5. Simplified98.2%

      \[\leadsto r \cdot \frac{\color{blue}{b \cdot \left(1 + -0.16666666666666666 \cdot \left(b \cdot b\right)\right)}}{\cos \left(a + b\right)} \]

    if 0.0051999999999999998 < b

    1. Initial program 53.4%

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

      \[\leadsto \mathsf{*.f64}\left(r, \color{blue}{\left(\frac{\sin b}{\cos b}\right)}\right) \]
    4. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\sin b, \color{blue}{\cos b}\right)\right) \]
      2. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(b\right), \cos \color{blue}{b}\right)\right) \]
      3. cos-lowering-cos.f6452.4%

        \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(b\right), \mathsf{cos.f64}\left(b\right)\right)\right) \]
    5. Simplified52.4%

      \[\leadsto r \cdot \color{blue}{\frac{\sin b}{\cos b}} \]
    6. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{\sin b}{\cos b}\right), \color{blue}{r}\right) \]
      3. quot-tanN/A

        \[\leadsto \mathsf{*.f64}\left(\tan b, r\right) \]
      4. tan-lowering-tan.f6452.6%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{tan.f64}\left(b\right), r\right) \]
    7. Applied egg-rr52.6%

      \[\leadsto \color{blue}{\tan b \cdot r} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification75.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -0.062:\\ \;\;\;\;\frac{1}{\frac{\frac{1}{r}}{\tan b}}\\ \mathbf{elif}\;b \leq 0.0052:\\ \;\;\;\;r \cdot \frac{b \cdot \left(1 + -0.16666666666666666 \cdot \left(b \cdot b\right)\right)}{\cos \left(b + a\right)}\\ \mathbf{else}:\\ \;\;\;\;r \cdot \tan b\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 76.4% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq -0.062:\\ \;\;\;\;\frac{1}{\frac{\frac{1}{r}}{\tan b}}\\ \mathbf{elif}\;b \leq 0.00037:\\ \;\;\;\;r \cdot \frac{b}{\cos \left(b + a\right)}\\ \mathbf{else}:\\ \;\;\;\;r \cdot \tan b\\ \end{array} \end{array} \]
(FPCore (r a b)
 :precision binary64
 (if (<= b -0.062)
   (/ 1.0 (/ (/ 1.0 r) (tan b)))
   (if (<= b 0.00037) (* r (/ b (cos (+ b a)))) (* r (tan b)))))
double code(double r, double a, double b) {
	double tmp;
	if (b <= -0.062) {
		tmp = 1.0 / ((1.0 / r) / tan(b));
	} else if (b <= 0.00037) {
		tmp = r * (b / cos((b + a)));
	} else {
		tmp = r * tan(b);
	}
	return tmp;
}
real(8) function code(r, a, b)
    real(8), intent (in) :: r
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8) :: tmp
    if (b <= (-0.062d0)) then
        tmp = 1.0d0 / ((1.0d0 / r) / tan(b))
    else if (b <= 0.00037d0) then
        tmp = r * (b / cos((b + a)))
    else
        tmp = r * tan(b)
    end if
    code = tmp
end function
public static double code(double r, double a, double b) {
	double tmp;
	if (b <= -0.062) {
		tmp = 1.0 / ((1.0 / r) / Math.tan(b));
	} else if (b <= 0.00037) {
		tmp = r * (b / Math.cos((b + a)));
	} else {
		tmp = r * Math.tan(b);
	}
	return tmp;
}
def code(r, a, b):
	tmp = 0
	if b <= -0.062:
		tmp = 1.0 / ((1.0 / r) / math.tan(b))
	elif b <= 0.00037:
		tmp = r * (b / math.cos((b + a)))
	else:
		tmp = r * math.tan(b)
	return tmp
function code(r, a, b)
	tmp = 0.0
	if (b <= -0.062)
		tmp = Float64(1.0 / Float64(Float64(1.0 / r) / tan(b)));
	elseif (b <= 0.00037)
		tmp = Float64(r * Float64(b / cos(Float64(b + a))));
	else
		tmp = Float64(r * tan(b));
	end
	return tmp
end
function tmp_2 = code(r, a, b)
	tmp = 0.0;
	if (b <= -0.062)
		tmp = 1.0 / ((1.0 / r) / tan(b));
	elseif (b <= 0.00037)
		tmp = r * (b / cos((b + a)));
	else
		tmp = r * tan(b);
	end
	tmp_2 = tmp;
end
code[r_, a_, b_] := If[LessEqual[b, -0.062], N[(1.0 / N[(N[(1.0 / r), $MachinePrecision] / N[Tan[b], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 0.00037], N[(r * N[(b / N[Cos[N[(b + a), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(r * N[Tan[b], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq -0.062:\\
\;\;\;\;\frac{1}{\frac{\frac{1}{r}}{\tan b}}\\

\mathbf{elif}\;b \leq 0.00037:\\
\;\;\;\;r \cdot \frac{b}{\cos \left(b + a\right)}\\

\mathbf{else}:\\
\;\;\;\;r \cdot \tan b\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if b < -0.062

    1. Initial program 60.0%

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

      \[\leadsto \mathsf{*.f64}\left(r, \color{blue}{\left(\frac{\sin b}{\cos b}\right)}\right) \]
    4. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\sin b, \color{blue}{\cos b}\right)\right) \]
      2. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(b\right), \cos \color{blue}{b}\right)\right) \]
      3. cos-lowering-cos.f6460.3%

        \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(b\right), \mathsf{cos.f64}\left(b\right)\right)\right) \]
    5. Simplified60.3%

      \[\leadsto r \cdot \color{blue}{\frac{\sin b}{\cos b}} \]
    6. Step-by-step derivation
      1. clear-numN/A

        \[\leadsto r \cdot \frac{1}{\color{blue}{\frac{\cos b}{\sin b}}} \]
      2. un-div-invN/A

        \[\leadsto \frac{r}{\color{blue}{\frac{\cos b}{\sin b}}} \]
      3. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{\frac{\cos b}{\sin b}}{r}}} \]
      4. metadata-evalN/A

        \[\leadsto \frac{\frac{1}{2} \cdot 2}{\frac{\color{blue}{\frac{\cos b}{\sin b}}}{r}} \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(\frac{1}{2} \cdot 2\right), \color{blue}{\left(\frac{\frac{\cos b}{\sin b}}{r}\right)}\right) \]
      6. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{\color{blue}{\frac{\cos b}{\sin b}}}{r}\right)\right) \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(\frac{\cos b}{\sin b}\right), \color{blue}{r}\right)\right) \]
      8. clear-numN/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(\frac{1}{\frac{\sin b}{\cos b}}\right), r\right)\right) \]
      9. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(\frac{\frac{1}{2} \cdot 2}{\frac{\sin b}{\cos b}}\right), r\right)\right) \]
      10. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(\frac{1}{2} \cdot 2\right), \left(\frac{\sin b}{\cos b}\right)\right), r\right)\right) \]
      11. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{\sin b}{\cos b}\right)\right), r\right)\right) \]
      12. quot-tanN/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \tan b\right), r\right)\right) \]
      13. tan-lowering-tan.f6460.4%

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{tan.f64}\left(b\right)\right), r\right)\right) \]
    7. Applied egg-rr60.4%

      \[\leadsto \color{blue}{\frac{1}{\frac{\frac{1}{\tan b}}{r}}} \]
    8. Step-by-step derivation
      1. associate-/l/N/A

        \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{1}{\color{blue}{r \cdot \tan b}}\right)\right) \]
      2. associate-/r*N/A

        \[\leadsto \mathsf{/.f64}\left(1, \left(\frac{\frac{1}{r}}{\color{blue}{\tan b}}\right)\right) \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(\frac{1}{r}\right), \color{blue}{\tan b}\right)\right) \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, r\right), \tan \color{blue}{b}\right)\right) \]
      5. tan-lowering-tan.f6460.5%

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, r\right), \mathsf{tan.f64}\left(b\right)\right)\right) \]
    9. Applied egg-rr60.5%

      \[\leadsto \frac{1}{\color{blue}{\frac{\frac{1}{r}}{\tan b}}} \]

    if -0.062 < b < 3.6999999999999999e-4

    1. Initial program 98.2%

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

      \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\color{blue}{b}, \mathsf{cos.f64}\left(\mathsf{+.f64}\left(a, b\right)\right)\right)\right) \]
    4. Step-by-step derivation
      1. Simplified98.0%

        \[\leadsto r \cdot \frac{\color{blue}{b}}{\cos \left(a + b\right)} \]

      if 3.6999999999999999e-4 < b

      1. Initial program 53.4%

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

        \[\leadsto \mathsf{*.f64}\left(r, \color{blue}{\left(\frac{\sin b}{\cos b}\right)}\right) \]
      4. Step-by-step derivation
        1. /-lowering-/.f64N/A

          \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\sin b, \color{blue}{\cos b}\right)\right) \]
        2. sin-lowering-sin.f64N/A

          \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(b\right), \cos \color{blue}{b}\right)\right) \]
        3. cos-lowering-cos.f6452.4%

          \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(b\right), \mathsf{cos.f64}\left(b\right)\right)\right) \]
      5. Simplified52.4%

        \[\leadsto r \cdot \color{blue}{\frac{\sin b}{\cos b}} \]
      6. Step-by-step derivation
        1. *-commutativeN/A

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

          \[\leadsto \mathsf{*.f64}\left(\left(\frac{\sin b}{\cos b}\right), \color{blue}{r}\right) \]
        3. quot-tanN/A

          \[\leadsto \mathsf{*.f64}\left(\tan b, r\right) \]
        4. tan-lowering-tan.f6452.6%

          \[\leadsto \mathsf{*.f64}\left(\mathsf{tan.f64}\left(b\right), r\right) \]
      7. Applied egg-rr52.6%

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -0.062:\\ \;\;\;\;\frac{1}{\frac{\frac{1}{r}}{\tan b}}\\ \mathbf{elif}\;b \leq 0.00037:\\ \;\;\;\;r \cdot \frac{b}{\cos \left(b + a\right)}\\ \mathbf{else}:\\ \;\;\;\;r \cdot \tan b\\ \end{array} \]
    7. Add Preprocessing

    Alternative 8: 76.4% accurate, 1.8× speedup?

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

      1. Initial program 57.0%

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

        \[\leadsto \mathsf{*.f64}\left(r, \color{blue}{\left(\frac{\sin b}{\cos b}\right)}\right) \]
      4. Step-by-step derivation
        1. /-lowering-/.f64N/A

          \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\sin b, \color{blue}{\cos b}\right)\right) \]
        2. sin-lowering-sin.f64N/A

          \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(b\right), \cos \color{blue}{b}\right)\right) \]
        3. cos-lowering-cos.f6456.7%

          \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(b\right), \mathsf{cos.f64}\left(b\right)\right)\right) \]
      5. Simplified56.7%

        \[\leadsto r \cdot \color{blue}{\frac{\sin b}{\cos b}} \]
      6. Step-by-step derivation
        1. *-commutativeN/A

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

          \[\leadsto \mathsf{*.f64}\left(\left(\frac{\sin b}{\cos b}\right), \color{blue}{r}\right) \]
        3. quot-tanN/A

          \[\leadsto \mathsf{*.f64}\left(\tan b, r\right) \]
        4. tan-lowering-tan.f6456.8%

          \[\leadsto \mathsf{*.f64}\left(\mathsf{tan.f64}\left(b\right), r\right) \]
      7. Applied egg-rr56.8%

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

      if -0.062 < b < 9.5000000000000005e-6

      1. Initial program 98.2%

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

        \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\color{blue}{b}, \mathsf{cos.f64}\left(\mathsf{+.f64}\left(a, b\right)\right)\right)\right) \]
      4. Step-by-step derivation
        1. Simplified98.0%

          \[\leadsto r \cdot \frac{\color{blue}{b}}{\cos \left(a + b\right)} \]
      5. Recombined 2 regimes into one program.
      6. Final simplification75.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -0.062:\\ \;\;\;\;r \cdot \tan b\\ \mathbf{elif}\;b \leq 9.5 \cdot 10^{-6}:\\ \;\;\;\;r \cdot \frac{b}{\cos \left(b + a\right)}\\ \mathbf{else}:\\ \;\;\;\;r \cdot \tan b\\ \end{array} \]
      7. Add Preprocessing

      Alternative 9: 76.4% accurate, 1.8× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := r \cdot \tan b\\ \mathbf{if}\;b \leq -0.062:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;b \leq 4 \cdot 10^{-5}:\\ \;\;\;\;b \cdot \frac{r}{\cos a}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
      (FPCore (r a b)
       :precision binary64
       (let* ((t_0 (* r (tan b))))
         (if (<= b -0.062) t_0 (if (<= b 4e-5) (* b (/ r (cos a))) t_0))))
      double code(double r, double a, double b) {
      	double t_0 = r * tan(b);
      	double tmp;
      	if (b <= -0.062) {
      		tmp = t_0;
      	} else if (b <= 4e-5) {
      		tmp = b * (r / cos(a));
      	} else {
      		tmp = t_0;
      	}
      	return tmp;
      }
      
      real(8) function code(r, a, b)
          real(8), intent (in) :: r
          real(8), intent (in) :: a
          real(8), intent (in) :: b
          real(8) :: t_0
          real(8) :: tmp
          t_0 = r * tan(b)
          if (b <= (-0.062d0)) then
              tmp = t_0
          else if (b <= 4d-5) 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 = r * Math.tan(b);
      	double tmp;
      	if (b <= -0.062) {
      		tmp = t_0;
      	} else if (b <= 4e-5) {
      		tmp = b * (r / Math.cos(a));
      	} else {
      		tmp = t_0;
      	}
      	return tmp;
      }
      
      def code(r, a, b):
      	t_0 = r * math.tan(b)
      	tmp = 0
      	if b <= -0.062:
      		tmp = t_0
      	elif b <= 4e-5:
      		tmp = b * (r / math.cos(a))
      	else:
      		tmp = t_0
      	return tmp
      
      function code(r, a, b)
      	t_0 = Float64(r * tan(b))
      	tmp = 0.0
      	if (b <= -0.062)
      		tmp = t_0;
      	elseif (b <= 4e-5)
      		tmp = Float64(b * Float64(r / cos(a)));
      	else
      		tmp = t_0;
      	end
      	return tmp
      end
      
      function tmp_2 = code(r, a, b)
      	t_0 = r * tan(b);
      	tmp = 0.0;
      	if (b <= -0.062)
      		tmp = t_0;
      	elseif (b <= 4e-5)
      		tmp = b * (r / cos(a));
      	else
      		tmp = t_0;
      	end
      	tmp_2 = tmp;
      end
      
      code[r_, a_, b_] := Block[{t$95$0 = N[(r * N[Tan[b], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -0.062], t$95$0, If[LessEqual[b, 4e-5], N[(b * N[(r / N[Cos[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := r \cdot \tan b\\
      \mathbf{if}\;b \leq -0.062:\\
      \;\;\;\;t\_0\\
      
      \mathbf{elif}\;b \leq 4 \cdot 10^{-5}:\\
      \;\;\;\;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.062 or 4.00000000000000033e-5 < b

        1. Initial program 57.0%

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

          \[\leadsto \mathsf{*.f64}\left(r, \color{blue}{\left(\frac{\sin b}{\cos b}\right)}\right) \]
        4. Step-by-step derivation
          1. /-lowering-/.f64N/A

            \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\sin b, \color{blue}{\cos b}\right)\right) \]
          2. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(b\right), \cos \color{blue}{b}\right)\right) \]
          3. cos-lowering-cos.f6456.7%

            \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(b\right), \mathsf{cos.f64}\left(b\right)\right)\right) \]
        5. Simplified56.7%

          \[\leadsto r \cdot \color{blue}{\frac{\sin b}{\cos b}} \]
        6. Step-by-step derivation
          1. *-commutativeN/A

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

            \[\leadsto \mathsf{*.f64}\left(\left(\frac{\sin b}{\cos b}\right), \color{blue}{r}\right) \]
          3. quot-tanN/A

            \[\leadsto \mathsf{*.f64}\left(\tan b, r\right) \]
          4. tan-lowering-tan.f6456.8%

            \[\leadsto \mathsf{*.f64}\left(\mathsf{tan.f64}\left(b\right), r\right) \]
        7. Applied egg-rr56.8%

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

        if -0.062 < b < 4.00000000000000033e-5

        1. Initial program 98.2%

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

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

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

            \[\leadsto \mathsf{*.f64}\left(b, \color{blue}{\left(\frac{r}{\cos a}\right)}\right) \]
          3. /-lowering-/.f64N/A

            \[\leadsto \mathsf{*.f64}\left(b, \mathsf{/.f64}\left(r, \color{blue}{\cos a}\right)\right) \]
          4. cos-lowering-cos.f6498.0%

            \[\leadsto \mathsf{*.f64}\left(b, \mathsf{/.f64}\left(r, \mathsf{cos.f64}\left(a\right)\right)\right) \]
        5. Simplified98.0%

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -0.062:\\ \;\;\;\;r \cdot \tan b\\ \mathbf{elif}\;b \leq 4 \cdot 10^{-5}:\\ \;\;\;\;b \cdot \frac{r}{\cos a}\\ \mathbf{else}:\\ \;\;\;\;r \cdot \tan b\\ \end{array} \]
      5. Add Preprocessing

      Alternative 10: 60.4% accurate, 2.0× speedup?

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

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

        \[\leadsto \mathsf{*.f64}\left(r, \color{blue}{\left(\frac{\sin b}{\cos b}\right)}\right) \]
      4. Step-by-step derivation
        1. /-lowering-/.f64N/A

          \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\sin b, \color{blue}{\cos b}\right)\right) \]
        2. sin-lowering-sin.f64N/A

          \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(b\right), \cos \color{blue}{b}\right)\right) \]
        3. cos-lowering-cos.f6460.6%

          \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(b\right), \mathsf{cos.f64}\left(b\right)\right)\right) \]
      5. Simplified60.6%

        \[\leadsto r \cdot \color{blue}{\frac{\sin b}{\cos b}} \]
      6. Step-by-step derivation
        1. *-commutativeN/A

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

          \[\leadsto \mathsf{*.f64}\left(\left(\frac{\sin b}{\cos b}\right), \color{blue}{r}\right) \]
        3. quot-tanN/A

          \[\leadsto \mathsf{*.f64}\left(\tan b, r\right) \]
        4. tan-lowering-tan.f6460.7%

          \[\leadsto \mathsf{*.f64}\left(\mathsf{tan.f64}\left(b\right), r\right) \]
      7. Applied egg-rr60.7%

        \[\leadsto \color{blue}{\tan b \cdot r} \]
      8. Final simplification60.7%

        \[\leadsto r \cdot \tan b \]
      9. Add Preprocessing

      Alternative 11: 34.7% accurate, 18.8× speedup?

      \[\begin{array}{l} \\ r \cdot \frac{b}{1 + b \cdot \left(b \cdot -0.5\right)} \end{array} \]
      (FPCore (r a b) :precision binary64 (* r (/ b (+ 1.0 (* b (* b -0.5))))))
      double code(double r, double a, double b) {
      	return r * (b / (1.0 + (b * (b * -0.5))));
      }
      
      real(8) function code(r, a, b)
          real(8), intent (in) :: r
          real(8), intent (in) :: a
          real(8), intent (in) :: b
          code = r * (b / (1.0d0 + (b * (b * (-0.5d0)))))
      end function
      
      public static double code(double r, double a, double b) {
      	return r * (b / (1.0 + (b * (b * -0.5))));
      }
      
      def code(r, a, b):
      	return r * (b / (1.0 + (b * (b * -0.5))))
      
      function code(r, a, b)
      	return Float64(r * Float64(b / Float64(1.0 + Float64(b * Float64(b * -0.5)))))
      end
      
      function tmp = code(r, a, b)
      	tmp = r * (b / (1.0 + (b * (b * -0.5))));
      end
      
      code[r_, a_, b_] := N[(r * N[(b / N[(1.0 + N[(b * N[(b * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
      
      \begin{array}{l}
      
      \\
      r \cdot \frac{b}{1 + b \cdot \left(b \cdot -0.5\right)}
      \end{array}
      
      Derivation
      1. Initial program 75.8%

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

        \[\leadsto \mathsf{*.f64}\left(r, \color{blue}{\left(\frac{\sin b}{\cos b}\right)}\right) \]
      4. Step-by-step derivation
        1. /-lowering-/.f64N/A

          \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\sin b, \color{blue}{\cos b}\right)\right) \]
        2. sin-lowering-sin.f64N/A

          \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(b\right), \cos \color{blue}{b}\right)\right) \]
        3. cos-lowering-cos.f6460.6%

          \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(b\right), \mathsf{cos.f64}\left(b\right)\right)\right) \]
      5. Simplified60.6%

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

        \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(b\right), \color{blue}{\left(1 + \frac{-1}{2} \cdot {b}^{2}\right)}\right)\right) \]
      7. Step-by-step derivation
        1. +-lowering-+.f64N/A

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

          \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(b\right), \mathsf{+.f64}\left(1, \left({b}^{2} \cdot \color{blue}{\frac{-1}{2}}\right)\right)\right)\right) \]
        3. unpow2N/A

          \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(b\right), \mathsf{+.f64}\left(1, \left(\left(b \cdot b\right) \cdot \frac{-1}{2}\right)\right)\right)\right) \]
        4. associate-*l*N/A

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

          \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(b\right), \mathsf{+.f64}\left(1, \left(b \cdot \left(\frac{-1}{2} \cdot \color{blue}{b}\right)\right)\right)\right)\right) \]
        6. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(b\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(b, \color{blue}{\left(\frac{-1}{2} \cdot b\right)}\right)\right)\right)\right) \]
        7. *-commutativeN/A

          \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(b\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(b, \left(b \cdot \color{blue}{\frac{-1}{2}}\right)\right)\right)\right)\right) \]
        8. *-lowering-*.f6432.2%

          \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\mathsf{sin.f64}\left(b\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(b, \mathsf{*.f64}\left(b, \color{blue}{\frac{-1}{2}}\right)\right)\right)\right)\right) \]
      8. Simplified32.2%

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

        \[\leadsto \mathsf{*.f64}\left(r, \mathsf{/.f64}\left(\color{blue}{b}, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(b, \mathsf{*.f64}\left(b, \frac{-1}{2}\right)\right)\right)\right)\right) \]
      10. Step-by-step derivation
        1. Simplified32.1%

          \[\leadsto r \cdot \frac{\color{blue}{b}}{1 + b \cdot \left(b \cdot -0.5\right)} \]
        2. Add Preprocessing

        Alternative 12: 34.3% accurate, 69.0× 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;
        }
        
        real(8) function code(r, a, b)
            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 75.8%

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

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

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

            \[\leadsto \mathsf{*.f64}\left(b, \color{blue}{\left(\frac{r}{\cos a}\right)}\right) \]
          3. /-lowering-/.f64N/A

            \[\leadsto \mathsf{*.f64}\left(b, \mathsf{/.f64}\left(r, \color{blue}{\cos a}\right)\right) \]
          4. cos-lowering-cos.f6446.9%

            \[\leadsto \mathsf{*.f64}\left(b, \mathsf{/.f64}\left(r, \mathsf{cos.f64}\left(a\right)\right)\right) \]
        5. Simplified46.9%

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

          \[\leadsto \color{blue}{b \cdot r} \]
        7. Step-by-step derivation
          1. *-commutativeN/A

            \[\leadsto r \cdot \color{blue}{b} \]
          2. *-lowering-*.f6432.1%

            \[\leadsto \mathsf{*.f64}\left(r, \color{blue}{b}\right) \]
        8. Simplified32.1%

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

        Reproduce

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