rsin A (should all be same)

Percentage Accurate: 77.3% → 99.5%
Time: 11.6s
Alternatives: 11
Speedup: 69.0×

Specification

?
\[\frac{r \cdot \sin b}{\cos \left(a + b\right)} \]

Your Program's Arguments

Results

Enter valid numbers for all inputs

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 11 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Alternative 1: 99.5% accurate, 0.4× speedup?

\[\frac{\sin b}{\cos b \cdot \cos a - \sin b \cdot \sin a} \cdot r \]
Derivation
  1. Initial program 81.6%

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

      \[\leadsto \color{blue}{r \cdot \frac{\sin b}{\cos \left(a + b\right)}} \]
    2. *-commutative81.7%

      \[\leadsto \color{blue}{\frac{\sin b}{\cos \left(a + b\right)} \cdot r} \]
    3. +-commutative81.7%

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

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

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

    \[\leadsto \frac{\sin b}{\color{blue}{\cos b \cdot \cos a - \sin b \cdot \sin a}} \cdot r \]
  6. Final simplification99.6%

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

Alternative 2: 99.5% accurate, 0.4× speedup?

\[\sin b \cdot \frac{r}{\cos b \cdot \cos a - \sin b \cdot \sin a} \]
Derivation
  1. Initial program 81.6%

    \[\frac{r \cdot \sin b}{\cos \left(a + b\right)} \]
  2. Step-by-step derivation
    1. associate-/l*81.5%

      \[\leadsto \color{blue}{\frac{r}{\frac{\cos \left(a + b\right)}{\sin b}}} \]
    2. +-commutative81.5%

      \[\leadsto \frac{r}{\frac{\cos \color{blue}{\left(b + a\right)}}{\sin b}} \]
  3. Simplified81.5%

    \[\leadsto \color{blue}{\frac{r}{\frac{\cos \left(b + a\right)}{\sin b}}} \]
  4. Step-by-step derivation
    1. associate-/r/81.6%

      \[\leadsto \color{blue}{\frac{r}{\cos \left(b + a\right)} \cdot \sin b} \]
  5. Applied egg-rr81.6%

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

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

    \[\leadsto \frac{r}{\color{blue}{\cos b \cdot \cos a - \sin b \cdot \sin a}} \cdot \sin b \]
  8. Final simplification99.5%

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

Alternative 3: 76.6% accurate, 1.0× speedup?

\[\begin{array}{l} \mathbf{if}\;a \leq -6.5 \lor \neg \left(a \leq 5.7 \cdot 10^{+14}\right):\\ \;\;\;\;\frac{r}{\frac{\cos a}{\sin b}}\\ \mathbf{else}:\\ \;\;\;\;r \cdot \tan b\\ \end{array} \]
Derivation
  1. Split input into 2 regimes
  2. if a < -6.5 or 5.7e14 < a

    1. Initial program 62.3%

      \[\frac{r \cdot \sin b}{\cos \left(a + b\right)} \]
    2. Step-by-step derivation
      1. associate-/l*62.3%

        \[\leadsto \color{blue}{\frac{r}{\frac{\cos \left(a + b\right)}{\sin b}}} \]
      2. +-commutative62.3%

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

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

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

    if -6.5 < a < 5.7e14

    1. Initial program 97.4%

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

        \[\leadsto \color{blue}{r \cdot \frac{\sin b}{\cos \left(a + b\right)}} \]
      2. *-commutative97.5%

        \[\leadsto \color{blue}{\frac{\sin b}{\cos \left(a + b\right)} \cdot r} \]
      3. +-commutative97.5%

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

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

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

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\sin b}{\cos b}\right)\right)} \cdot r \]
      2. expm1-udef50.9%

        \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{\sin b}{\cos b}\right)} - 1\right)} \cdot r \]
      3. quot-tan50.9%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{\tan b}\right)} - 1\right) \cdot r \]
    6. Applied egg-rr50.9%

      \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(\tan b\right)} - 1\right)} \cdot r \]
    7. Step-by-step derivation
      1. expm1-def87.3%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\tan b\right)\right)} \cdot r \]
      2. expm1-log1p97.6%

        \[\leadsto \color{blue}{\tan b} \cdot r \]
    8. Simplified97.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -6.5 \lor \neg \left(a \leq 5.7 \cdot 10^{+14}\right):\\ \;\;\;\;\frac{r}{\frac{\cos a}{\sin b}}\\ \mathbf{else}:\\ \;\;\;\;r \cdot \tan b\\ \end{array} \]

