tan-example (used to crash)

Percentage Accurate: 79.0% → 99.7%
Time: 26.0s
Alternatives: 12
Speedup: 207.0×

Specification

?
\[x + \left(\tan \left(y + z\right) - \tan a\right) \]

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.

Alternative 1: 99.7% accurate, 0.3× speedup?

\[x + \left(\frac{\tan y + \tan z}{-\mathsf{fma}\left(\tan y, \tan z, -1\right)} - \tan a\right) \]
Derivation
  1. Initial program 75.8%

    \[x + \left(\tan \left(y + z\right) - \tan a\right) \]
  2. Step-by-step derivation
    1. tan-sum99.7%

      \[\leadsto x + \left(\color{blue}{\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}} - \tan a\right) \]
    2. div-inv99.7%

      \[\leadsto x + \left(\color{blue}{\left(\tan y + \tan z\right) \cdot \frac{1}{1 - \tan y \cdot \tan z}} - \tan a\right) \]
  3. Applied egg-rr99.7%

    \[\leadsto x + \left(\color{blue}{\left(\tan y + \tan z\right) \cdot \frac{1}{1 - \tan y \cdot \tan z}} - \tan a\right) \]
  4. Step-by-step derivation
    1. associate-*r/99.7%

      \[\leadsto x + \left(\color{blue}{\frac{\left(\tan y + \tan z\right) \cdot 1}{1 - \tan y \cdot \tan z}} - \tan a\right) \]
    2. *-rgt-identity99.7%

      \[\leadsto x + \left(\frac{\color{blue}{\tan y + \tan z}}{1 - \tan y \cdot \tan z} - \tan a\right) \]
  5. Simplified99.7%

    \[\leadsto x + \left(\color{blue}{\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}} - \tan a\right) \]
  6. Step-by-step derivation
    1. expm1-log1p-u93.5%

      \[\leadsto x + \left(\frac{\tan y + \tan z}{1 - \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\tan y \cdot \tan z\right)\right)}} - \tan a\right) \]
    2. expm1-udef93.4%

      \[\leadsto x + \left(\frac{\tan y + \tan z}{1 - \color{blue}{\left(e^{\mathsf{log1p}\left(\tan y \cdot \tan z\right)} - 1\right)}} - \tan a\right) \]
    3. log1p-udef93.4%

      \[\leadsto x + \left(\frac{\tan y + \tan z}{1 - \left(e^{\color{blue}{\log \left(1 + \tan y \cdot \tan z\right)}} - 1\right)} - \tan a\right) \]
    4. add-exp-log99.7%

      \[\leadsto x + \left(\frac{\tan y + \tan z}{1 - \left(\color{blue}{\left(1 + \tan y \cdot \tan z\right)} - 1\right)} - \tan a\right) \]
  7. Applied egg-rr99.7%

    \[\leadsto x + \left(\frac{\tan y + \tan z}{1 - \color{blue}{\left(\left(1 + \tan y \cdot \tan z\right) - 1\right)}} - \tan a\right) \]
  8. Step-by-step derivation
    1. associate--l+99.7%

      \[\leadsto x + \left(\frac{\tan y + \tan z}{1 - \color{blue}{\left(1 + \left(\tan y \cdot \tan z - 1\right)\right)}} - \tan a\right) \]
    2. fma-neg99.7%

      \[\leadsto x + \left(\frac{\tan y + \tan z}{1 - \left(1 + \color{blue}{\mathsf{fma}\left(\tan y, \tan z, -1\right)}\right)} - \tan a\right) \]
    3. metadata-eval99.7%

      \[\leadsto x + \left(\frac{\tan y + \tan z}{1 - \left(1 + \mathsf{fma}\left(\tan y, \tan z, \color{blue}{-1}\right)\right)} - \tan a\right) \]
  9. Simplified99.7%

    \[\leadsto x + \left(\frac{\tan y + \tan z}{1 - \color{blue}{\left(1 + \mathsf{fma}\left(\tan y, \tan z, -1\right)\right)}} - \tan a\right) \]
  10. Step-by-step derivation
    1. sub-neg99.7%

      \[\leadsto x + \color{blue}{\left(\frac{\tan y + \tan z}{1 - \left(1 + \mathsf{fma}\left(\tan y, \tan z, -1\right)\right)} + \left(-\tan a\right)\right)} \]
    2. associate--r+99.8%

      \[\leadsto x + \left(\frac{\tan y + \tan z}{\color{blue}{\left(1 - 1\right) - \mathsf{fma}\left(\tan y, \tan z, -1\right)}} + \left(-\tan a\right)\right) \]
    3. metadata-eval99.8%

      \[\leadsto x + \left(\frac{\tan y + \tan z}{\color{blue}{0} - \mathsf{fma}\left(\tan y, \tan z, -1\right)} + \left(-\tan a\right)\right) \]
  11. Applied egg-rr99.8%

    \[\leadsto x + \color{blue}{\left(\frac{\tan y + \tan z}{0 - \mathsf{fma}\left(\tan y, \tan z, -1\right)} + \left(-\tan a\right)\right)} \]
  12. Step-by-step derivation
    1. sub-neg99.8%

      \[\leadsto x + \color{blue}{\left(\frac{\tan y + \tan z}{0 - \mathsf{fma}\left(\tan y, \tan z, -1\right)} - \tan a\right)} \]
    2. sub0-neg99.8%

      \[\leadsto x + \left(\frac{\tan y + \tan z}{\color{blue}{-\mathsf{fma}\left(\tan y, \tan z, -1\right)}} - \tan a\right) \]
  13. Simplified99.8%

    \[\leadsto x + \color{blue}{\left(\frac{\tan y + \tan z}{-\mathsf{fma}\left(\tan y, \tan z, -1\right)} - \tan a\right)} \]
  14. Final simplification99.8%

    \[\leadsto x + \left(\frac{\tan y + \tan z}{-\mathsf{fma}\left(\tan y, \tan z, -1\right)} - \tan a\right) \]

Alternative 2: 89.3% accurate, 0.3× speedup?

