symmetry log of sum of exp

Percentage Accurate: 54.1% → 98.7%
Time: 14.0s
Alternatives: 13
Speedup: TODO×

Specification

?
\[\log \left(e^{a} + e^{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 13 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?

\[\begin{array}{l} \mathbf{if}\;e^{a} \leq 0:\\ \;\;\;\;\frac{b}{e^{a} + 1}\\ \mathbf{else}:\\ \;\;\;\;\log \left(e^{a} + e^{b}\right)\\ \end{array} \]
Derivation
  1. Split input into 2 regimes
  2. if (exp.f64 a) < 0.0

    1. Initial program 9.6%

      \[\log \left(e^{a} + e^{b}\right) \]
    2. Taylor expanded in b around 0 100.0%

      \[\leadsto \color{blue}{\log \left(1 + e^{a}\right) + \frac{b}{1 + e^{a}}} \]
    3. Step-by-step derivation
      1. log1p-def100.0%

        \[\leadsto \color{blue}{\mathsf{log1p}\left(e^{a}\right)} + \frac{b}{1 + e^{a}} \]
    4. Simplified100.0%

      \[\leadsto \color{blue}{\mathsf{log1p}\left(e^{a}\right) + \frac{b}{1 + e^{a}}} \]
    5. Taylor expanded in a around 0 6.5%

      \[\leadsto \color{blue}{\log 2} + \frac{b}{1 + e^{a}} \]
    6. Taylor expanded in b around inf 100.0%

      \[\leadsto \color{blue}{\frac{b}{1 + e^{a}}} \]

    if 0.0 < (exp.f64 a)

    1. Initial program 65.7%

      \[\log \left(e^{a} + e^{b}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification74.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;e^{a} \leq 0:\\ \;\;\;\;\frac{b}{e^{a} + 1}\\ \mathbf{else}:\\ \;\;\;\;\log \left(e^{a} + e^{b}\right)\\ \end{array} \]

Alternative 2?

\[\begin{array}{l} \mathbf{if}\;e^{a} \leq 0:\\ \;\;\;\;\frac{b}{e^{a} + 1}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{log1p}\left(e^{a}\right) + \frac{b}{2}\\ \end{array} \]
Derivation
  1. Split input into 2 regimes
  2. if (exp.f64 a) < 0.0

    1. Initial program 9.6%

      \[\log \left(e^{a} + e^{b}\right) \]
    2. Taylor expanded in b around 0 100.0%

      \[\leadsto \color{blue}{\log \left(1 + e^{a}\right) + \frac{b}{1 + e^{a}}} \]
    3. Step-by-step derivation
      1. log1p-def100.0%

        \[\leadsto \color{blue}{\mathsf{log1p}\left(e^{a}\right)} + \frac{b}{1 + e^{a}} \]
    4. Simplified100.0%

      \[\leadsto \color{blue}{\mathsf{log1p}\left(e^{a}\right) + \frac{b}{1 + e^{a}}} \]
    5. Taylor expanded in a around 0 6.5%

      \[\leadsto \color{blue}{\log 2} + \frac{b}{1 + e^{a}} \]
    6. Taylor expanded in b around inf 100.0%

      \[\leadsto \color{blue}{\frac{b}{1 + e^{a}}} \]

    if 0.0 < (exp.f64 a)

    1. Initial program 65.7%

      \[\log \left(e^{a} + e^{b}\right) \]
    2. Taylor expanded in b around 0 61.6%

      \[\leadsto \color{blue}{\log \left(1 + e^{a}\right) + \frac{b}{1 + e^{a}}} \]
    3. Step-by-step derivation
      1. log1p-def62.6%

        \[\leadsto \color{blue}{\mathsf{log1p}\left(e^{a}\right)} + \frac{b}{1 + e^{a}} \]
    4. Simplified62.6%

      \[\leadsto \color{blue}{\mathsf{log1p}\left(e^{a}\right) + \frac{b}{1 + e^{a}}} \]
    5. Taylor expanded in a around 0 62.6%

      \[\leadsto \mathsf{log1p}\left(e^{a}\right) + \frac{b}{\color{blue}{2}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification72.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;e^{a} \leq 0:\\ \;\;\;\;\frac{b}{e^{a} + 1}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{log1p}\left(e^{a}\right) + \frac{b}{2}\\ \end{array} \]

Alternative 3?

\[\mathsf{log1p}\left(e^{a}\right) + \frac{b}{e^{a} + 1} \]
Derivation
  1. Initial program 51.7%

    \[\log \left(e^{a} + e^{b}\right) \]
  2. Taylor expanded in b around 0 71.2%

    \[\leadsto \color{blue}{\log \left(1 + e^{a}\right) + \frac{b}{1 + e^{a}}} \]
  3. Step-by-step derivation
    1. log1p-def72.0%

      \[\leadsto \color{blue}{\mathsf{log1p}\left(e^{a}\right)} + \frac{b}{1 + e^{a}} \]
  4. Simplified72.0%

    \[\leadsto \color{blue}{\mathsf{log1p}\left(e^{a}\right) + \frac{b}{1 + e^{a}}} \]
  5. Final simplification72.0%

    \[\leadsto \mathsf{log1p}\left(e^{a}\right) + \frac{b}{e^{a} + 1} \]

Alternative 4?

\[\begin{array}{l} \mathbf{if}\;e^{a} \leq 0:\\ \;\;\;\;\frac{b}{e^{a} + 1}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{log1p}\left(e^{a} + b\right)\\ \end{array} \]
Derivation
  1. Split input into 2 regimes
  2. if (exp.f64 a) < 0.0

    1. Initial program 9.6%

      \[\log \left(e^{a} + e^{b}\right) \]
    2. Taylor expanded in b around 0 100.0%

      \[\leadsto \color{blue}{\log \left(1 + e^{a}\right) + \frac{b}{1 + e^{a}}} \]
    3. Step-by-step derivation
      1. log1p-def100.0%

        \[\leadsto \color{blue}{\mathsf{log1p}\left(e^{a}\right)} + \frac{b}{1 + e^{a}} \]
    4. Simplified100.0%

      \[\leadsto \color{blue}{\mathsf{log1p}\left(e^{a}\right) + \frac{b}{1 + e^{a}}} \]
    5. Taylor expanded in a around 0 6.5%

      \[\leadsto \color{blue}{\log 2} + \frac{b}{1 + e^{a}} \]
    6. Taylor expanded in b around inf 100.0%

      \[\leadsto \color{blue}{\frac{b}{1 + e^{a}}} \]

    if 0.0 < (exp.f64 a)

    1. Initial program 65.7%

      \[\log \left(e^{a} + e^{b}\right) \]
    2. Taylor expanded in b around 0 60.6%

      \[\leadsto \log \color{blue}{\left(1 + \left(e^{a} + b\right)\right)} \]
    3. Step-by-step derivation
      1. associate-+r+60.6%

        \[\leadsto \log \color{blue}{\left(\left(1 + e^{a}\right) + b\right)} \]
      2. +-commutative60.6%

        \[\leadsto \log \left(\color{blue}{\left(e^{a} + 1\right)} + b\right) \]
      3. associate-+l+60.6%

        \[\leadsto \log \color{blue}{\left(e^{a} + \left(1 + b\right)\right)} \]
    4. Simplified60.6%

      \[\leadsto \log \color{blue}{\left(e^{a} + \left(1 + b\right)\right)} \]
    5. Taylor expanded in a around inf 60.6%

      \[\leadsto \color{blue}{\log \left(1 + \left(e^{a} + b\right)\right)} \]
    6. Step-by-step derivation
      1. log1p-def61.6%

        \[\leadsto \color{blue}{\mathsf{log1p}\left(e^{a} + b\right)} \]
    7. Simplified61.6%

      \[\leadsto \color{blue}{\mathsf{log1p}\left(e^{a} + b\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification71.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;e^{a} \leq 0:\\ \;\;\;\;\frac{b}{e^{a} + 1}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{log1p}\left(e^{a} + b\right)\\ \end{array} \]

Alternative 5?

\[\begin{array}{l} \mathbf{if}\;e^{a} \leq 0:\\ \;\;\;\;\frac{b}{e^{a} + 1}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{log1p}\left(e^{a}\right)\\ \end{array} \]
Derivation
  1. Split input into 2 regimes
  2. if (exp.f64 a) < 0.0

    1. Initial program 9.6%

      \[\log \left(e^{a} + e^{b}\right) \]
    2. Taylor expanded in b around 0 100.0%

      \[\leadsto \color{blue}{\log \left(1 + e^{a}\right) + \frac{b}{1 + e^{a}}} \]
    3. Step-by-step derivation
      1. log1p-def100.0%

        \[\leadsto \color{blue}{\mathsf{log1p}\left(e^{a}\right)} + \frac{b}{1 + e^{a}} \]
    4. Simplified100.0%

      \[\leadsto \color{blue}{\mathsf{log1p}\left(e^{a}\right) + \frac{b}{1 + e^{a}}} \]
    5. Taylor expanded in a around 0 6.5%

      \[\leadsto \color{blue}{\log 2} + \frac{b}{1 + e^{a}} \]
    6. Taylor expanded in b around inf 100.0%

      \[\leadsto \color{blue}{\frac{b}{1 + e^{a}}} \]

    if 0.0 < (exp.f64 a)

    1. Initial program 65.7%

      \[\log \left(e^{a} + e^{b}\right) \]
    2. Taylor expanded in b around 0 61.0%

      \[\leadsto \color{blue}{\log \left(1 + e^{a}\right)} \]
    3. Step-by-step derivation
      1. log1p-def62.0%

        \[\leadsto \color{blue}{\mathsf{log1p}\left(e^{a}\right)} \]
    4. Simplified62.0%

      \[\leadsto \color{blue}{\mathsf{log1p}\left(e^{a}\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification71.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;e^{a} \leq 0:\\ \;\;\;\;\frac{b}{e^{a} + 1}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{log1p}\left(e^{a}\right)\\ \end{array} \]

Alternative 6?

\[\begin{array}{l} \mathbf{if}\;e^{a} \leq 0:\\ \;\;\;\;\frac{b}{e^{a} + 1}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{log1p}\left(e^{b}\right)\\ \end{array} \]
Derivation
  1. Split input into 2 regimes
  2. if (exp.f64 a) < 0.0

    1. Initial program 9.6%

      \[\log \left(e^{a} + e^{b}\right) \]
    2. Taylor expanded in b around 0 100.0%

      \[\leadsto \color{blue}{\log \left(1 + e^{a}\right) + \frac{b}{1 + e^{a}}} \]
    3. Step-by-step derivation
      1. log1p-def100.0%

        \[\leadsto \color{blue}{\mathsf{log1p}\left(e^{a}\right)} + \frac{b}{1 + e^{a}} \]
    4. Simplified100.0%

      \[\leadsto \color{blue}{\mathsf{log1p}\left(e^{a}\right) + \frac{b}{1 + e^{a}}} \]
    5. Taylor expanded in a around 0 6.5%

      \[\leadsto \color{blue}{\log 2} + \frac{b}{1 + e^{a}} \]
    6. Taylor expanded in b around inf 100.0%

      \[\leadsto \color{blue}{\frac{b}{1 + e^{a}}} \]

    if 0.0 < (exp.f64 a)

    1. Initial program 65.7%

      \[\log \left(e^{a} + e^{b}\right) \]
    2. Taylor expanded in a around 0 63.9%

      \[\leadsto \color{blue}{\log \left(1 + e^{b}\right)} \]
    3. Step-by-step derivation
      1. log1p-def63.9%

        \[\leadsto \color{blue}{\mathsf{log1p}\left(e^{b}\right)} \]
    4. Simplified63.9%

      \[\leadsto \color{blue}{\mathsf{log1p}\left(e^{b}\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification72.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;e^{a} \leq 0:\\ \;\;\;\;\frac{b}{e^{a} + 1}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{log1p}\left(e^{b}\right)\\ \end{array} \]

Alternative 7?

\[\mathsf{log1p}\left(e^{a} + \mathsf{expm1}\left(b\right)\right) \]
Derivation
  1. Initial program 51.7%

    \[\log \left(e^{a} + e^{b}\right) \]
  2. Step-by-step derivation
    1. add-sqr-sqrt50.6%

      \[\leadsto \log \color{blue}{\left(\sqrt{e^{a} + e^{b}} \cdot \sqrt{e^{a} + e^{b}}\right)} \]
    2. log-prod51.0%

      \[\leadsto \color{blue}{\log \left(\sqrt{e^{a} + e^{b}}\right) + \log \left(\sqrt{e^{a} + e^{b}}\right)} \]
  3. Applied egg-rr51.0%

    \[\leadsto \color{blue}{\log \left(\sqrt{e^{a} + e^{b}}\right) + \log \left(\sqrt{e^{a} + e^{b}}\right)} \]
  4. Step-by-step derivation
    1. log-prod50.6%

      \[\leadsto \color{blue}{\log \left(\sqrt{e^{a} + e^{b}} \cdot \sqrt{e^{a} + e^{b}}\right)} \]
    2. rem-square-sqrt51.7%

      \[\leadsto \log \color{blue}{\left(e^{a} + e^{b}\right)} \]
    3. log1p-expm151.7%

      \[\leadsto \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\log \left(e^{a} + e^{b}\right)\right)\right)} \]
    4. expm1-def51.7%

      \[\leadsto \mathsf{log1p}\left(\color{blue}{e^{\log \left(e^{a} + e^{b}\right)} - 1}\right) \]
    5. rem-exp-log51.7%

      \[\leadsto \mathsf{log1p}\left(\color{blue}{\left(e^{a} + e^{b}\right)} - 1\right) \]
    6. associate--l+52.4%

      \[\leadsto \mathsf{log1p}\left(\color{blue}{e^{a} + \left(e^{b} - 1\right)}\right) \]
    7. expm1-def73.9%

      \[\leadsto \mathsf{log1p}\left(e^{a} + \color{blue}{\mathsf{expm1}\left(b\right)}\right) \]
  5. Simplified73.9%

    \[\leadsto \color{blue}{\mathsf{log1p}\left(e^{a} + \mathsf{expm1}\left(b\right)\right)} \]
  6. Final simplification73.9%

    \[\leadsto \mathsf{log1p}\left(e^{a} + \mathsf{expm1}\left(b\right)\right) \]

Alternative 8?

\[\begin{array}{l} \mathbf{if}\;e^{a} \leq 0:\\ \;\;\;\;\frac{b}{e^{a} + 1}\\ \mathbf{else}:\\ \;\;\;\;b \cdot 0.5 + \log 2\\ \end{array} \]
Derivation
  1. Split input into 2 regimes
  2. if (exp.f64 a) < 0.0

    1. Initial program 9.6%

      \[\log \left(e^{a} + e^{b}\right) \]
    2. Taylor expanded in b around 0 100.0%

      \[\leadsto \color{blue}{\log \left(1 + e^{a}\right) + \frac{b}{1 + e^{a}}} \]
    3. Step-by-step derivation
      1. log1p-def100.0%

        \[\leadsto \color{blue}{\mathsf{log1p}\left(e^{a}\right)} + \frac{b}{1 + e^{a}} \]
    4. Simplified100.0%

      \[\leadsto \color{blue}{\mathsf{log1p}\left(e^{a}\right) + \frac{b}{1 + e^{a}}} \]
    5. Taylor expanded in a around 0 6.5%

      \[\leadsto \color{blue}{\log 2} + \frac{b}{1 + e^{a}} \]
    6. Taylor expanded in b around inf 100.0%

      \[\leadsto \color{blue}{\frac{b}{1 + e^{a}}} \]

    if 0.0 < (exp.f64 a)

    1. Initial program 65.7%

      \[\log \left(e^{a} + e^{b}\right) \]
    2. Taylor expanded in a around 0 63.9%

      \[\leadsto \color{blue}{\log \left(1 + e^{b}\right)} \]
    3. Taylor expanded in b around 0 61.3%

      \[\leadsto \color{blue}{0.5 \cdot b + \log 2} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification71.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;e^{a} \leq 0:\\ \;\;\;\;\frac{b}{e^{a} + 1}\\ \mathbf{else}:\\ \;\;\;\;b \cdot 0.5 + \log 2\\ \end{array} \]

Alternative 9?

\[\begin{array}{l} \mathbf{if}\;a \leq -125:\\ \;\;\;\;b \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;b \cdot 0.5 + \log 2\\ \end{array} \]
Derivation
  1. Split input into 2 regimes
  2. if a < -125

    1. Initial program 9.6%

      \[\log \left(e^{a} + e^{b}\right) \]
    2. Taylor expanded in a around 0 5.5%

      \[\leadsto \color{blue}{\log \left(1 + e^{b}\right)} \]
    3. Taylor expanded in b around 0 5.1%

      \[\leadsto \color{blue}{0.5 \cdot b + \log 2} \]
    4. Taylor expanded in b around inf 18.8%

      \[\leadsto \color{blue}{0.5 \cdot b} \]

    if -125 < a

    1. Initial program 65.7%

      \[\log \left(e^{a} + e^{b}\right) \]
    2. Taylor expanded in a around 0 63.9%

      \[\leadsto \color{blue}{\log \left(1 + e^{b}\right)} \]
    3. Taylor expanded in b around 0 61.3%

      \[\leadsto \color{blue}{0.5 \cdot b + \log 2} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification50.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -125:\\ \;\;\;\;b \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;b \cdot 0.5 + \log 2\\ \end{array} \]

Alternative 10?

\[\begin{array}{l} \mathbf{if}\;a \leq -155:\\ \;\;\;\;b \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;\log \left(b + 2\right)\\ \end{array} \]
Derivation
  1. Split input into 2 regimes
  2. if a < -155

    1. Initial program 9.6%

      \[\log \left(e^{a} + e^{b}\right) \]
    2. Taylor expanded in a around 0 5.5%

      \[\leadsto \color{blue}{\log \left(1 + e^{b}\right)} \]
    3. Taylor expanded in b around 0 5.1%

      \[\leadsto \color{blue}{0.5 \cdot b + \log 2} \]
    4. Taylor expanded in b around inf 18.8%

      \[\leadsto \color{blue}{0.5 \cdot b} \]

    if -155 < a

    1. Initial program 65.7%

      \[\log \left(e^{a} + e^{b}\right) \]
    2. Taylor expanded in a around 0 63.9%

      \[\leadsto \color{blue}{\log \left(1 + e^{b}\right)} \]
    3. Taylor expanded in b around 0 60.3%

      \[\leadsto \log \color{blue}{\left(2 + b\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification49.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -155:\\ \;\;\;\;b \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;\log \left(b + 2\right)\\ \end{array} \]

Alternative 11?

\[\begin{array}{l} \mathbf{if}\;a \leq -96:\\ \;\;\;\;b \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;\mathsf{log1p}\left(b + 1\right)\\ \end{array} \]
Derivation
  1. Split input into 2 regimes
  2. if a < -96

    1. Initial program 9.6%

      \[\log \left(e^{a} + e^{b}\right) \]
    2. Taylor expanded in a around 0 5.5%

      \[\leadsto \color{blue}{\log \left(1 + e^{b}\right)} \]
    3. Taylor expanded in b around 0 5.1%

      \[\leadsto \color{blue}{0.5 \cdot b + \log 2} \]
    4. Taylor expanded in b around inf 18.8%

      \[\leadsto \color{blue}{0.5 \cdot b} \]

    if -96 < a

    1. Initial program 65.7%

      \[\log \left(e^{a} + e^{b}\right) \]
    2. Taylor expanded in b around 0 60.6%

      \[\leadsto \log \color{blue}{\left(1 + \left(e^{a} + b\right)\right)} \]
    3. Step-by-step derivation
      1. associate-+r+60.6%

        \[\leadsto \log \color{blue}{\left(\left(1 + e^{a}\right) + b\right)} \]
      2. +-commutative60.6%

        \[\leadsto \log \left(\color{blue}{\left(e^{a} + 1\right)} + b\right) \]
      3. associate-+l+60.6%

        \[\leadsto \log \color{blue}{\left(e^{a} + \left(1 + b\right)\right)} \]
    4. Simplified60.6%

      \[\leadsto \log \color{blue}{\left(e^{a} + \left(1 + b\right)\right)} \]
    5. Taylor expanded in a around inf 60.6%

      \[\leadsto \color{blue}{\log \left(1 + \left(e^{a} + b\right)\right)} \]
    6. Step-by-step derivation
      1. log1p-def61.6%

        \[\leadsto \color{blue}{\mathsf{log1p}\left(e^{a} + b\right)} \]
    7. Simplified61.6%

      \[\leadsto \color{blue}{\mathsf{log1p}\left(e^{a} + b\right)} \]
    8. Taylor expanded in a around 0 60.3%

      \[\leadsto \mathsf{log1p}\left(\color{blue}{1 + b}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification49.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -96:\\ \;\;\;\;b \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;\mathsf{log1p}\left(b + 1\right)\\ \end{array} \]

Alternative 12?

\[\begin{array}{l} \mathbf{if}\;a \leq -105:\\ \;\;\;\;b \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;\log 2\\ \end{array} \]
Derivation
  1. Split input into 2 regimes
  2. if a < -105

    1. Initial program 9.6%

      \[\log \left(e^{a} + e^{b}\right) \]
    2. Taylor expanded in a around 0 5.5%

      \[\leadsto \color{blue}{\log \left(1 + e^{b}\right)} \]
    3. Taylor expanded in b around 0 5.1%

      \[\leadsto \color{blue}{0.5 \cdot b + \log 2} \]
    4. Taylor expanded in b around inf 18.8%

      \[\leadsto \color{blue}{0.5 \cdot b} \]

    if -105 < a

    1. Initial program 65.7%

      \[\log \left(e^{a} + e^{b}\right) \]
    2. Taylor expanded in b around 0 61.0%

      \[\leadsto \color{blue}{\log \left(1 + e^{a}\right)} \]
    3. Step-by-step derivation
      1. log1p-def62.0%

        \[\leadsto \color{blue}{\mathsf{log1p}\left(e^{a}\right)} \]
    4. Simplified62.0%

      \[\leadsto \color{blue}{\mathsf{log1p}\left(e^{a}\right)} \]
    5. Taylor expanded in a around 0 60.7%

      \[\leadsto \color{blue}{\log 2} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification50.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \leq -105:\\ \;\;\;\;b \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;\log 2\\ \end{array} \]

Alternative 13?

\[b \cdot 0.5 \]
Derivation
  1. Initial program 51.7%

    \[\log \left(e^{a} + e^{b}\right) \]
  2. Taylor expanded in a around 0 49.3%

    \[\leadsto \color{blue}{\log \left(1 + e^{b}\right)} \]
  3. Taylor expanded in b around 0 47.2%

    \[\leadsto \color{blue}{0.5 \cdot b + \log 2} \]
  4. Taylor expanded in b around inf 7.4%

    \[\leadsto \color{blue}{0.5 \cdot b} \]
  5. Final simplification7.4%

    \[\leadsto b \cdot 0.5 \]

Reproduce

?
herbie shell --seed 2023166 
(FPCore (a b)
  :name "symmetry log of sum of exp"
  :precision binary64
  (log (+ (exp a) (exp b))))