Alternative 4: 76.6% accurate, 1.0× speedup?

\[\begin{array}{l} \mathbf{if}\;a \leq -6.5:\\ \;\;\;\;\frac{\sin b \cdot r}{\cos a}\\ \mathbf{elif}\;a \leq 5.7 \cdot 10^{+14}:\\ \;\;\;\;r \cdot \tan b\\ \mathbf{else}:\\ \;\;\;\;\frac{r}{\frac{\cos a}{\sin b}}\\ \end{array} \]
Derivation
  1. Split input into 3 regimes
  2. if a < -6.5

    1. Initial program 67.3%

      \[\frac{r \cdot \sin b}{\cos \left(a + b\right)} \]
    2. Step-by-step derivation
      1. +-commutative67.3%

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

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

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

    if -6.5 < a < 5.7e14

    1. Initial program 97.4%

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

        \[\leadsto \color{blue}{r \cdot \frac{\sin b}{\cos \left(a + b\right)}} \]
      2. *-commutative97.5%

        \[\leadsto \color{blue}{\frac{\sin b}{\cos \left(a + b\right)} \cdot r} \]
      3. +-commutative97.5%

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

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

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

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\sin b}{\cos b}\right)\right)} \cdot r \]
      2. expm1-udef50.9%

        \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{\sin b}{\cos b}\right)} - 1\right)} \cdot r \]
      3. quot-tan50.9%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{\tan b}\right)} - 1\right) \cdot r \]
    6. Applied egg-rr50.9%

      \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(\tan b\right)} - 1\right)} \cdot r \]
    7. Step-by-step derivation
      1. expm1-def87.3%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\tan b\right)\right)} \cdot r \]
      2. expm1-log1p97.6%

        \[\leadsto \color{blue}{\tan b} \cdot r \]
    8. Simplified97.6%

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

    if 5.7e14 < a

    1. Initial program 55.6%

      \[\frac{r \cdot \sin b}{\cos \left(a + b\right)} \]
    2. Step-by-step derivation
      1. associate-/l*55.6%

        \[\leadsto \color{blue}{\frac{r}{\frac{\cos \left(a + b\right)}{\sin b}}} \]
      2. +-commutative55.6%

        \[\leadsto \frac{r}{\frac{\cos \color{blue}{\left(b + a\right)}}{\sin b}} \]
    3. Simplified55.6%

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

      \[\leadsto \frac{r}{\frac{\color{blue}{\cos a}}{\sin b}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification82.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -6.5:\\ \;\;\;\;\frac{\sin b \cdot r}{\cos a}\\ \mathbf{elif}\;a \leq 5.7 \cdot 10^{+14}:\\ \;\;\;\;r \cdot \tan b\\ \mathbf{else}:\\ \;\;\;\;\frac{r}{\frac{\cos a}{\sin b}}\\ \end{array} \]

Alternative 5: 77.3% accurate, 1.0× speedup?

\[\sin b \cdot \frac{r}{\cos \left(b + a\right)} \]
Derivation
  1. Initial program 81.6%

    \[\frac{r \cdot \sin b}{\cos \left(a + b\right)} \]
  2. Step-by-step derivation
    1. associate-/l*81.5%

      \[\leadsto \color{blue}{\frac{r}{\frac{\cos \left(a + b\right)}{\sin b}}} \]
    2. +-commutative81.5%

      \[\leadsto \frac{r}{\frac{\cos \color{blue}{\left(b + a\right)}}{\sin b}} \]
  3. Simplified81.5%

    \[\leadsto \color{blue}{\frac{r}{\frac{\cos \left(b + a\right)}{\sin b}}} \]
  4. Step-by-step derivation
    1. associate-/r/81.6%

      \[\leadsto \color{blue}{\frac{r}{\cos \left(b + a\right)} \cdot \sin b} \]
  5. Applied egg-rr81.6%

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

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

Alternative 6: 77.3% accurate, 1.0× speedup?

\[r \cdot \frac{\sin b}{\cos \left(b + a\right)} \]
Derivation
  1. Initial program 81.6%

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

      \[\leadsto \color{blue}{r \cdot \frac{\sin b}{\cos \left(a + b\right)}} \]
    2. *-commutative81.7%

      \[\leadsto \color{blue}{\frac{\sin b}{\cos \left(a + b\right)} \cdot r} \]
    3. +-commutative81.7%

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

    \[\leadsto \color{blue}{\frac{\sin b}{\cos \left(b + a\right)} \cdot r} \]
  4. Final simplification81.7%

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

Alternative 7: 77.1% accurate, 1.9× speedup?

\[\begin{array}{l} \mathbf{if}\;b \leq -4 \cdot 10^{-5} \lor \neg \left(b \leq 7.2 \cdot 10^{-6}\right):\\ \;\;\;\;r \cdot \tan b\\ \mathbf{else}:\\ \;\;\;\;r \cdot \frac{b}{\cos a}\\ \end{array} \]
Derivation
  1. Split input into 2 regimes
  2. if b < -4.00000000000000033e-5 or 7.19999999999999967e-6 < b

    1. Initial program 60.5%

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

        \[\leadsto \color{blue}{r \cdot \frac{\sin b}{\cos \left(a + b\right)}} \]
      2. *-commutative60.6%

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

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

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

      \[\leadsto \frac{\sin b}{\color{blue}{\cos b}} \cdot r \]
    5. Step-by-step derivation
      1. expm1-log1p-u47.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\sin b}{\cos b}\right)\right)} \cdot r \]
      2. expm1-udef46.9%

        \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{\sin b}{\cos b}\right)} - 1\right)} \cdot r \]
      3. quot-tan46.9%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{\tan b}\right)} - 1\right) \cdot r \]
    6. Applied egg-rr46.9%

      \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(\tan b\right)} - 1\right)} \cdot r \]
    7. Step-by-step derivation
      1. expm1-def47.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\tan b\right)\right)} \cdot r \]
      2. expm1-log1p60.9%

        \[\leadsto \color{blue}{\tan b} \cdot r \]
    8. Simplified60.9%

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

    if -4.00000000000000033e-5 < b < 7.19999999999999967e-6

    1. Initial program 99.1%

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

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

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

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

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

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

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