\[\begin{array}{l} t_0 := \tan y + \tan z\\ \mathbf{if}\;\tan a \leq -2 \cdot 10^{-11} \lor \neg \left(\tan a \leq 5 \cdot 10^{-9}\right):\\ \;\;\;\;x + \left(t_0 - \tan a\right)\\ \mathbf{else}:\\ \;\;\;\;x + t_0 \cdot \frac{1}{1 - \tan y \cdot \tan z}\\ \end{array} \]
Derivation
  1. Split input into 2 regimes
  2. if (tan.f64 a) < -1.99999999999999988e-11 or 5.0000000000000001e-9 < (tan.f64 a)

    1. Initial program 77.6%

      \[x + \left(\tan \left(y + z\right) - \tan a\right) \]
    2. Step-by-step derivation
      1. tan-sum99.7%

        \[\leadsto x + \left(\color{blue}{\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}} - \tan a\right) \]
      2. div-inv99.6%

        \[\leadsto x + \left(\color{blue}{\left(\tan y + \tan z\right) \cdot \frac{1}{1 - \tan y \cdot \tan z}} - \tan a\right) \]
    3. Applied egg-rr99.6%

      \[\leadsto x + \left(\color{blue}{\left(\tan y + \tan z\right) \cdot \frac{1}{1 - \tan y \cdot \tan z}} - \tan a\right) \]
    4. Step-by-step derivation
      1. associate-*r/99.7%

        \[\leadsto x + \left(\color{blue}{\frac{\left(\tan y + \tan z\right) \cdot 1}{1 - \tan y \cdot \tan z}} - \tan a\right) \]
      2. *-rgt-identity99.7%

        \[\leadsto x + \left(\frac{\color{blue}{\tan y + \tan z}}{1 - \tan y \cdot \tan z} - \tan a\right) \]
    5. Simplified99.7%

      \[\leadsto x + \left(\color{blue}{\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}} - \tan a\right) \]
    6. Step-by-step derivation
      1. expm1-log1p-u91.4%

        \[\leadsto x + \left(\frac{\tan y + \tan z}{1 - \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\tan y \cdot \tan z\right)\right)}} - \tan a\right) \]
      2. expm1-udef91.3%

        \[\leadsto x + \left(\frac{\tan y + \tan z}{1 - \color{blue}{\left(e^{\mathsf{log1p}\left(\tan y \cdot \tan z\right)} - 1\right)}} - \tan a\right) \]
      3. log1p-udef91.3%

        \[\leadsto x + \left(\frac{\tan y + \tan z}{1 - \left(e^{\color{blue}{\log \left(1 + \tan y \cdot \tan z\right)}} - 1\right)} - \tan a\right) \]
      4. add-exp-log99.6%

        \[\leadsto x + \left(\frac{\tan y + \tan z}{1 - \left(\color{blue}{\left(1 + \tan y \cdot \tan z\right)} - 1\right)} - \tan a\right) \]
    7. Applied egg-rr99.6%

      \[\leadsto x + \left(\frac{\tan y + \tan z}{1 - \color{blue}{\left(\left(1 + \tan y \cdot \tan z\right) - 1\right)}} - \tan a\right) \]
    8. Step-by-step derivation
      1. associate--l+99.7%

        \[\leadsto x + \left(\frac{\tan y + \tan z}{1 - \color{blue}{\left(1 + \left(\tan y \cdot \tan z - 1\right)\right)}} - \tan a\right) \]
      2. fma-neg99.7%

        \[\leadsto x + \left(\frac{\tan y + \tan z}{1 - \left(1 + \color{blue}{\mathsf{fma}\left(\tan y, \tan z, -1\right)}\right)} - \tan a\right) \]
      3. metadata-eval99.7%

        \[\leadsto x + \left(\frac{\tan y + \tan z}{1 - \left(1 + \mathsf{fma}\left(\tan y, \tan z, \color{blue}{-1}\right)\right)} - \tan a\right) \]
    9. Simplified99.7%

      \[\leadsto x + \left(\frac{\tan y + \tan z}{1 - \color{blue}{\left(1 + \mathsf{fma}\left(\tan y, \tan z, -1\right)\right)}} - \tan a\right) \]
    10. Step-by-step derivation
      1. sub-neg99.7%

        \[\leadsto x + \color{blue}{\left(\frac{\tan y + \tan z}{1 - \left(1 + \mathsf{fma}\left(\tan y, \tan z, -1\right)\right)} + \left(-\tan a\right)\right)} \]
      2. associate--r+99.7%

        \[\leadsto x + \left(\frac{\tan y + \tan z}{\color{blue}{\left(1 - 1\right) - \mathsf{fma}\left(\tan y, \tan z, -1\right)}} + \left(-\tan a\right)\right) \]
      3. metadata-eval99.7%

        \[\leadsto x + \left(\frac{\tan y + \tan z}{\color{blue}{0} - \mathsf{fma}\left(\tan y, \tan z, -1\right)} + \left(-\tan a\right)\right) \]
    11. Applied egg-rr99.7%

      \[\leadsto x + \color{blue}{\left(\frac{\tan y + \tan z}{0 - \mathsf{fma}\left(\tan y, \tan z, -1\right)} + \left(-\tan a\right)\right)} \]
    12. Step-by-step derivation
      1. sub-neg99.7%

        \[\leadsto x + \color{blue}{\left(\frac{\tan y + \tan z}{0 - \mathsf{fma}\left(\tan y, \tan z, -1\right)} - \tan a\right)} \]
      2. sub0-neg99.7%

        \[\leadsto x + \left(\frac{\tan y + \tan z}{\color{blue}{-\mathsf{fma}\left(\tan y, \tan z, -1\right)}} - \tan a\right) \]
    13. Simplified99.7%

      \[\leadsto x + \color{blue}{\left(\frac{\tan y + \tan z}{-\mathsf{fma}\left(\tan y, \tan z, -1\right)} - \tan a\right)} \]
    14. Taylor expanded in y around 0 78.2%

      \[\leadsto x + \left(\frac{\tan y + \tan z}{-\color{blue}{-1}} - \tan a\right) \]

    if -1.99999999999999988e-11 < (tan.f64 a) < 5.0000000000000001e-9

    1. Initial program 73.9%

      \[x + \left(\tan \left(y + z\right) - \tan a\right) \]
    2. Step-by-step derivation
      1. +-commutative73.9%

        \[\leadsto \color{blue}{\left(\tan \left(y + z\right) - \tan a\right) + x} \]
      2. associate-+l-73.9%

        \[\leadsto \color{blue}{\tan \left(y + z\right) - \left(\tan a - x\right)} \]
    3. Applied egg-rr73.9%

      \[\leadsto \color{blue}{\tan \left(y + z\right) - \left(\tan a - x\right)} \]
    4. Taylor expanded in a around 0 73.9%

      \[\leadsto \tan \left(y + z\right) - \color{blue}{-1 \cdot x} \]
    5. Step-by-step derivation
      1. neg-mul-173.9%

        \[\leadsto \tan \left(y + z\right) - \color{blue}{\left(-x\right)} \]
    6. Simplified73.9%

      \[\leadsto \tan \left(y + z\right) - \color{blue}{\left(-x\right)} \]
    7. Step-by-step derivation
      1. tan-sum99.8%

        \[\leadsto x + \left(\color{blue}{\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}} - \tan a\right) \]
      2. div-inv99.8%

        \[\leadsto x + \left(\color{blue}{\left(\tan y + \tan z\right) \cdot \frac{1}{1 - \tan y \cdot \tan z}} - \tan a\right) \]
    8. Applied egg-rr99.3%

      \[\leadsto \color{blue}{\left(\tan y + \tan z\right) \cdot \frac{1}{1 - \tan y \cdot \tan z}} - \left(-x\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification88.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\tan a \leq -2 \cdot 10^{-11} \lor \neg \left(\tan a \leq 5 \cdot 10^{-9}\right):\\ \;\;\;\;x + \left(\left(\tan y + \tan z\right) - \tan a\right)\\ \mathbf{else}:\\ \;\;\;\;x + \left(\tan y + \tan z\right) \cdot \frac{1}{1 - \tan y \cdot \tan z}\\ \end{array} \]

Alternative 3: 89.3% accurate, 0.3× speedup?

\[\begin{array}{l} t_0 := \tan y + \tan z\\ \mathbf{if}\;\tan a \leq -2 \cdot 10^{-11} \lor \neg \left(\tan a \leq 5 \cdot 10^{-9}\right):\\ \;\;\;\;x + \left(t_0 - \tan a\right)\\ \mathbf{else}:\\ \;\;\;\;x + \frac{t_0}{1 - \tan y \cdot \tan z}\\ \end{array} \]
Derivation
  1. Split input into 2 regimes
  2. if (tan.f64 a) < -1.99999999999999988e-11 or 5.0000000000000001e-9 < (tan.f64 a)

    1. Initial program 77.6%

      \[x + \left(\tan \left(y + z\right) - \tan a\right) \]
    2. Step-by-step derivation
      1. tan-sum99.7%

        \[\leadsto x + \left(\color{blue}{\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}} - \tan a\right) \]
      2. div-inv99.6%

        \[\leadsto x + \left(\color{blue}{\left(\tan y + \tan z\right) \cdot \frac{1}{1 - \tan y \cdot \tan z}} - \tan a\right) \]
    3. Applied egg-rr99.6%

      \[\leadsto x + \left(\color{blue}{\left(\tan y + \tan z\right) \cdot \frac{1}{1 - \tan y \cdot \tan z}} - \tan a\right) \]
    4. Step-by-step derivation
      1. associate-*r/99.7%

        \[\leadsto x + \left(\color{blue}{\frac{\left(\tan y + \tan z\right) \cdot 1}{1 - \tan y \cdot \tan z}} - \tan a\right) \]
      2. *-rgt-identity99.7%

        \[\leadsto x + \left(\frac{\color{blue}{\tan y + \tan z}}{1 - \tan y \cdot \tan z} - \tan a\right) \]
    5. Simplified99.7%

      \[\leadsto x + \left(\color{blue}{\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}} - \tan a\right) \]
    6. Step-by-step derivation
      1. expm1-log1p-u91.4%

        \[\leadsto x + \left(\frac{\tan y + \tan z}{1 - \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\tan y \cdot \tan z\right)\right)}} - \tan a\right) \]
      2. expm1-udef91.3%

        \[\leadsto x + \left(\frac{\tan y + \tan z}{1 - \color{blue}{\left(e^{\mathsf{log1p}\left(\tan y \cdot \tan z\right)} - 1\right)}} - \tan a\right) \]
      3. log1p-udef91.3%

        \[\leadsto x + \left(\frac{\tan y + \tan z}{1 - \left(e^{\color{blue}{\log \left(1 + \tan y \cdot \tan z\right)}} - 1\right)} - \tan a\right) \]
      4. add-exp-log99.6%

        \[\leadsto x + \left(\frac{\tan y + \tan z}{1 - \left(\color{blue}{\left(1 + \tan y \cdot \tan z\right)} - 1\right)} - \tan a\right) \]
    7. Applied egg-rr99.6%

      \[\leadsto x + \left(\frac{\tan y + \tan z}{1 - \color{blue}{\left(\left(1 + \tan y \cdot \tan z\right) - 1\right)}} - \tan a\right) \]
    8. Step-by-step derivation
      1. associate--l+99.7%

        \[\leadsto x + \left(\frac{\tan y + \tan z}{1 - \color{blue}{\left(1 + \left(\tan y \cdot \tan z - 1\right)\right)}} - \tan a\right) \]
      2. fma-neg99.7%

        \[\leadsto x + \left(\frac{\tan y + \tan z}{1 - \left(1 + \color{blue}{\mathsf{fma}\left(\tan y, \tan z, -1\right)}\right)} - \tan a\right) \]
      3. metadata-eval99.7%

        \[\leadsto x + \left(\frac{\tan y + \tan z}{1 - \left(1 + \mathsf{fma}\left(\tan y, \tan z, \color{blue}{-1}\right)\right)} - \tan a\right) \]
    9. Simplified99.7%

      \[\leadsto x + \left(\frac{\tan y + \tan z}{1 - \color{blue}{\left(1 + \mathsf{fma}\left(\tan y, \tan z, -1\right)\right)}} - \tan a\right) \]
    10. Step-by-step derivation
      1. sub-neg99.7%

        \[\leadsto x + \color{blue}{\left(\frac{\tan y + \tan z}{1 - \left(1 + \mathsf{fma}\left(\tan y, \tan z, -1\right)\right)} + \left(-\tan a\right)\right)} \]
      2. associate--r+99.7%

        \[\leadsto x + \left(\frac{\tan y + \tan z}{\color{blue}{\left(1 - 1\right) - \mathsf{fma}\left(\tan y, \tan z, -1\right)}} + \left(-\tan a\right)\right) \]
      3. metadata-eval99.7%

        \[\leadsto x + \left(\frac{\tan y + \tan z}{\color{blue}{0} - \mathsf{fma}\left(\tan y, \tan z, -1\right)} + \left(-\tan a\right)\right) \]
    11. Applied egg-rr99.7%

      \[\leadsto x + \color{blue}{\left(\frac{\tan y + \tan z}{0 - \mathsf{fma}\left(\tan y, \tan z, -1\right)} + \left(-\tan a\right)\right)} \]
    12. Step-by-step derivation
      1. sub-neg99.7%

        \[\leadsto x + \color{blue}{\left(\frac{\tan y + \tan z}{0 - \mathsf{fma}\left(\tan y, \tan z, -1\right)} - \tan a\right)} \]
      2. sub0-neg99.7%

        \[\leadsto x + \left(\frac{\tan y + \tan z}{\color{blue}{-\mathsf{fma}\left(\tan y, \tan z, -1\right)}} - \tan a\right) \]
    13. Simplified99.7%

      \[\leadsto x + \color{blue}{\left(\frac{\tan y + \tan z}{-\mathsf{fma}\left(\tan y, \tan z, -1\right)} - \tan a\right)} \]
    14. Taylor expanded in y around 0 78.2%

      \[\leadsto x + \left(\frac{\tan y + \tan z}{-\color{blue}{-1}} - \tan a\right) \]

    if -1.99999999999999988e-11 < (tan.f64 a) < 5.0000000000000001e-9

    1. Initial program 73.9%

      \[x + \left(\tan \left(y + z\right) - \tan a\right) \]
    2. Step-by-step derivation
      1. +-commutative73.9%

        \[\leadsto \color{blue}{\left(\tan \left(y + z\right) - \tan a\right) + x} \]
      2. associate-+l-73.9%

        \[\leadsto \color{blue}{\tan \left(y + z\right) - \left(\tan a - x\right)} \]
    3. Applied egg-rr73.9%

      \[\leadsto \color{blue}{\tan \left(y + z\right) - \left(\tan a - x\right)} \]
    4. Taylor expanded in a around 0 73.9%

      \[\leadsto \tan \left(y + z\right) - \color{blue}{-1 \cdot x} \]
    5. Step-by-step derivation
      1. neg-mul-173.9%

        \[\leadsto \tan \left(y + z\right) - \color{blue}{\left(-x\right)} \]
    6. Simplified73.9%

      \[\leadsto \tan \left(y + z\right) - \color{blue}{\left(-x\right)} \]
    7. Step-by-step derivation
      1. sub-neg73.9%

        \[\leadsto \color{blue}{\tan \left(y + z\right) + \left(-\left(-x\right)\right)} \]
    8. Applied egg-rr73.9%

      \[\leadsto \color{blue}{\tan \left(y + z\right) + \left(-\left(-x\right)\right)} \]
    9. Step-by-step derivation
      1. remove-double-neg73.9%

        \[\leadsto \tan \left(y + z\right) + \color{blue}{x} \]
      2. +-commutative73.9%

        \[\leadsto \color{blue}{x + \tan \left(y + z\right)} \]
      3. +-commutative73.9%

        \[\leadsto x + \tan \color{blue}{\left(z + y\right)} \]
    10. Simplified73.9%

      \[\leadsto \color{blue}{x + \tan \left(z + y\right)} \]
    11. Step-by-step derivation
      1. tan-sum99.3%

        \[\leadsto x + \color{blue}{\frac{\tan z + \tan y}{1 - \tan z \cdot \tan y}} \]
      2. +-commutative99.3%

        \[\leadsto x + \frac{\color{blue}{\tan y + \tan z}}{1 - \tan z \cdot \tan y} \]
    12. Applied egg-rr99.3%

      \[\leadsto x + \color{blue}{\frac{\tan y + \tan z}{1 - \tan z \cdot \tan y}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification88.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\tan a \leq -2 \cdot 10^{-11} \lor \neg \left(\tan a \leq 5 \cdot 10^{-9}\right):\\ \;\;\;\;x + \left(\left(\tan y + \tan z\right) - \tan a\right)\\ \mathbf{else}:\\ \;\;\;\;x + \frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}\\ \end{array} \]

Alternative 4: 99.7% accurate, 0.4× speedup?

\[x + \left(\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z} - \tan a\right) \]
Derivation
  1. Initial program 75.8%

    \[x + \left(\tan \left(y + z\right) - \tan a\right) \]
  2. Step-by-step derivation
    1. tan-sum99.7%

      \[\leadsto x + \left(\color{blue}{\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}} - \tan a\right) \]
    2. div-inv99.7%

      \[\leadsto x + \left(\color{blue}{\left(\tan y + \tan z\right) \cdot \frac{1}{1 - \tan y \cdot \tan z}} - \tan a\right) \]
  3. Applied egg-rr99.7%

    \[\leadsto x + \left(\color{blue}{\left(\tan y + \tan z\right) \cdot \frac{1}{1 - \tan y \cdot \tan z}} - \tan a\right) \]
  4. Step-by-step derivation
    1. associate-*r/99.7%

      \[\leadsto x + \left(\color{blue}{\frac{\left(\tan y + \tan z\right) \cdot 1}{1 - \tan y \cdot \tan z}} - \tan a\right) \]
    2. *-rgt-identity99.7%

      \[\leadsto x + \left(\frac{\color{blue}{\tan y + \tan z}}{1 - \tan y \cdot \tan z} - \tan a\right) \]
  5. Simplified99.7%

    \[\leadsto x + \left(\color{blue}{\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}} - \tan a\right) \]
  6. Final simplification99.7%

    \[\leadsto x + \left(\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z} - \tan a\right) \]