Alternative 8: 77.1% accurate, 1.9× speedup?

\[\begin{array}{l} \mathbf{if}\;b \leq -9.2 \cdot 10^{-6} \lor \neg \left(b \leq 5.1 \cdot 10^{-5}\right):\\ \;\;\;\;r \cdot \tan b\\ \mathbf{else}:\\ \;\;\;\;\frac{b \cdot r}{\cos a}\\ \end{array} \]
Derivation
  1. Split input into 2 regimes
  2. if b < -9.2e-6 or 5.09999999999999996e-5 < b

    1. Initial program 60.5%

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

        \[\leadsto \color{blue}{r \cdot \frac{\sin b}{\cos \left(a + b\right)}} \]
      2. *-commutative60.6%

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

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

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

      \[\leadsto \frac{\sin b}{\color{blue}{\cos b}} \cdot r \]
    5. Step-by-step derivation
      1. expm1-log1p-u47.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\sin b}{\cos b}\right)\right)} \cdot r \]
      2. expm1-udef46.9%

        \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{\sin b}{\cos b}\right)} - 1\right)} \cdot r \]
      3. quot-tan46.9%

        \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{\tan b}\right)} - 1\right) \cdot r \]
    6. Applied egg-rr46.9%

      \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(\tan b\right)} - 1\right)} \cdot r \]
    7. Step-by-step derivation
      1. expm1-def47.5%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\tan b\right)\right)} \cdot r \]
      2. expm1-log1p60.9%

        \[\leadsto \color{blue}{\tan b} \cdot r \]
    8. Simplified60.9%

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

    if -9.2e-6 < b < 5.09999999999999996e-5

    1. Initial program 99.1%

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

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

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

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

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

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

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

Alternative 9: 61.3% accurate, 2.0× speedup?