Alternative 5: 79.3% accurate, 0.7× speedup?

\[x + \left(\left(\tan y + \tan z\right) - \tan a\right) \]
Derivation
  1. Initial program 75.8%

    \[x + \left(\tan \left(y + z\right) - \tan a\right) \]
  2. Step-by-step derivation
    1. tan-sum99.7%

      \[\leadsto x + \left(\color{blue}{\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}} - \tan a\right) \]
    2. div-inv99.7%

      \[\leadsto x + \left(\color{blue}{\left(\tan y + \tan z\right) \cdot \frac{1}{1 - \tan y \cdot \tan z}} - \tan a\right) \]
  3. Applied egg-rr99.7%

    \[\leadsto x + \left(\color{blue}{\left(\tan y + \tan z\right) \cdot \frac{1}{1 - \tan y \cdot \tan z}} - \tan a\right) \]
  4. Step-by-step derivation
    1. associate-*r/99.7%

      \[\leadsto x + \left(\color{blue}{\frac{\left(\tan y + \tan z\right) \cdot 1}{1 - \tan y \cdot \tan z}} - \tan a\right) \]
    2. *-rgt-identity99.7%

      \[\leadsto x + \left(\frac{\color{blue}{\tan y + \tan z}}{1 - \tan y \cdot \tan z} - \tan a\right) \]
  5. Simplified99.7%

    \[\leadsto x + \left(\color{blue}{\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z}} - \tan a\right) \]
  6. Step-by-step derivation
    1. expm1-log1p-u93.5%

      \[\leadsto x + \left(\frac{\tan y + \tan z}{1 - \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\tan y \cdot \tan z\right)\right)}} - \tan a\right) \]
    2. expm1-udef93.4%

      \[\leadsto x + \left(\frac{\tan y + \tan z}{1 - \color{blue}{\left(e^{\mathsf{log1p}\left(\tan y \cdot \tan z\right)} - 1\right)}} - \tan a\right) \]
    3. log1p-udef93.4%

      \[\leadsto x + \left(\frac{\tan y + \tan z}{1 - \left(e^{\color{blue}{\log \left(1 + \tan y \cdot \tan z\right)}} - 1\right)} - \tan a\right) \]
    4. add-exp-log99.7%

      \[\leadsto x + \left(\frac{\tan y + \tan z}{1 - \left(\color{blue}{\left(1 + \tan y \cdot \tan z\right)} - 1\right)} - \tan a\right) \]
  7. Applied egg-rr99.7%

    \[\leadsto x + \left(\frac{\tan y + \tan z}{1 - \color{blue}{\left(\left(1 + \tan y \cdot \tan z\right) - 1\right)}} - \tan a\right) \]
  8. Step-by-step derivation
    1. associate--l+99.7%

      \[\leadsto x + \left(\frac{\tan y + \tan z}{1 - \color{blue}{\left(1 + \left(\tan y \cdot \tan z - 1\right)\right)}} - \tan a\right) \]
    2. fma-neg99.7%

      \[\leadsto x + \left(\frac{\tan y + \tan z}{1 - \left(1 + \color{blue}{\mathsf{fma}\left(\tan y, \tan z, -1\right)}\right)} - \tan a\right) \]
    3. metadata-eval99.7%

      \[\leadsto x + \left(\frac{\tan y + \tan z}{1 - \left(1 + \mathsf{fma}\left(\tan y, \tan z, \color{blue}{-1}\right)\right)} - \tan a\right) \]
  9. Simplified99.7%

    \[\leadsto x + \left(\frac{\tan y + \tan z}{1 - \color{blue}{\left(1 + \mathsf{fma}\left(\tan y, \tan z, -1\right)\right)}} - \tan a\right) \]
  10. Step-by-step derivation
    1. sub-neg99.7%

      \[\leadsto x + \color{blue}{\left(\frac{\tan y + \tan z}{1 - \left(1 + \mathsf{fma}\left(\tan y, \tan z, -1\right)\right)} + \left(-\tan a\right)\right)} \]
    2. associate--r+99.8%

      \[\leadsto x + \left(\frac{\tan y + \tan z}{\color{blue}{\left(1 - 1\right) - \mathsf{fma}\left(\tan y, \tan z, -1\right)}} + \left(-\tan a\right)\right) \]
    3. metadata-eval99.8%

      \[\leadsto x + \left(\frac{\tan y + \tan z}{\color{blue}{0} - \mathsf{fma}\left(\tan y, \tan z, -1\right)} + \left(-\tan a\right)\right) \]
  11. Applied egg-rr99.8%

    \[\leadsto x + \color{blue}{\left(\frac{\tan y + \tan z}{0 - \mathsf{fma}\left(\tan y, \tan z, -1\right)} + \left(-\tan a\right)\right)} \]
  12. Step-by-step derivation
    1. sub-neg99.8%

      \[\leadsto x + \color{blue}{\left(\frac{\tan y + \tan z}{0 - \mathsf{fma}\left(\tan y, \tan z, -1\right)} - \tan a\right)} \]
    2. sub0-neg99.8%

      \[\leadsto x + \left(\frac{\tan y + \tan z}{\color{blue}{-\mathsf{fma}\left(\tan y, \tan z, -1\right)}} - \tan a\right) \]
  13. Simplified99.8%

    \[\leadsto x + \color{blue}{\left(\frac{\tan y + \tan z}{-\mathsf{fma}\left(\tan y, \tan z, -1\right)} - \tan a\right)} \]
  14. Taylor expanded in y around 0 76.6%

    \[\leadsto x + \left(\frac{\tan y + \tan z}{-\color{blue}{-1}} - \tan a\right) \]
  15. Final simplification76.6%

    \[\leadsto x + \left(\left(\tan y + \tan z\right) - \tan a\right) \]

Alternative 6: 59.8% accurate, 1.0× speedup?

\[\begin{array}{l} \mathbf{if}\;a \leq -14 \lor \neg \left(a \leq 8 \cdot 10^{-28}\right):\\ \;\;\;\;\sin y + \left(x - \tan a\right)\\ \mathbf{else}:\\ \;\;\;\;\tan \left(y + z\right) + \left(x - a\right)\\ \end{array} \]
Derivation
  1. Split input into 2 regimes
  2. if a < -14 or 7.99999999999999977e-28 < a

    1. Initial program 76.7%

      \[x + \left(\tan \left(y + z\right) - \tan a\right) \]
    2. Step-by-step derivation
      1. +-commutative76.7%

        \[\leadsto \color{blue}{\left(\tan \left(y + z\right) - \tan a\right) + x} \]
      2. sub-neg76.7%

        \[\leadsto \color{blue}{\left(\tan \left(y + z\right) + \left(-\tan a\right)\right)} + x \]
      3. associate-+l+76.6%

        \[\leadsto \color{blue}{\tan \left(y + z\right) + \left(\left(-\tan a\right) + x\right)} \]
      4. tan-quot76.6%

        \[\leadsto \color{blue}{\frac{\sin \left(y + z\right)}{\cos \left(y + z\right)}} + \left(\left(-\tan a\right) + x\right) \]
      5. div-inv76.6%

        \[\leadsto \color{blue}{\sin \left(y + z\right) \cdot \frac{1}{\cos \left(y + z\right)}} + \left(\left(-\tan a\right) + x\right) \]
      6. fma-def76.6%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\sin \left(y + z\right), \frac{1}{\cos \left(y + z\right)}, \left(-\tan a\right) + x\right)} \]
      7. neg-mul-176.6%

        \[\leadsto \mathsf{fma}\left(\sin \left(y + z\right), \frac{1}{\cos \left(y + z\right)}, \color{blue}{-1 \cdot \tan a} + x\right) \]
      8. fma-def76.6%

        \[\leadsto \mathsf{fma}\left(\sin \left(y + z\right), \frac{1}{\cos \left(y + z\right)}, \color{blue}{\mathsf{fma}\left(-1, \tan a, x\right)}\right) \]
    3. Applied egg-rr76.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\sin \left(y + z\right), \frac{1}{\cos \left(y + z\right)}, \mathsf{fma}\left(-1, \tan a, x\right)\right)} \]
    4. Step-by-step derivation
      1. fma-udef76.6%

        \[\leadsto \color{blue}{\sin \left(y + z\right) \cdot \frac{1}{\cos \left(y + z\right)} + \mathsf{fma}\left(-1, \tan a, x\right)} \]
      2. associate-*r/76.6%

        \[\leadsto \color{blue}{\frac{\sin \left(y + z\right) \cdot 1}{\cos \left(y + z\right)}} + \mathsf{fma}\left(-1, \tan a, x\right) \]
      3. *-rgt-identity76.6%

        \[\leadsto \frac{\color{blue}{\sin \left(y + z\right)}}{\cos \left(y + z\right)} + \mathsf{fma}\left(-1, \tan a, x\right) \]
      4. +-commutative76.6%

        \[\leadsto \frac{\sin \color{blue}{\left(z + y\right)}}{\cos \left(y + z\right)} + \mathsf{fma}\left(-1, \tan a, x\right) \]
      5. +-commutative76.6%

        \[\leadsto \frac{\sin \left(z + y\right)}{\cos \color{blue}{\left(z + y\right)}} + \mathsf{fma}\left(-1, \tan a, x\right) \]
      6. fma-udef76.6%

        \[\leadsto \frac{\sin \left(z + y\right)}{\cos \left(z + y\right)} + \color{blue}{\left(-1 \cdot \tan a + x\right)} \]
      7. neg-mul-176.6%

        \[\leadsto \frac{\sin \left(z + y\right)}{\cos \left(z + y\right)} + \left(\color{blue}{\left(-\tan a\right)} + x\right) \]
      8. +-commutative76.6%

        \[\leadsto \frac{\sin \left(z + y\right)}{\cos \left(z + y\right)} + \color{blue}{\left(x + \left(-\tan a\right)\right)} \]
      9. sub-neg76.6%

        \[\leadsto \frac{\sin \left(z + y\right)}{\cos \left(z + y\right)} + \color{blue}{\left(x - \tan a\right)} \]
    5. Simplified76.6%

      \[\leadsto \color{blue}{\frac{\sin \left(z + y\right)}{\cos \left(z + y\right)} + \left(x - \tan a\right)} \]
    6. Taylor expanded in y around 0 62.7%

      \[\leadsto \frac{\sin \left(z + y\right)}{\color{blue}{\cos z + -1 \cdot \left(\sin z \cdot y\right)}} + \left(x - \tan a\right) \]
    7. Step-by-step derivation
      1. mul-1-neg62.7%

        \[\leadsto \frac{\sin \left(z + y\right)}{\cos z + \color{blue}{\left(-\sin z \cdot y\right)}} + \left(x - \tan a\right) \]
      2. unsub-neg62.7%

        \[\leadsto \frac{\sin \left(z + y\right)}{\color{blue}{\cos z - \sin z \cdot y}} + \left(x - \tan a\right) \]
    8. Simplified62.7%

      \[\leadsto \frac{\sin \left(z + y\right)}{\color{blue}{\cos z - \sin z \cdot y}} + \left(x - \tan a\right) \]
    9. Taylor expanded in z around 0 44.0%

      \[\leadsto \color{blue}{\sin y} + \left(x - \tan a\right) \]

    if -14 < a < 7.99999999999999977e-28

    1. Initial program 74.9%

      \[x + \left(\tan \left(y + z\right) - \tan a\right) \]
    2. Step-by-step derivation
      1. +-commutative74.9%

        \[\leadsto \color{blue}{\left(\tan \left(y + z\right) - \tan a\right) + x} \]
      2. associate-+l-74.9%

        \[\leadsto \color{blue}{\tan \left(y + z\right) - \left(\tan a - x\right)} \]
    3. Applied egg-rr74.9%

      \[\leadsto \color{blue}{\tan \left(y + z\right) - \left(\tan a - x\right)} \]
    4. Taylor expanded in a around 0 74.8%

      \[\leadsto \tan \left(y + z\right) - \color{blue}{\left(a + -1 \cdot x\right)} \]
    5. Step-by-step derivation
      1. neg-mul-174.8%

        \[\leadsto \tan \left(y + z\right) - \left(a + \color{blue}{\left(-x\right)}\right) \]
      2. unsub-neg74.8%

        \[\leadsto \tan \left(y + z\right) - \color{blue}{\left(a - x\right)} \]
    6. Simplified74.8%

      \[\leadsto \tan \left(y + z\right) - \color{blue}{\left(a - x\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification59.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -14 \lor \neg \left(a \leq 8 \cdot 10^{-28}\right):\\ \;\;\;\;\sin y + \left(x - \tan a\right)\\ \mathbf{else}:\\ \;\;\;\;\tan \left(y + z\right) + \left(x - a\right)\\ \end{array} \]

Alternative 7: 59.4% accurate, 1.0× speedup?

\[\begin{array}{l} \mathbf{if}\;y + z \leq -2 \cdot 10^{-12}:\\ \;\;\;\;x + \tan \left(y + z\right)\\ \mathbf{else}:\\ \;\;\;\;\tan z + \left(x - \tan a\right)\\ \end{array} \]
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 y z) < -1.99999999999999996e-12

    1. Initial program 70.0%

      \[x + \left(\tan \left(y + z\right) - \tan a\right) \]
    2. Step-by-step derivation
      1. +-commutative70.0%

        \[\leadsto \color{blue}{\left(\tan \left(y + z\right) - \tan a\right) + x} \]
      2. associate-+l-69.9%

        \[\leadsto \color{blue}{\tan \left(y + z\right) - \left(\tan a - x\right)} \]
    3. Applied egg-rr69.9%

      \[\leadsto \color{blue}{\tan \left(y + z\right) - \left(\tan a - x\right)} \]
    4. Taylor expanded in a around 0 44.2%

      \[\leadsto \tan \left(y + z\right) - \color{blue}{-1 \cdot x} \]
    5. Step-by-step derivation
      1. neg-mul-144.2%

        \[\leadsto \tan \left(y + z\right) - \color{blue}{\left(-x\right)} \]
    6. Simplified44.2%

      \[\leadsto \tan \left(y + z\right) - \color{blue}{\left(-x\right)} \]
    7. Step-by-step derivation
      1. sub-neg44.2%

        \[\leadsto \color{blue}{\tan \left(y + z\right) + \left(-\left(-x\right)\right)} \]
    8. Applied egg-rr44.2%

      \[\leadsto \color{blue}{\tan \left(y + z\right) + \left(-\left(-x\right)\right)} \]
    9. Step-by-step derivation
      1. remove-double-neg44.2%

        \[\leadsto \tan \left(y + z\right) + \color{blue}{x} \]
      2. +-commutative44.2%

        \[\leadsto \color{blue}{x + \tan \left(y + z\right)} \]
      3. +-commutative44.2%

        \[\leadsto x + \tan \color{blue}{\left(z + y\right)} \]
    10. Simplified44.2%

      \[\leadsto \color{blue}{x + \tan \left(z + y\right)} \]

    if -1.99999999999999996e-12 < (+.f64 y z)

    1. Initial program 79.5%

      \[x + \left(\tan \left(y + z\right) - \tan a\right) \]
    2. Step-by-step derivation
      1. add-sqr-sqrt74.0%

        \[\leadsto \color{blue}{\sqrt{x + \left(\tan \left(y + z\right) - \tan a\right)} \cdot \sqrt{x + \left(\tan \left(y + z\right) - \tan a\right)}} \]
      2. sqrt-unprod74.7%

        \[\leadsto \color{blue}{\sqrt{\left(x + \left(\tan \left(y + z\right) - \tan a\right)\right) \cdot \left(x + \left(\tan \left(y + z\right) - \tan a\right)\right)}} \]
      3. pow274.7%

        \[\leadsto \sqrt{\color{blue}{{\left(x + \left(\tan \left(y + z\right) - \tan a\right)\right)}^{2}}} \]
      4. associate-+r-74.7%

        \[\leadsto \sqrt{{\color{blue}{\left(\left(x + \tan \left(y + z\right)\right) - \tan a\right)}}^{2}} \]
      5. +-commutative74.7%

        \[\leadsto \sqrt{{\left(\color{blue}{\left(\tan \left(y + z\right) + x\right)} - \tan a\right)}^{2}} \]
      6. associate--l+74.7%

        \[\leadsto \sqrt{{\color{blue}{\left(\tan \left(y + z\right) + \left(x - \tan a\right)\right)}}^{2}} \]
    3. Applied egg-rr74.7%

      \[\leadsto \color{blue}{\sqrt{{\left(\tan \left(y + z\right) + \left(x - \tan a\right)\right)}^{2}}} \]
    4. Taylor expanded in y around 0 60.9%

      \[\leadsto \sqrt{{\left(\color{blue}{\frac{\sin z}{\cos z}} + \left(x - \tan a\right)\right)}^{2}} \]
    5. Step-by-step derivation
      1. sqrt-pow164.7%

        \[\leadsto \color{blue}{{\left(\frac{\sin z}{\cos z} + \left(x - \tan a\right)\right)}^{\left(\frac{2}{2}\right)}} \]
      2. metadata-eval64.7%

        \[\leadsto {\left(\frac{\sin z}{\cos z} + \left(x - \tan a\right)\right)}^{\color{blue}{1}} \]
      3. pow164.7%

        \[\leadsto \color{blue}{\frac{\sin z}{\cos z} + \left(x - \tan a\right)} \]
      4. tan-quot64.7%

        \[\leadsto \color{blue}{\tan z} + \left(x - \tan a\right) \]
      5. +-commutative64.7%

        \[\leadsto \color{blue}{\left(x - \tan a\right) + \tan z} \]
    6. Applied egg-rr64.7%

      \[\leadsto \color{blue}{\left(x - \tan a\right) + \tan z} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification56.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y + z \leq -2 \cdot 10^{-12}:\\ \;\;\;\;x + \tan \left(y + z\right)\\ \mathbf{else}:\\ \;\;\;\;\tan z + \left(x - \tan a\right)\\ \end{array} \]

Alternative 8: 64.1% accurate, 1.0× speedup?

\[\begin{array}{l} \mathbf{if}\;y \leq -2.4 \cdot 10^{-12}:\\ \;\;\;\;x + \frac{\sin y}{\cos y}\\ \mathbf{else}:\\ \;\;\;\;\tan z + \left(x - \tan a\right)\\ \end{array} \]
Derivation
  1. Split input into 2 regimes
  2. if y < -2.39999999999999987e-12

    1. Initial program 57.0%

      \[x + \left(\tan \left(y + z\right) - \tan a\right) \]
    2. Step-by-step derivation
      1. +-commutative57.0%

        \[\leadsto \color{blue}{\left(\tan \left(y + z\right) - \tan a\right) + x} \]
      2. associate-+l-56.9%

        \[\leadsto \color{blue}{\tan \left(y + z\right) - \left(\tan a - x\right)} \]
    3. Applied egg-rr56.9%

      \[\leadsto \color{blue}{\tan \left(y + z\right) - \left(\tan a - x\right)} \]
    4. Taylor expanded in a around 0 38.3%

      \[\leadsto \tan \left(y + z\right) - \color{blue}{-1 \cdot x} \]
    5. Step-by-step derivation
      1. neg-mul-138.3%

        \[\leadsto \tan \left(y + z\right) - \color{blue}{\left(-x\right)} \]
    6. Simplified38.3%

      \[\leadsto \tan \left(y + z\right) - \color{blue}{\left(-x\right)} \]
    7. Taylor expanded in z around 0 38.4%

      \[\leadsto \color{blue}{\frac{\sin y}{\cos y} + x} \]

    if -2.39999999999999987e-12 < y

    1. Initial program 82.9%

      \[x + \left(\tan \left(y + z\right) - \tan a\right) \]
    2. Step-by-step derivation
      1. add-sqr-sqrt77.1%

        \[\leadsto \color{blue}{\sqrt{x + \left(\tan \left(y + z\right) - \tan a\right)} \cdot \sqrt{x + \left(\tan \left(y + z\right) - \tan a\right)}} \]
      2. sqrt-unprod77.8%

        \[\leadsto \color{blue}{\sqrt{\left(x + \left(\tan \left(y + z\right) - \tan a\right)\right) \cdot \left(x + \left(\tan \left(y + z\right) - \tan a\right)\right)}} \]
      3. pow277.8%

        \[\leadsto \sqrt{\color{blue}{{\left(x + \left(\tan \left(y + z\right) - \tan a\right)\right)}^{2}}} \]
      4. associate-+r-77.8%

        \[\leadsto \sqrt{{\color{blue}{\left(\left(x + \tan \left(y + z\right)\right) - \tan a\right)}}^{2}} \]
      5. +-commutative77.8%

        \[\leadsto \sqrt{{\left(\color{blue}{\left(\tan \left(y + z\right) + x\right)} - \tan a\right)}^{2}} \]
      6. associate--l+77.8%

        \[\leadsto \sqrt{{\color{blue}{\left(\tan \left(y + z\right) + \left(x - \tan a\right)\right)}}^{2}} \]
    3. Applied egg-rr77.8%

      \[\leadsto \color{blue}{\sqrt{{\left(\tan \left(y + z\right) + \left(x - \tan a\right)\right)}^{2}}} \]
    4. Taylor expanded in y around 0 66.1%

      \[\leadsto \sqrt{{\left(\color{blue}{\frac{\sin z}{\cos z}} + \left(x - \tan a\right)\right)}^{2}} \]
    5. Step-by-step derivation
      1. sqrt-pow170.4%

        \[\leadsto \color{blue}{{\left(\frac{\sin z}{\cos z} + \left(x - \tan a\right)\right)}^{\left(\frac{2}{2}\right)}} \]
      2. metadata-eval70.4%

        \[\leadsto {\left(\frac{\sin z}{\cos z} + \left(x - \tan a\right)\right)}^{\color{blue}{1}} \]
      3. pow170.4%

        \[\leadsto \color{blue}{\frac{\sin z}{\cos z} + \left(x - \tan a\right)} \]
      4. tan-quot70.4%

        \[\leadsto \color{blue}{\tan z} + \left(x - \tan a\right) \]
      5. +-commutative70.4%

        \[\leadsto \color{blue}{\left(x - \tan a\right) + \tan z} \]
    6. Applied egg-rr70.4%

      \[\leadsto \color{blue}{\left(x - \tan a\right) + \tan z} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification61.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.4 \cdot 10^{-12}:\\ \;\;\;\;x + \frac{\sin y}{\cos y}\\ \mathbf{else}:\\ \;\;\;\;\tan z + \left(x - \tan a\right)\\ \end{array} \]

Alternative 9: 79.0% accurate, 1.0× speedup?

\[x + \left(\tan \left(y + z\right) - \tan a\right) \]
Derivation
  1. Initial program 75.8%

    \[x + \left(\tan \left(y + z\right) - \tan a\right) \]
  2. Final simplification75.8%

    \[\leadsto x + \left(\tan \left(y + z\right) - \tan a\right) \]

Alternative 10: 59.5% accurate, 1.9× speedup?

\[\begin{array}{l} \mathbf{if}\;a \leq -0.048 \lor \neg \left(a \leq 8 \cdot 10^{-28}\right):\\ \;\;\;\;\frac{1}{\frac{1}{x}} - \tan a\\ \mathbf{else}:\\ \;\;\;\;\tan \left(y + z\right) + \left(x - a\right)\\ \end{array} \]
Derivation
  1. Split input into 2 regimes
  2. if a < -0.048000000000000001 or 7.99999999999999977e-28 < a

    1. Initial program 76.3%

      \[x + \left(\tan \left(y + z\right) - \tan a\right) \]
    2. Step-by-step derivation
      1. associate-+r-76.1%

        \[\leadsto \color{blue}{\left(x + \tan \left(y + z\right)\right) - \tan a} \]
    3. Simplified76.1%

      \[\leadsto \color{blue}{\left(x + \tan \left(y + z\right)\right) - \tan a} \]
    4. Step-by-step derivation
      1. flip-+76.0%

        \[\leadsto \color{blue}{\frac{x \cdot x - \tan \left(y + z\right) \cdot \tan \left(y + z\right)}{x - \tan \left(y + z\right)}} - \tan a \]
      2. clear-num75.9%

        \[\leadsto \color{blue}{\frac{1}{\frac{x - \tan \left(y + z\right)}{x \cdot x - \tan \left(y + z\right) \cdot \tan \left(y + z\right)}}} - \tan a \]
      3. pow275.9%

        \[\leadsto \frac{1}{\frac{x - \tan \left(y + z\right)}{x \cdot x - \color{blue}{{\tan \left(y + z\right)}^{2}}}} - \tan a \]
    5. Applied egg-rr75.9%

      \[\leadsto \color{blue}{\frac{1}{\frac{x - \tan \left(y + z\right)}{x \cdot x - {\tan \left(y + z\right)}^{2}}}} - \tan a \]
    6. Taylor expanded in x around inf 43.6%

      \[\leadsto \frac{1}{\color{blue}{\frac{1}{x}}} - \tan a \]

    if -0.048000000000000001 < a < 7.99999999999999977e-28

    1. Initial program 75.4%

      \[x + \left(\tan \left(y + z\right) - \tan a\right) \]
    2. Step-by-step derivation
      1. +-commutative75.4%

        \[\leadsto \color{blue}{\left(\tan \left(y + z\right) - \tan a\right) + x} \]
      2. associate-+l-75.3%

        \[\leadsto \color{blue}{\tan \left(y + z\right) - \left(\tan a - x\right)} \]
    3. Applied egg-rr75.3%

      \[\leadsto \color{blue}{\tan \left(y + z\right) - \left(\tan a - x\right)} \]
    4. Taylor expanded in a around 0 75.2%

      \[\leadsto \tan \left(y + z\right) - \color{blue}{\left(a + -1 \cdot x\right)} \]
    5. Step-by-step derivation
      1. neg-mul-175.2%

        \[\leadsto \tan \left(y + z\right) - \left(a + \color{blue}{\left(-x\right)}\right) \]
      2. unsub-neg75.2%

        \[\leadsto \tan \left(y + z\right) - \color{blue}{\left(a - x\right)} \]
    6. Simplified75.2%

      \[\leadsto \tan \left(y + z\right) - \color{blue}{\left(a - x\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification58.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -0.048 \lor \neg \left(a \leq 8 \cdot 10^{-28}\right):\\ \;\;\;\;\frac{1}{\frac{1}{x}} - \tan a\\ \mathbf{else}:\\ \;\;\;\;\tan \left(y + z\right) + \left(x - a\right)\\ \end{array} \]

Alternative 11: 50.3% accurate, 2.0× speedup?

\[x + \tan \left(y + z\right) \]
Derivation
  1. Initial program 75.8%

    \[x + \left(\tan \left(y + z\right) - \tan a\right) \]
  2. Step-by-step derivation
    1. +-commutative75.8%

      \[\leadsto \color{blue}{\left(\tan \left(y + z\right) - \tan a\right) + x} \]
    2. associate-+l-75.8%

      \[\leadsto \color{blue}{\tan \left(y + z\right) - \left(\tan a - x\right)} \]
  3. Applied egg-rr75.8%

    \[\leadsto \color{blue}{\tan \left(y + z\right) - \left(\tan a - x\right)} \]
  4. Taylor expanded in a around 0 47.9%

    \[\leadsto \tan \left(y + z\right) - \color{blue}{-1 \cdot x} \]
  5. Step-by-step derivation
    1. neg-mul-147.9%

      \[\leadsto \tan \left(y + z\right) - \color{blue}{\left(-x\right)} \]
  6. Simplified47.9%

    \[\leadsto \tan \left(y + z\right) - \color{blue}{\left(-x\right)} \]
  7. Step-by-step derivation
    1. sub-neg47.9%

      \[\leadsto \color{blue}{\tan \left(y + z\right) + \left(-\left(-x\right)\right)} \]
  8. Applied egg-rr47.9%

    \[\leadsto \color{blue}{\tan \left(y + z\right) + \left(-\left(-x\right)\right)} \]
  9. Step-by-step derivation
    1. remove-double-neg47.9%

      \[\leadsto \tan \left(y + z\right) + \color{blue}{x} \]
    2. +-commutative47.9%

      \[\leadsto \color{blue}{x + \tan \left(y + z\right)} \]
    3. +-commutative47.9%

      \[\leadsto x + \tan \color{blue}{\left(z + y\right)} \]
  10. Simplified47.9%

    \[\leadsto \color{blue}{x + \tan \left(z + y\right)} \]
  11. Final simplification47.9%

    \[\leadsto x + \tan \left(y + z\right) \]

Alternative 12: 31.9% accurate, 207.0× speedup?

\[x \]
Derivation
  1. Initial program 75.8%

    \[x + \left(\tan \left(y + z\right) - \tan a\right) \]
  2. Taylor expanded in x around inf 29.1%

    \[\leadsto \color{blue}{x} \]
  3. Final simplification29.1%

    \[\leadsto x \]

Reproduce

?
herbie shell --seed 2023167 
(FPCore (x y z a)
  :name "tan-example (used to crash)"
  :precision binary64
  :pre (and (and (and (or (== x 0.0) (and (<= 0.5884142 x) (<= x 505.5909))) (or (and (<= -1.796658e+308 y) (<= y -9.425585e-310)) (and (<= 1.284938e-309 y) (<= y 1.751224e+308)))) (or (and (<= -1.776707e+308 z) (<= z -8.599796e-310)) (and (<= 3.293145e-311 z) (<= z 1.725154e+308)))) (or (and (<= -1.796658e+308 a) (<= a -9.425585e-310)) (and (<= 1.284938e-309 a) (<= a 1.751224e+308))))
  (+ x (- (tan (+ y z)) (tan a))))