\[r \cdot \tan b \]
Derivation
  1. Initial program 81.6%

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

      \[\leadsto \color{blue}{r \cdot \frac{\sin b}{\cos \left(a + b\right)}} \]
    2. *-commutative81.7%

      \[\leadsto \color{blue}{\frac{\sin b}{\cos \left(a + b\right)} \cdot r} \]
    3. +-commutative81.7%

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

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

    \[\leadsto \frac{\sin b}{\color{blue}{\cos b}} \cdot r \]
  5. Step-by-step derivation
    1. expm1-log1p-u57.2%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{\sin b}{\cos b}\right)\right)} \cdot r \]
    2. expm1-udef36.1%

      \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(\frac{\sin b}{\cos b}\right)} - 1\right)} \cdot r \]
    3. quot-tan36.1%

      \[\leadsto \left(e^{\mathsf{log1p}\left(\color{blue}{\tan b}\right)} - 1\right) \cdot r \]
  6. Applied egg-rr36.1%

    \[\leadsto \color{blue}{\left(e^{\mathsf{log1p}\left(\tan b\right)} - 1\right)} \cdot r \]
  7. Step-by-step derivation
    1. expm1-def57.2%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\tan b\right)\right)} \cdot r \]
    2. expm1-log1p63.3%

      \[\leadsto \color{blue}{\tan b} \cdot r \]
  8. Simplified63.3%

    \[\leadsto \color{blue}{\tan b} \cdot r \]
  9. Final simplification63.3%

    \[\leadsto r \cdot \tan b \]

Alternative 10: 36.1% accurate, 23.0× speedup?

\[\frac{r}{b \cdot -0.3333333333333333 + \frac{1}{b}} \]
Derivation
  1. Initial program 81.6%

    \[\frac{r \cdot \sin b}{\cos \left(a + b\right)} \]
  2. Step-by-step derivation
    1. associate-/l*81.5%

      \[\leadsto \color{blue}{\frac{r}{\frac{\cos \left(a + b\right)}{\sin b}}} \]
    2. +-commutative81.5%

      \[\leadsto \frac{r}{\frac{\cos \color{blue}{\left(b + a\right)}}{\sin b}} \]
  3. Simplified81.5%

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

    \[\leadsto \frac{r}{\color{blue}{b \cdot \left(-0.5 \cdot \cos a - -0.16666666666666666 \cdot \cos a\right) + \left(-1 \cdot \sin a + \frac{\cos a}{b}\right)}} \]
  5. Step-by-step derivation
    1. fma-def57.6%

      \[\leadsto \frac{r}{\color{blue}{\mathsf{fma}\left(b, -0.5 \cdot \cos a - -0.16666666666666666 \cdot \cos a, -1 \cdot \sin a + \frac{\cos a}{b}\right)}} \]
    2. distribute-rgt-out--57.6%

      \[\leadsto \frac{r}{\mathsf{fma}\left(b, \color{blue}{\cos a \cdot \left(-0.5 - -0.16666666666666666\right)}, -1 \cdot \sin a + \frac{\cos a}{b}\right)} \]
    3. metadata-eval57.6%

      \[\leadsto \frac{r}{\mathsf{fma}\left(b, \cos a \cdot \color{blue}{-0.3333333333333333}, -1 \cdot \sin a + \frac{\cos a}{b}\right)} \]
    4. neg-mul-157.6%

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

      \[\leadsto \frac{r}{\mathsf{fma}\left(b, \cos a \cdot -0.3333333333333333, \color{blue}{\frac{\cos a}{b} + \left(-\sin a\right)}\right)} \]
    6. unsub-neg57.6%

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

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

    \[\leadsto \frac{r}{\color{blue}{-0.3333333333333333 \cdot b + \frac{1}{b}}} \]
  8. Final simplification38.7%

    \[\leadsto \frac{r}{b \cdot -0.3333333333333333 + \frac{1}{b}} \]

Alternative 11: 35.6% accurate, 69.0× speedup?

\[b \cdot r \]
Derivation
  1. Initial program 81.6%

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

      \[\leadsto \color{blue}{r \cdot \frac{\sin b}{\cos \left(a + b\right)}} \]
    2. *-commutative81.7%

      \[\leadsto \color{blue}{\frac{\sin b}{\cos \left(a + b\right)} \cdot r} \]
    3. +-commutative81.7%

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

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

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

    \[\leadsto \color{blue}{b} \cdot r \]
  6. Final simplification37.7%

    \[\leadsto b \cdot r \]

Reproduce

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