Logarithmic Transform

Percentage Accurate: 42.1% → 98.7%
Time: 11.3s
Alternatives: 8
Speedup: 19.8×

Specification

?
\[\begin{array}{l} \\ c \cdot \log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right) \end{array} \]
(FPCore (c x y)
 :precision binary64
 (* c (log (+ 1.0 (* (- (pow (E) x) 1.0) y)))))
\begin{array}{l}

\\
c \cdot \log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\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 8 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: 42.1% accurate, 1.0× speedup?

\[\begin{array}{l} \\ c \cdot \log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right) \end{array} \]
(FPCore (c x y)
 :precision binary64
 (* c (log (+ 1.0 (* (- (pow (E) x) 1.0) y)))))
\begin{array}{l}

\\
c \cdot \log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right)
\end{array}

Alternative 1: 98.7% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1 \cdot 10^{-39}:\\ \;\;\;\;\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(x\right)\right) \cdot c\\ \mathbf{elif}\;y \leq 2200000000:\\ \;\;\;\;\frac{\mathsf{expm1}\left(x \cdot 3\right) \cdot \left(c \cdot y\right)}{\mathsf{fma}\left(e^{x}, e^{x}, e^{x} + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{log1p}\left(y \cdot \left(\mathsf{fma}\left(0.5, x, 1\right) \cdot x\right)\right) \cdot c\\ \end{array} \end{array} \]
(FPCore (c x y)
 :precision binary64
 (if (<= y -1e-39)
   (* (log1p (* y (expm1 x))) c)
   (if (<= y 2200000000.0)
     (/ (* (expm1 (* x 3.0)) (* c y)) (fma (exp x) (exp x) (+ (exp x) 1.0)))
     (* (log1p (* y (* (fma 0.5 x 1.0) x))) c))))
double code(double c, double x, double y) {
	double tmp;
	if (y <= -1e-39) {
		tmp = log1p((y * expm1(x))) * c;
	} else if (y <= 2200000000.0) {
		tmp = (expm1((x * 3.0)) * (c * y)) / fma(exp(x), exp(x), (exp(x) + 1.0));
	} else {
		tmp = log1p((y * (fma(0.5, x, 1.0) * x))) * c;
	}
	return tmp;
}
function code(c, x, y)
	tmp = 0.0
	if (y <= -1e-39)
		tmp = Float64(log1p(Float64(y * expm1(x))) * c);
	elseif (y <= 2200000000.0)
		tmp = Float64(Float64(expm1(Float64(x * 3.0)) * Float64(c * y)) / fma(exp(x), exp(x), Float64(exp(x) + 1.0)));
	else
		tmp = Float64(log1p(Float64(y * Float64(fma(0.5, x, 1.0) * x))) * c);
	end
	return tmp
end
code[c_, x_, y_] := If[LessEqual[y, -1e-39], N[(N[Log[1 + N[(y * N[(Exp[x] - 1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * c), $MachinePrecision], If[LessEqual[y, 2200000000.0], N[(N[(N[(Exp[N[(x * 3.0), $MachinePrecision]] - 1), $MachinePrecision] * N[(c * y), $MachinePrecision]), $MachinePrecision] / N[(N[Exp[x], $MachinePrecision] * N[Exp[x], $MachinePrecision] + N[(N[Exp[x], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Log[1 + N[(y * N[(N[(0.5 * x + 1.0), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * c), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \cdot 10^{-39}:\\
\;\;\;\;\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(x\right)\right) \cdot c\\

\mathbf{elif}\;y \leq 2200000000:\\
\;\;\;\;\frac{\mathsf{expm1}\left(x \cdot 3\right) \cdot \left(c \cdot y\right)}{\mathsf{fma}\left(e^{x}, e^{x}, e^{x} + 1\right)}\\

\mathbf{else}:\\
\;\;\;\;\mathsf{log1p}\left(y \cdot \left(\mathsf{fma}\left(0.5, x, 1\right) \cdot x\right)\right) \cdot c\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -9.99999999999999929e-40

    1. Initial program 42.8%

      \[c \cdot \log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \color{blue}{c \cdot \log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right)} \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{\log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right) \cdot c} \]
      3. lower-*.f6442.8

        \[\leadsto \color{blue}{\log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right) \cdot c} \]
      4. lift-log.f64N/A

        \[\leadsto \color{blue}{\log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right)} \cdot c \]
      5. lift-+.f64N/A

        \[\leadsto \log \color{blue}{\left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right)} \cdot c \]
      6. lower-log1p.f6448.6

        \[\leadsto \color{blue}{\mathsf{log1p}\left(\left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right)} \cdot c \]
      7. lift-*.f64N/A

        \[\leadsto \mathsf{log1p}\left(\color{blue}{\left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y}\right) \cdot c \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{log1p}\left(\color{blue}{y \cdot \left({\mathsf{E}\left(\right)}^{x} - 1\right)}\right) \cdot c \]
      9. lower-*.f6448.6

        \[\leadsto \mathsf{log1p}\left(\color{blue}{y \cdot \left({\mathsf{E}\left(\right)}^{x} - 1\right)}\right) \cdot c \]
      10. lift--.f64N/A

        \[\leadsto \mathsf{log1p}\left(y \cdot \color{blue}{\left({\mathsf{E}\left(\right)}^{x} - 1\right)}\right) \cdot c \]
      11. lift-pow.f64N/A

        \[\leadsto \mathsf{log1p}\left(y \cdot \left(\color{blue}{{\mathsf{E}\left(\right)}^{x}} - 1\right)\right) \cdot c \]
      12. pow-to-expN/A

        \[\leadsto \mathsf{log1p}\left(y \cdot \left(\color{blue}{e^{\log \mathsf{E}\left(\right) \cdot x}} - 1\right)\right) \cdot c \]
      13. lift-E.f64N/A

        \[\leadsto \mathsf{log1p}\left(y \cdot \left(e^{\log \color{blue}{\mathsf{E}\left(\right)} \cdot x} - 1\right)\right) \cdot c \]
      14. log-EN/A

        \[\leadsto \mathsf{log1p}\left(y \cdot \left(e^{\color{blue}{1} \cdot x} - 1\right)\right) \cdot c \]
      15. *-lft-identityN/A

        \[\leadsto \mathsf{log1p}\left(y \cdot \left(e^{\color{blue}{x}} - 1\right)\right) \cdot c \]
      16. lower-expm1.f6499.6

        \[\leadsto \mathsf{log1p}\left(y \cdot \color{blue}{\mathsf{expm1}\left(x\right)}\right) \cdot c \]
    4. Applied rewrites99.6%

      \[\leadsto \color{blue}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(x\right)\right) \cdot c} \]

    if -9.99999999999999929e-40 < y < 2.2e9

    1. Initial program 46.6%

      \[c \cdot \log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \color{blue}{c \cdot \log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right)} \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{\log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right) \cdot c} \]
      3. lower-*.f6446.6

        \[\leadsto \color{blue}{\log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right) \cdot c} \]
      4. lift-log.f64N/A

        \[\leadsto \color{blue}{\log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right)} \cdot c \]
      5. lift-+.f64N/A

        \[\leadsto \log \color{blue}{\left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right)} \cdot c \]
      6. lower-log1p.f6468.2

        \[\leadsto \color{blue}{\mathsf{log1p}\left(\left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right)} \cdot c \]
      7. lift-*.f64N/A

        \[\leadsto \mathsf{log1p}\left(\color{blue}{\left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y}\right) \cdot c \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{log1p}\left(\color{blue}{y \cdot \left({\mathsf{E}\left(\right)}^{x} - 1\right)}\right) \cdot c \]
      9. lower-*.f6468.2

        \[\leadsto \mathsf{log1p}\left(\color{blue}{y \cdot \left({\mathsf{E}\left(\right)}^{x} - 1\right)}\right) \cdot c \]
      10. lift--.f64N/A

        \[\leadsto \mathsf{log1p}\left(y \cdot \color{blue}{\left({\mathsf{E}\left(\right)}^{x} - 1\right)}\right) \cdot c \]
      11. lift-pow.f64N/A

        \[\leadsto \mathsf{log1p}\left(y \cdot \left(\color{blue}{{\mathsf{E}\left(\right)}^{x}} - 1\right)\right) \cdot c \]
      12. pow-to-expN/A

        \[\leadsto \mathsf{log1p}\left(y \cdot \left(\color{blue}{e^{\log \mathsf{E}\left(\right) \cdot x}} - 1\right)\right) \cdot c \]
      13. lift-E.f64N/A

        \[\leadsto \mathsf{log1p}\left(y \cdot \left(e^{\log \color{blue}{\mathsf{E}\left(\right)} \cdot x} - 1\right)\right) \cdot c \]
      14. log-EN/A

        \[\leadsto \mathsf{log1p}\left(y \cdot \left(e^{\color{blue}{1} \cdot x} - 1\right)\right) \cdot c \]
      15. *-lft-identityN/A

        \[\leadsto \mathsf{log1p}\left(y \cdot \left(e^{\color{blue}{x}} - 1\right)\right) \cdot c \]
      16. lower-expm1.f6490.1

        \[\leadsto \mathsf{log1p}\left(y \cdot \color{blue}{\mathsf{expm1}\left(x\right)}\right) \cdot c \]
    4. Applied rewrites90.1%

      \[\leadsto \color{blue}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(x\right)\right) \cdot c} \]
    5. Taylor expanded in y around 0

      \[\leadsto \color{blue}{c \cdot \left(y \cdot \left(e^{x} - 1\right)\right)} \]
    6. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{\left(y \cdot \left(e^{x} - 1\right)\right) \cdot c} \]
      2. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(y \cdot \left(e^{x} - 1\right)\right) \cdot c} \]
      3. *-commutativeN/A

        \[\leadsto \color{blue}{\left(\left(e^{x} - 1\right) \cdot y\right)} \cdot c \]
      4. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(\left(e^{x} - 1\right) \cdot y\right)} \cdot c \]
      5. lower-expm1.f6490.1

        \[\leadsto \left(\color{blue}{\mathsf{expm1}\left(x\right)} \cdot y\right) \cdot c \]
    7. Applied rewrites90.1%

      \[\leadsto \color{blue}{\left(\mathsf{expm1}\left(x\right) \cdot y\right) \cdot c} \]
    8. Step-by-step derivation
      1. Applied rewrites99.9%

        \[\leadsto \frac{\mathsf{expm1}\left(x \cdot 3\right) \cdot \left(c \cdot y\right)}{\color{blue}{\mathsf{fma}\left(e^{x}, e^{x}, e^{x} + 1\right)}} \]

      if 2.2e9 < y

      1. Initial program 12.2%

        \[c \cdot \log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right) \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. lift-*.f64N/A

          \[\leadsto \color{blue}{c \cdot \log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right)} \]
        2. *-commutativeN/A

          \[\leadsto \color{blue}{\log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right) \cdot c} \]
        3. lower-*.f6412.2

          \[\leadsto \color{blue}{\log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right) \cdot c} \]
        4. lift-log.f64N/A

          \[\leadsto \color{blue}{\log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right)} \cdot c \]
        5. lift-+.f64N/A

          \[\leadsto \log \color{blue}{\left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right)} \cdot c \]
        6. lower-log1p.f6412.2

          \[\leadsto \color{blue}{\mathsf{log1p}\left(\left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right)} \cdot c \]
        7. lift-*.f64N/A

          \[\leadsto \mathsf{log1p}\left(\color{blue}{\left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y}\right) \cdot c \]
        8. *-commutativeN/A

          \[\leadsto \mathsf{log1p}\left(\color{blue}{y \cdot \left({\mathsf{E}\left(\right)}^{x} - 1\right)}\right) \cdot c \]
        9. lower-*.f6412.2

          \[\leadsto \mathsf{log1p}\left(\color{blue}{y \cdot \left({\mathsf{E}\left(\right)}^{x} - 1\right)}\right) \cdot c \]
        10. lift--.f64N/A

          \[\leadsto \mathsf{log1p}\left(y \cdot \color{blue}{\left({\mathsf{E}\left(\right)}^{x} - 1\right)}\right) \cdot c \]
        11. lift-pow.f64N/A

          \[\leadsto \mathsf{log1p}\left(y \cdot \left(\color{blue}{{\mathsf{E}\left(\right)}^{x}} - 1\right)\right) \cdot c \]
        12. pow-to-expN/A

          \[\leadsto \mathsf{log1p}\left(y \cdot \left(\color{blue}{e^{\log \mathsf{E}\left(\right) \cdot x}} - 1\right)\right) \cdot c \]
        13. lift-E.f64N/A

          \[\leadsto \mathsf{log1p}\left(y \cdot \left(e^{\log \color{blue}{\mathsf{E}\left(\right)} \cdot x} - 1\right)\right) \cdot c \]
        14. log-EN/A

          \[\leadsto \mathsf{log1p}\left(y \cdot \left(e^{\color{blue}{1} \cdot x} - 1\right)\right) \cdot c \]
        15. *-lft-identityN/A

          \[\leadsto \mathsf{log1p}\left(y \cdot \left(e^{\color{blue}{x}} - 1\right)\right) \cdot c \]
        16. lower-expm1.f6499.5

          \[\leadsto \mathsf{log1p}\left(y \cdot \color{blue}{\mathsf{expm1}\left(x\right)}\right) \cdot c \]
      4. Applied rewrites99.5%

        \[\leadsto \color{blue}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(x\right)\right) \cdot c} \]
      5. Taylor expanded in x around 0

        \[\leadsto \mathsf{log1p}\left(y \cdot \color{blue}{\left(x \cdot \left(1 + \frac{1}{2} \cdot x\right)\right)}\right) \cdot c \]
      6. Step-by-step derivation
        1. *-commutativeN/A

          \[\leadsto \mathsf{log1p}\left(y \cdot \color{blue}{\left(\left(1 + \frac{1}{2} \cdot x\right) \cdot x\right)}\right) \cdot c \]
        2. lower-*.f64N/A

          \[\leadsto \mathsf{log1p}\left(y \cdot \color{blue}{\left(\left(1 + \frac{1}{2} \cdot x\right) \cdot x\right)}\right) \cdot c \]
        3. +-commutativeN/A

          \[\leadsto \mathsf{log1p}\left(y \cdot \left(\color{blue}{\left(\frac{1}{2} \cdot x + 1\right)} \cdot x\right)\right) \cdot c \]
        4. lower-fma.f6499.5

          \[\leadsto \mathsf{log1p}\left(y \cdot \left(\color{blue}{\mathsf{fma}\left(0.5, x, 1\right)} \cdot x\right)\right) \cdot c \]
      7. Applied rewrites99.5%

        \[\leadsto \mathsf{log1p}\left(y \cdot \color{blue}{\left(\mathsf{fma}\left(0.5, x, 1\right) \cdot x\right)}\right) \cdot c \]
    9. Recombined 3 regimes into one program.
    10. Add Preprocessing

    Alternative 2: 98.9% accurate, 0.6× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1 \cdot 10^{-39} \lor \neg \left(y \leq 9.2 \cdot 10^{-86}\right):\\ \;\;\;\;\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(x\right)\right) \cdot c\\ \mathbf{else}:\\ \;\;\;\;\left(c \cdot \frac{y}{\mathsf{fma}\left(1 + e^{x}, e^{x}, 1\right)}\right) \cdot \mathsf{expm1}\left(3 \cdot x\right)\\ \end{array} \end{array} \]
    (FPCore (c x y)
     :precision binary64
     (if (or (<= y -1e-39) (not (<= y 9.2e-86)))
       (* (log1p (* y (expm1 x))) c)
       (* (* c (/ y (fma (+ 1.0 (exp x)) (exp x) 1.0))) (expm1 (* 3.0 x)))))
    double code(double c, double x, double y) {
    	double tmp;
    	if ((y <= -1e-39) || !(y <= 9.2e-86)) {
    		tmp = log1p((y * expm1(x))) * c;
    	} else {
    		tmp = (c * (y / fma((1.0 + exp(x)), exp(x), 1.0))) * expm1((3.0 * x));
    	}
    	return tmp;
    }
    
    function code(c, x, y)
    	tmp = 0.0
    	if ((y <= -1e-39) || !(y <= 9.2e-86))
    		tmp = Float64(log1p(Float64(y * expm1(x))) * c);
    	else
    		tmp = Float64(Float64(c * Float64(y / fma(Float64(1.0 + exp(x)), exp(x), 1.0))) * expm1(Float64(3.0 * x)));
    	end
    	return tmp
    end
    
    code[c_, x_, y_] := If[Or[LessEqual[y, -1e-39], N[Not[LessEqual[y, 9.2e-86]], $MachinePrecision]], N[(N[Log[1 + N[(y * N[(Exp[x] - 1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * c), $MachinePrecision], N[(N[(c * N[(y / N[(N[(1.0 + N[Exp[x], $MachinePrecision]), $MachinePrecision] * N[Exp[x], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(Exp[N[(3.0 * x), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;y \leq -1 \cdot 10^{-39} \lor \neg \left(y \leq 9.2 \cdot 10^{-86}\right):\\
    \;\;\;\;\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(x\right)\right) \cdot c\\
    
    \mathbf{else}:\\
    \;\;\;\;\left(c \cdot \frac{y}{\mathsf{fma}\left(1 + e^{x}, e^{x}, 1\right)}\right) \cdot \mathsf{expm1}\left(3 \cdot x\right)\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if y < -9.99999999999999929e-40 or 9.19999999999999985e-86 < y

      1. Initial program 32.0%

        \[c \cdot \log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right) \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. lift-*.f64N/A

          \[\leadsto \color{blue}{c \cdot \log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right)} \]
        2. *-commutativeN/A

          \[\leadsto \color{blue}{\log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right) \cdot c} \]
        3. lower-*.f6432.0

          \[\leadsto \color{blue}{\log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right) \cdot c} \]
        4. lift-log.f64N/A

          \[\leadsto \color{blue}{\log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right)} \cdot c \]
        5. lift-+.f64N/A

          \[\leadsto \log \color{blue}{\left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right)} \cdot c \]
        6. lower-log1p.f6439.3

          \[\leadsto \color{blue}{\mathsf{log1p}\left(\left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right)} \cdot c \]
        7. lift-*.f64N/A

          \[\leadsto \mathsf{log1p}\left(\color{blue}{\left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y}\right) \cdot c \]
        8. *-commutativeN/A

          \[\leadsto \mathsf{log1p}\left(\color{blue}{y \cdot \left({\mathsf{E}\left(\right)}^{x} - 1\right)}\right) \cdot c \]
        9. lower-*.f6439.3

          \[\leadsto \mathsf{log1p}\left(\color{blue}{y \cdot \left({\mathsf{E}\left(\right)}^{x} - 1\right)}\right) \cdot c \]
        10. lift--.f64N/A

          \[\leadsto \mathsf{log1p}\left(y \cdot \color{blue}{\left({\mathsf{E}\left(\right)}^{x} - 1\right)}\right) \cdot c \]
        11. lift-pow.f64N/A

          \[\leadsto \mathsf{log1p}\left(y \cdot \left(\color{blue}{{\mathsf{E}\left(\right)}^{x}} - 1\right)\right) \cdot c \]
        12. pow-to-expN/A

          \[\leadsto \mathsf{log1p}\left(y \cdot \left(\color{blue}{e^{\log \mathsf{E}\left(\right) \cdot x}} - 1\right)\right) \cdot c \]
        13. lift-E.f64N/A

          \[\leadsto \mathsf{log1p}\left(y \cdot \left(e^{\log \color{blue}{\mathsf{E}\left(\right)} \cdot x} - 1\right)\right) \cdot c \]
        14. log-EN/A

          \[\leadsto \mathsf{log1p}\left(y \cdot \left(e^{\color{blue}{1} \cdot x} - 1\right)\right) \cdot c \]
        15. *-lft-identityN/A

          \[\leadsto \mathsf{log1p}\left(y \cdot \left(e^{\color{blue}{x}} - 1\right)\right) \cdot c \]
        16. lower-expm1.f6499.6

          \[\leadsto \mathsf{log1p}\left(y \cdot \color{blue}{\mathsf{expm1}\left(x\right)}\right) \cdot c \]
      4. Applied rewrites99.6%

        \[\leadsto \color{blue}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(x\right)\right) \cdot c} \]

      if -9.99999999999999929e-40 < y < 9.19999999999999985e-86

      1. Initial program 50.3%

        \[c \cdot \log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right) \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. lift-*.f64N/A

          \[\leadsto \color{blue}{c \cdot \log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right)} \]
        2. *-commutativeN/A

          \[\leadsto \color{blue}{\log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right) \cdot c} \]
        3. lower-*.f6450.3

          \[\leadsto \color{blue}{\log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right) \cdot c} \]
        4. lift-log.f64N/A

          \[\leadsto \color{blue}{\log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right)} \cdot c \]
        5. lift-+.f64N/A

          \[\leadsto \log \color{blue}{\left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right)} \cdot c \]
        6. lower-log1p.f6471.9

          \[\leadsto \color{blue}{\mathsf{log1p}\left(\left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right)} \cdot c \]
        7. lift-*.f64N/A

          \[\leadsto \mathsf{log1p}\left(\color{blue}{\left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y}\right) \cdot c \]
        8. *-commutativeN/A

          \[\leadsto \mathsf{log1p}\left(\color{blue}{y \cdot \left({\mathsf{E}\left(\right)}^{x} - 1\right)}\right) \cdot c \]
        9. lower-*.f6471.9

          \[\leadsto \mathsf{log1p}\left(\color{blue}{y \cdot \left({\mathsf{E}\left(\right)}^{x} - 1\right)}\right) \cdot c \]
        10. lift--.f64N/A

          \[\leadsto \mathsf{log1p}\left(y \cdot \color{blue}{\left({\mathsf{E}\left(\right)}^{x} - 1\right)}\right) \cdot c \]
        11. lift-pow.f64N/A

          \[\leadsto \mathsf{log1p}\left(y \cdot \left(\color{blue}{{\mathsf{E}\left(\right)}^{x}} - 1\right)\right) \cdot c \]
        12. pow-to-expN/A

          \[\leadsto \mathsf{log1p}\left(y \cdot \left(\color{blue}{e^{\log \mathsf{E}\left(\right) \cdot x}} - 1\right)\right) \cdot c \]
        13. lift-E.f64N/A

          \[\leadsto \mathsf{log1p}\left(y \cdot \left(e^{\log \color{blue}{\mathsf{E}\left(\right)} \cdot x} - 1\right)\right) \cdot c \]
        14. log-EN/A

          \[\leadsto \mathsf{log1p}\left(y \cdot \left(e^{\color{blue}{1} \cdot x} - 1\right)\right) \cdot c \]
        15. *-lft-identityN/A

          \[\leadsto \mathsf{log1p}\left(y \cdot \left(e^{\color{blue}{x}} - 1\right)\right) \cdot c \]
        16. lower-expm1.f6487.9

          \[\leadsto \mathsf{log1p}\left(y \cdot \color{blue}{\mathsf{expm1}\left(x\right)}\right) \cdot c \]
      4. Applied rewrites87.9%

        \[\leadsto \color{blue}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(x\right)\right) \cdot c} \]
      5. Taylor expanded in y around 0

        \[\leadsto \color{blue}{c \cdot \left(y \cdot \left(e^{x} - 1\right)\right)} \]
      6. Step-by-step derivation
        1. *-commutativeN/A

          \[\leadsto \color{blue}{\left(y \cdot \left(e^{x} - 1\right)\right) \cdot c} \]
        2. lower-*.f64N/A

          \[\leadsto \color{blue}{\left(y \cdot \left(e^{x} - 1\right)\right) \cdot c} \]
        3. *-commutativeN/A

          \[\leadsto \color{blue}{\left(\left(e^{x} - 1\right) \cdot y\right)} \cdot c \]
        4. lower-*.f64N/A

          \[\leadsto \color{blue}{\left(\left(e^{x} - 1\right) \cdot y\right)} \cdot c \]
        5. lower-expm1.f6487.9

          \[\leadsto \left(\color{blue}{\mathsf{expm1}\left(x\right)} \cdot y\right) \cdot c \]
      7. Applied rewrites87.9%

        \[\leadsto \color{blue}{\left(\mathsf{expm1}\left(x\right) \cdot y\right) \cdot c} \]
      8. Step-by-step derivation
        1. Applied rewrites99.9%

          \[\leadsto \frac{\mathsf{expm1}\left(x \cdot 3\right) \cdot \left(c \cdot y\right)}{\color{blue}{\mathsf{fma}\left(e^{x}, e^{x}, e^{x} + 1\right)}} \]
        2. Step-by-step derivation
          1. Applied rewrites99.8%

            \[\leadsto \left(c \cdot \frac{y}{\mathsf{fma}\left(1 + e^{x}, e^{x}, 1\right)}\right) \cdot \color{blue}{\mathsf{expm1}\left(3 \cdot x\right)} \]
        3. Recombined 2 regimes into one program.
        4. Final simplification99.7%

          \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1 \cdot 10^{-39} \lor \neg \left(y \leq 9.2 \cdot 10^{-86}\right):\\ \;\;\;\;\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(x\right)\right) \cdot c\\ \mathbf{else}:\\ \;\;\;\;\left(c \cdot \frac{y}{\mathsf{fma}\left(1 + e^{x}, e^{x}, 1\right)}\right) \cdot \mathsf{expm1}\left(3 \cdot x\right)\\ \end{array} \]
        5. Add Preprocessing

        Alternative 3: 83.2% accurate, 1.0× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;{\mathsf{E}\left(\right)}^{x} \leq 0.02:\\ \;\;\;\;\left(\mathsf{expm1}\left(x\right) \cdot y\right) \cdot c\\ \mathbf{else}:\\ \;\;\;\;\mathsf{log1p}\left(y \cdot \left(\mathsf{fma}\left(0.5, x, 1\right) \cdot x\right)\right) \cdot c\\ \end{array} \end{array} \]
        (FPCore (c x y)
         :precision binary64
         (if (<= (pow (E) x) 0.02)
           (* (* (expm1 x) y) c)
           (* (log1p (* y (* (fma 0.5 x 1.0) x))) c)))
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;{\mathsf{E}\left(\right)}^{x} \leq 0.02:\\
        \;\;\;\;\left(\mathsf{expm1}\left(x\right) \cdot y\right) \cdot c\\
        
        \mathbf{else}:\\
        \;\;\;\;\mathsf{log1p}\left(y \cdot \left(\mathsf{fma}\left(0.5, x, 1\right) \cdot x\right)\right) \cdot c\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if (pow.f64 (E.f64) x) < 0.0200000000000000004

          1. Initial program 53.8%

            \[c \cdot \log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right) \]
          2. Add Preprocessing
          3. Step-by-step derivation
            1. lift-*.f64N/A

              \[\leadsto \color{blue}{c \cdot \log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right)} \]
            2. *-commutativeN/A

              \[\leadsto \color{blue}{\log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right) \cdot c} \]
            3. lower-*.f6453.8

              \[\leadsto \color{blue}{\log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right) \cdot c} \]
            4. lift-log.f64N/A

              \[\leadsto \color{blue}{\log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right)} \cdot c \]
            5. lift-+.f64N/A

              \[\leadsto \log \color{blue}{\left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right)} \cdot c \]
            6. lower-log1p.f6499.9

              \[\leadsto \color{blue}{\mathsf{log1p}\left(\left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right)} \cdot c \]
            7. lift-*.f64N/A

              \[\leadsto \mathsf{log1p}\left(\color{blue}{\left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y}\right) \cdot c \]
            8. *-commutativeN/A

              \[\leadsto \mathsf{log1p}\left(\color{blue}{y \cdot \left({\mathsf{E}\left(\right)}^{x} - 1\right)}\right) \cdot c \]
            9. lower-*.f6499.9

              \[\leadsto \mathsf{log1p}\left(\color{blue}{y \cdot \left({\mathsf{E}\left(\right)}^{x} - 1\right)}\right) \cdot c \]
            10. lift--.f64N/A

              \[\leadsto \mathsf{log1p}\left(y \cdot \color{blue}{\left({\mathsf{E}\left(\right)}^{x} - 1\right)}\right) \cdot c \]
            11. lift-pow.f64N/A

              \[\leadsto \mathsf{log1p}\left(y \cdot \left(\color{blue}{{\mathsf{E}\left(\right)}^{x}} - 1\right)\right) \cdot c \]
            12. pow-to-expN/A

              \[\leadsto \mathsf{log1p}\left(y \cdot \left(\color{blue}{e^{\log \mathsf{E}\left(\right) \cdot x}} - 1\right)\right) \cdot c \]
            13. lift-E.f64N/A

              \[\leadsto \mathsf{log1p}\left(y \cdot \left(e^{\log \color{blue}{\mathsf{E}\left(\right)} \cdot x} - 1\right)\right) \cdot c \]
            14. log-EN/A

              \[\leadsto \mathsf{log1p}\left(y \cdot \left(e^{\color{blue}{1} \cdot x} - 1\right)\right) \cdot c \]
            15. *-lft-identityN/A

              \[\leadsto \mathsf{log1p}\left(y \cdot \left(e^{\color{blue}{x}} - 1\right)\right) \cdot c \]
            16. lower-expm1.f6499.9

              \[\leadsto \mathsf{log1p}\left(y \cdot \color{blue}{\mathsf{expm1}\left(x\right)}\right) \cdot c \]
          4. Applied rewrites99.9%

            \[\leadsto \color{blue}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(x\right)\right) \cdot c} \]
          5. Taylor expanded in y around 0

            \[\leadsto \color{blue}{c \cdot \left(y \cdot \left(e^{x} - 1\right)\right)} \]
          6. Step-by-step derivation
            1. *-commutativeN/A

              \[\leadsto \color{blue}{\left(y \cdot \left(e^{x} - 1\right)\right) \cdot c} \]
            2. lower-*.f64N/A

              \[\leadsto \color{blue}{\left(y \cdot \left(e^{x} - 1\right)\right) \cdot c} \]
            3. *-commutativeN/A

              \[\leadsto \color{blue}{\left(\left(e^{x} - 1\right) \cdot y\right)} \cdot c \]
            4. lower-*.f64N/A

              \[\leadsto \color{blue}{\left(\left(e^{x} - 1\right) \cdot y\right)} \cdot c \]
            5. lower-expm1.f6464.7

              \[\leadsto \left(\color{blue}{\mathsf{expm1}\left(x\right)} \cdot y\right) \cdot c \]
          7. Applied rewrites64.7%

            \[\leadsto \color{blue}{\left(\mathsf{expm1}\left(x\right) \cdot y\right) \cdot c} \]

          if 0.0200000000000000004 < (pow.f64 (E.f64) x)

          1. Initial program 35.1%

            \[c \cdot \log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right) \]
          2. Add Preprocessing
          3. Step-by-step derivation
            1. lift-*.f64N/A

              \[\leadsto \color{blue}{c \cdot \log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right)} \]
            2. *-commutativeN/A

              \[\leadsto \color{blue}{\log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right) \cdot c} \]
            3. lower-*.f6435.1

              \[\leadsto \color{blue}{\log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right) \cdot c} \]
            4. lift-log.f64N/A

              \[\leadsto \color{blue}{\log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right)} \cdot c \]
            5. lift-+.f64N/A

              \[\leadsto \log \color{blue}{\left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right)} \cdot c \]
            6. lower-log1p.f6436.2

              \[\leadsto \color{blue}{\mathsf{log1p}\left(\left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right)} \cdot c \]
            7. lift-*.f64N/A

              \[\leadsto \mathsf{log1p}\left(\color{blue}{\left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y}\right) \cdot c \]
            8. *-commutativeN/A

              \[\leadsto \mathsf{log1p}\left(\color{blue}{y \cdot \left({\mathsf{E}\left(\right)}^{x} - 1\right)}\right) \cdot c \]
            9. lower-*.f6436.2

              \[\leadsto \mathsf{log1p}\left(\color{blue}{y \cdot \left({\mathsf{E}\left(\right)}^{x} - 1\right)}\right) \cdot c \]
            10. lift--.f64N/A

              \[\leadsto \mathsf{log1p}\left(y \cdot \color{blue}{\left({\mathsf{E}\left(\right)}^{x} - 1\right)}\right) \cdot c \]
            11. lift-pow.f64N/A

              \[\leadsto \mathsf{log1p}\left(y \cdot \left(\color{blue}{{\mathsf{E}\left(\right)}^{x}} - 1\right)\right) \cdot c \]
            12. pow-to-expN/A

              \[\leadsto \mathsf{log1p}\left(y \cdot \left(\color{blue}{e^{\log \mathsf{E}\left(\right) \cdot x}} - 1\right)\right) \cdot c \]
            13. lift-E.f64N/A

              \[\leadsto \mathsf{log1p}\left(y \cdot \left(e^{\log \color{blue}{\mathsf{E}\left(\right)} \cdot x} - 1\right)\right) \cdot c \]
            14. log-EN/A

              \[\leadsto \mathsf{log1p}\left(y \cdot \left(e^{\color{blue}{1} \cdot x} - 1\right)\right) \cdot c \]
            15. *-lft-identityN/A

              \[\leadsto \mathsf{log1p}\left(y \cdot \left(e^{\color{blue}{x}} - 1\right)\right) \cdot c \]
            16. lower-expm1.f6492.0

              \[\leadsto \mathsf{log1p}\left(y \cdot \color{blue}{\mathsf{expm1}\left(x\right)}\right) \cdot c \]
          4. Applied rewrites92.0%

            \[\leadsto \color{blue}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(x\right)\right) \cdot c} \]
          5. Taylor expanded in x around 0

            \[\leadsto \mathsf{log1p}\left(y \cdot \color{blue}{\left(x \cdot \left(1 + \frac{1}{2} \cdot x\right)\right)}\right) \cdot c \]
          6. Step-by-step derivation
            1. *-commutativeN/A

              \[\leadsto \mathsf{log1p}\left(y \cdot \color{blue}{\left(\left(1 + \frac{1}{2} \cdot x\right) \cdot x\right)}\right) \cdot c \]
            2. lower-*.f64N/A

              \[\leadsto \mathsf{log1p}\left(y \cdot \color{blue}{\left(\left(1 + \frac{1}{2} \cdot x\right) \cdot x\right)}\right) \cdot c \]
            3. +-commutativeN/A

              \[\leadsto \mathsf{log1p}\left(y \cdot \left(\color{blue}{\left(\frac{1}{2} \cdot x + 1\right)} \cdot x\right)\right) \cdot c \]
            4. lower-fma.f6491.7

              \[\leadsto \mathsf{log1p}\left(y \cdot \left(\color{blue}{\mathsf{fma}\left(0.5, x, 1\right)} \cdot x\right)\right) \cdot c \]
          7. Applied rewrites91.7%

            \[\leadsto \mathsf{log1p}\left(y \cdot \color{blue}{\left(\mathsf{fma}\left(0.5, x, 1\right) \cdot x\right)}\right) \cdot c \]
        3. Recombined 2 regimes into one program.
        4. Add Preprocessing

        Alternative 4: 93.5% accurate, 1.0× speedup?

        \[\begin{array}{l} \\ \mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(x\right)\right) \cdot c \end{array} \]
        (FPCore (c x y) :precision binary64 (* (log1p (* y (expm1 x))) c))
        double code(double c, double x, double y) {
        	return log1p((y * expm1(x))) * c;
        }
        
        public static double code(double c, double x, double y) {
        	return Math.log1p((y * Math.expm1(x))) * c;
        }
        
        def code(c, x, y):
        	return math.log1p((y * math.expm1(x))) * c
        
        function code(c, x, y)
        	return Float64(log1p(Float64(y * expm1(x))) * c)
        end
        
        code[c_, x_, y_] := N[(N[Log[1 + N[(y * N[(Exp[x] - 1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * c), $MachinePrecision]
        
        \begin{array}{l}
        
        \\
        \mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(x\right)\right) \cdot c
        \end{array}
        
        Derivation
        1. Initial program 40.4%

          \[c \cdot \log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right) \]
        2. Add Preprocessing
        3. Step-by-step derivation
          1. lift-*.f64N/A

            \[\leadsto \color{blue}{c \cdot \log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right)} \]
          2. *-commutativeN/A

            \[\leadsto \color{blue}{\log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right) \cdot c} \]
          3. lower-*.f6440.4

            \[\leadsto \color{blue}{\log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right) \cdot c} \]
          4. lift-log.f64N/A

            \[\leadsto \color{blue}{\log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right)} \cdot c \]
          5. lift-+.f64N/A

            \[\leadsto \log \color{blue}{\left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right)} \cdot c \]
          6. lower-log1p.f6454.3

            \[\leadsto \color{blue}{\mathsf{log1p}\left(\left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right)} \cdot c \]
          7. lift-*.f64N/A

            \[\leadsto \mathsf{log1p}\left(\color{blue}{\left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y}\right) \cdot c \]
          8. *-commutativeN/A

            \[\leadsto \mathsf{log1p}\left(\color{blue}{y \cdot \left({\mathsf{E}\left(\right)}^{x} - 1\right)}\right) \cdot c \]
          9. lower-*.f6454.3

            \[\leadsto \mathsf{log1p}\left(\color{blue}{y \cdot \left({\mathsf{E}\left(\right)}^{x} - 1\right)}\right) \cdot c \]
          10. lift--.f64N/A

            \[\leadsto \mathsf{log1p}\left(y \cdot \color{blue}{\left({\mathsf{E}\left(\right)}^{x} - 1\right)}\right) \cdot c \]
          11. lift-pow.f64N/A

            \[\leadsto \mathsf{log1p}\left(y \cdot \left(\color{blue}{{\mathsf{E}\left(\right)}^{x}} - 1\right)\right) \cdot c \]
          12. pow-to-expN/A

            \[\leadsto \mathsf{log1p}\left(y \cdot \left(\color{blue}{e^{\log \mathsf{E}\left(\right) \cdot x}} - 1\right)\right) \cdot c \]
          13. lift-E.f64N/A

            \[\leadsto \mathsf{log1p}\left(y \cdot \left(e^{\log \color{blue}{\mathsf{E}\left(\right)} \cdot x} - 1\right)\right) \cdot c \]
          14. log-EN/A

            \[\leadsto \mathsf{log1p}\left(y \cdot \left(e^{\color{blue}{1} \cdot x} - 1\right)\right) \cdot c \]
          15. *-lft-identityN/A

            \[\leadsto \mathsf{log1p}\left(y \cdot \left(e^{\color{blue}{x}} - 1\right)\right) \cdot c \]
          16. lower-expm1.f6494.2

            \[\leadsto \mathsf{log1p}\left(y \cdot \color{blue}{\mathsf{expm1}\left(x\right)}\right) \cdot c \]
        4. Applied rewrites94.2%

          \[\leadsto \color{blue}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(x\right)\right) \cdot c} \]
        5. Add Preprocessing

        Alternative 5: 77.5% accurate, 1.8× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -3.6 \cdot 10^{+130} \lor \neg \left(y \leq 2.5 \cdot 10^{+191}\right):\\ \;\;\;\;c \cdot \log \left(\mathsf{fma}\left(y, x, 1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\mathsf{expm1}\left(x\right) \cdot y\right) \cdot c\\ \end{array} \end{array} \]
        (FPCore (c x y)
         :precision binary64
         (if (or (<= y -3.6e+130) (not (<= y 2.5e+191)))
           (* c (log (fma y x 1.0)))
           (* (* (expm1 x) y) c)))
        double code(double c, double x, double y) {
        	double tmp;
        	if ((y <= -3.6e+130) || !(y <= 2.5e+191)) {
        		tmp = c * log(fma(y, x, 1.0));
        	} else {
        		tmp = (expm1(x) * y) * c;
        	}
        	return tmp;
        }
        
        function code(c, x, y)
        	tmp = 0.0
        	if ((y <= -3.6e+130) || !(y <= 2.5e+191))
        		tmp = Float64(c * log(fma(y, x, 1.0)));
        	else
        		tmp = Float64(Float64(expm1(x) * y) * c);
        	end
        	return tmp
        end
        
        code[c_, x_, y_] := If[Or[LessEqual[y, -3.6e+130], N[Not[LessEqual[y, 2.5e+191]], $MachinePrecision]], N[(c * N[Log[N[(y * x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(Exp[x] - 1), $MachinePrecision] * y), $MachinePrecision] * c), $MachinePrecision]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;y \leq -3.6 \cdot 10^{+130} \lor \neg \left(y \leq 2.5 \cdot 10^{+191}\right):\\
        \;\;\;\;c \cdot \log \left(\mathsf{fma}\left(y, x, 1\right)\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;\left(\mathsf{expm1}\left(x\right) \cdot y\right) \cdot c\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if y < -3.6000000000000001e130 or 2.5000000000000001e191 < y

          1. Initial program 32.5%

            \[c \cdot \log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right) \]
          2. Add Preprocessing
          3. Taylor expanded in x around 0

            \[\leadsto c \cdot \log \color{blue}{\left(1 + x \cdot \left(y \cdot \log \mathsf{E}\left(\right)\right)\right)} \]
          4. Step-by-step derivation
            1. +-commutativeN/A

              \[\leadsto c \cdot \log \color{blue}{\left(x \cdot \left(y \cdot \log \mathsf{E}\left(\right)\right) + 1\right)} \]
            2. log-EN/A

              \[\leadsto c \cdot \log \left(x \cdot \left(y \cdot \color{blue}{1}\right) + 1\right) \]
            3. metadata-evalN/A

              \[\leadsto c \cdot \log \left(x \cdot \left(y \cdot \color{blue}{{1}^{2}}\right) + 1\right) \]
            4. log-EN/A

              \[\leadsto c \cdot \log \left(x \cdot \left(y \cdot {\color{blue}{\log \mathsf{E}\left(\right)}}^{2}\right) + 1\right) \]
            5. associate-*r*N/A

              \[\leadsto c \cdot \log \left(\color{blue}{\left(x \cdot y\right) \cdot {\log \mathsf{E}\left(\right)}^{2}} + 1\right) \]
            6. log-EN/A

              \[\leadsto c \cdot \log \left(\left(x \cdot y\right) \cdot {\color{blue}{1}}^{2} + 1\right) \]
            7. metadata-evalN/A

              \[\leadsto c \cdot \log \left(\left(x \cdot y\right) \cdot \color{blue}{1} + 1\right) \]
            8. *-rgt-identityN/A

              \[\leadsto c \cdot \log \left(\color{blue}{x \cdot y} + 1\right) \]
            9. *-commutativeN/A

              \[\leadsto c \cdot \log \left(\color{blue}{y \cdot x} + 1\right) \]
            10. lower-fma.f6459.6

              \[\leadsto c \cdot \log \color{blue}{\left(\mathsf{fma}\left(y, x, 1\right)\right)} \]
          5. Applied rewrites59.6%

            \[\leadsto c \cdot \log \color{blue}{\left(\mathsf{fma}\left(y, x, 1\right)\right)} \]

          if -3.6000000000000001e130 < y < 2.5000000000000001e191

          1. Initial program 42.5%

            \[c \cdot \log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right) \]
          2. Add Preprocessing
          3. Step-by-step derivation
            1. lift-*.f64N/A

              \[\leadsto \color{blue}{c \cdot \log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right)} \]
            2. *-commutativeN/A

              \[\leadsto \color{blue}{\log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right) \cdot c} \]
            3. lower-*.f6442.5

              \[\leadsto \color{blue}{\log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right) \cdot c} \]
            4. lift-log.f64N/A

              \[\leadsto \color{blue}{\log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right)} \cdot c \]
            5. lift-+.f64N/A

              \[\leadsto \log \color{blue}{\left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right)} \cdot c \]
            6. lower-log1p.f6460.1

              \[\leadsto \color{blue}{\mathsf{log1p}\left(\left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right)} \cdot c \]
            7. lift-*.f64N/A

              \[\leadsto \mathsf{log1p}\left(\color{blue}{\left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y}\right) \cdot c \]
            8. *-commutativeN/A

              \[\leadsto \mathsf{log1p}\left(\color{blue}{y \cdot \left({\mathsf{E}\left(\right)}^{x} - 1\right)}\right) \cdot c \]
            9. lower-*.f6460.1

              \[\leadsto \mathsf{log1p}\left(\color{blue}{y \cdot \left({\mathsf{E}\left(\right)}^{x} - 1\right)}\right) \cdot c \]
            10. lift--.f64N/A

              \[\leadsto \mathsf{log1p}\left(y \cdot \color{blue}{\left({\mathsf{E}\left(\right)}^{x} - 1\right)}\right) \cdot c \]
            11. lift-pow.f64N/A

              \[\leadsto \mathsf{log1p}\left(y \cdot \left(\color{blue}{{\mathsf{E}\left(\right)}^{x}} - 1\right)\right) \cdot c \]
            12. pow-to-expN/A

              \[\leadsto \mathsf{log1p}\left(y \cdot \left(\color{blue}{e^{\log \mathsf{E}\left(\right) \cdot x}} - 1\right)\right) \cdot c \]
            13. lift-E.f64N/A

              \[\leadsto \mathsf{log1p}\left(y \cdot \left(e^{\log \color{blue}{\mathsf{E}\left(\right)} \cdot x} - 1\right)\right) \cdot c \]
            14. log-EN/A

              \[\leadsto \mathsf{log1p}\left(y \cdot \left(e^{\color{blue}{1} \cdot x} - 1\right)\right) \cdot c \]
            15. *-lft-identityN/A

              \[\leadsto \mathsf{log1p}\left(y \cdot \left(e^{\color{blue}{x}} - 1\right)\right) \cdot c \]
            16. lower-expm1.f6492.8

              \[\leadsto \mathsf{log1p}\left(y \cdot \color{blue}{\mathsf{expm1}\left(x\right)}\right) \cdot c \]
          4. Applied rewrites92.8%

            \[\leadsto \color{blue}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(x\right)\right) \cdot c} \]
          5. Taylor expanded in y around 0

            \[\leadsto \color{blue}{c \cdot \left(y \cdot \left(e^{x} - 1\right)\right)} \]
          6. Step-by-step derivation
            1. *-commutativeN/A

              \[\leadsto \color{blue}{\left(y \cdot \left(e^{x} - 1\right)\right) \cdot c} \]
            2. lower-*.f64N/A

              \[\leadsto \color{blue}{\left(y \cdot \left(e^{x} - 1\right)\right) \cdot c} \]
            3. *-commutativeN/A

              \[\leadsto \color{blue}{\left(\left(e^{x} - 1\right) \cdot y\right)} \cdot c \]
            4. lower-*.f64N/A

              \[\leadsto \color{blue}{\left(\left(e^{x} - 1\right) \cdot y\right)} \cdot c \]
            5. lower-expm1.f6485.4

              \[\leadsto \left(\color{blue}{\mathsf{expm1}\left(x\right)} \cdot y\right) \cdot c \]
          7. Applied rewrites85.4%

            \[\leadsto \color{blue}{\left(\mathsf{expm1}\left(x\right) \cdot y\right) \cdot c} \]
        3. Recombined 2 regimes into one program.
        4. Final simplification79.9%

          \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3.6 \cdot 10^{+130} \lor \neg \left(y \leq 2.5 \cdot 10^{+191}\right):\\ \;\;\;\;c \cdot \log \left(\mathsf{fma}\left(y, x, 1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\mathsf{expm1}\left(x\right) \cdot y\right) \cdot c\\ \end{array} \]
        5. Add Preprocessing

        Alternative 6: 75.7% accurate, 1.9× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.02 \cdot 10^{-157}:\\ \;\;\;\;\left(\mathsf{expm1}\left(x\right) \cdot y\right) \cdot c\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot c\right) \cdot y\\ \end{array} \end{array} \]
        (FPCore (c x y)
         :precision binary64
         (if (<= x -1.02e-157) (* (* (expm1 x) y) c) (* (* x c) y)))
        double code(double c, double x, double y) {
        	double tmp;
        	if (x <= -1.02e-157) {
        		tmp = (expm1(x) * y) * c;
        	} else {
        		tmp = (x * c) * y;
        	}
        	return tmp;
        }
        
        public static double code(double c, double x, double y) {
        	double tmp;
        	if (x <= -1.02e-157) {
        		tmp = (Math.expm1(x) * y) * c;
        	} else {
        		tmp = (x * c) * y;
        	}
        	return tmp;
        }
        
        def code(c, x, y):
        	tmp = 0
        	if x <= -1.02e-157:
        		tmp = (math.expm1(x) * y) * c
        	else:
        		tmp = (x * c) * y
        	return tmp
        
        function code(c, x, y)
        	tmp = 0.0
        	if (x <= -1.02e-157)
        		tmp = Float64(Float64(expm1(x) * y) * c);
        	else
        		tmp = Float64(Float64(x * c) * y);
        	end
        	return tmp
        end
        
        code[c_, x_, y_] := If[LessEqual[x, -1.02e-157], N[(N[(N[(Exp[x] - 1), $MachinePrecision] * y), $MachinePrecision] * c), $MachinePrecision], N[(N[(x * c), $MachinePrecision] * y), $MachinePrecision]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;x \leq -1.02 \cdot 10^{-157}:\\
        \;\;\;\;\left(\mathsf{expm1}\left(x\right) \cdot y\right) \cdot c\\
        
        \mathbf{else}:\\
        \;\;\;\;\left(x \cdot c\right) \cdot y\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if x < -1.0200000000000001e-157

          1. Initial program 41.8%

            \[c \cdot \log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right) \]
          2. Add Preprocessing
          3. Step-by-step derivation
            1. lift-*.f64N/A

              \[\leadsto \color{blue}{c \cdot \log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right)} \]
            2. *-commutativeN/A

              \[\leadsto \color{blue}{\log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right) \cdot c} \]
            3. lower-*.f6441.8

              \[\leadsto \color{blue}{\log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right) \cdot c} \]
            4. lift-log.f64N/A

              \[\leadsto \color{blue}{\log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right)} \cdot c \]
            5. lift-+.f64N/A

              \[\leadsto \log \color{blue}{\left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right)} \cdot c \]
            6. lower-log1p.f6469.1

              \[\leadsto \color{blue}{\mathsf{log1p}\left(\left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right)} \cdot c \]
            7. lift-*.f64N/A

              \[\leadsto \mathsf{log1p}\left(\color{blue}{\left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y}\right) \cdot c \]
            8. *-commutativeN/A

              \[\leadsto \mathsf{log1p}\left(\color{blue}{y \cdot \left({\mathsf{E}\left(\right)}^{x} - 1\right)}\right) \cdot c \]
            9. lower-*.f6469.1

              \[\leadsto \mathsf{log1p}\left(\color{blue}{y \cdot \left({\mathsf{E}\left(\right)}^{x} - 1\right)}\right) \cdot c \]
            10. lift--.f64N/A

              \[\leadsto \mathsf{log1p}\left(y \cdot \color{blue}{\left({\mathsf{E}\left(\right)}^{x} - 1\right)}\right) \cdot c \]
            11. lift-pow.f64N/A

              \[\leadsto \mathsf{log1p}\left(y \cdot \left(\color{blue}{{\mathsf{E}\left(\right)}^{x}} - 1\right)\right) \cdot c \]
            12. pow-to-expN/A

              \[\leadsto \mathsf{log1p}\left(y \cdot \left(\color{blue}{e^{\log \mathsf{E}\left(\right) \cdot x}} - 1\right)\right) \cdot c \]
            13. lift-E.f64N/A

              \[\leadsto \mathsf{log1p}\left(y \cdot \left(e^{\log \color{blue}{\mathsf{E}\left(\right)} \cdot x} - 1\right)\right) \cdot c \]
            14. log-EN/A

              \[\leadsto \mathsf{log1p}\left(y \cdot \left(e^{\color{blue}{1} \cdot x} - 1\right)\right) \cdot c \]
            15. *-lft-identityN/A

              \[\leadsto \mathsf{log1p}\left(y \cdot \left(e^{\color{blue}{x}} - 1\right)\right) \cdot c \]
            16. lower-expm1.f6499.0

              \[\leadsto \mathsf{log1p}\left(y \cdot \color{blue}{\mathsf{expm1}\left(x\right)}\right) \cdot c \]
          4. Applied rewrites99.0%

            \[\leadsto \color{blue}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(x\right)\right) \cdot c} \]
          5. Taylor expanded in y around 0

            \[\leadsto \color{blue}{c \cdot \left(y \cdot \left(e^{x} - 1\right)\right)} \]
          6. Step-by-step derivation
            1. *-commutativeN/A

              \[\leadsto \color{blue}{\left(y \cdot \left(e^{x} - 1\right)\right) \cdot c} \]
            2. lower-*.f64N/A

              \[\leadsto \color{blue}{\left(y \cdot \left(e^{x} - 1\right)\right) \cdot c} \]
            3. *-commutativeN/A

              \[\leadsto \color{blue}{\left(\left(e^{x} - 1\right) \cdot y\right)} \cdot c \]
            4. lower-*.f64N/A

              \[\leadsto \color{blue}{\left(\left(e^{x} - 1\right) \cdot y\right)} \cdot c \]
            5. lower-expm1.f6466.2

              \[\leadsto \left(\color{blue}{\mathsf{expm1}\left(x\right)} \cdot y\right) \cdot c \]
          7. Applied rewrites66.2%

            \[\leadsto \color{blue}{\left(\mathsf{expm1}\left(x\right) \cdot y\right) \cdot c} \]

          if -1.0200000000000001e-157 < x

          1. Initial program 39.2%

            \[c \cdot \log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right) \]
          2. Add Preprocessing
          3. Taylor expanded in x around 0

            \[\leadsto \color{blue}{c \cdot \left(x \cdot \left(y \cdot \log \mathsf{E}\left(\right)\right)\right)} \]
          4. Step-by-step derivation
            1. associate-*r*N/A

              \[\leadsto \color{blue}{\left(c \cdot x\right) \cdot \left(y \cdot \log \mathsf{E}\left(\right)\right)} \]
            2. log-EN/A

              \[\leadsto \left(c \cdot x\right) \cdot \left(y \cdot \color{blue}{1}\right) \]
            3. *-commutativeN/A

              \[\leadsto \left(c \cdot x\right) \cdot \color{blue}{\left(1 \cdot y\right)} \]
            4. *-lft-identityN/A

              \[\leadsto \left(c \cdot x\right) \cdot \color{blue}{y} \]
            5. *-commutativeN/A

              \[\leadsto \color{blue}{y \cdot \left(c \cdot x\right)} \]
            6. associate-*l*N/A

              \[\leadsto \color{blue}{\left(y \cdot c\right) \cdot x} \]
            7. *-commutativeN/A

              \[\leadsto \color{blue}{\left(c \cdot y\right)} \cdot x \]
            8. *-lft-identityN/A

              \[\leadsto \left(c \cdot \color{blue}{\left(1 \cdot y\right)}\right) \cdot x \]
            9. *-commutativeN/A

              \[\leadsto \left(c \cdot \color{blue}{\left(y \cdot 1\right)}\right) \cdot x \]
            10. log-EN/A

              \[\leadsto \left(c \cdot \left(y \cdot \color{blue}{\log \mathsf{E}\left(\right)}\right)\right) \cdot x \]
            11. lower-*.f64N/A

              \[\leadsto \color{blue}{\left(c \cdot \left(y \cdot \log \mathsf{E}\left(\right)\right)\right) \cdot x} \]
            12. log-EN/A

              \[\leadsto \left(c \cdot \left(y \cdot \color{blue}{1}\right)\right) \cdot x \]
            13. metadata-evalN/A

              \[\leadsto \left(c \cdot \left(y \cdot \color{blue}{{1}^{2}}\right)\right) \cdot x \]
            14. log-EN/A

              \[\leadsto \left(c \cdot \left(y \cdot {\color{blue}{\log \mathsf{E}\left(\right)}}^{2}\right)\right) \cdot x \]
            15. log-EN/A

              \[\leadsto \left(c \cdot \left(y \cdot {\color{blue}{1}}^{2}\right)\right) \cdot x \]
            16. metadata-evalN/A

              \[\leadsto \left(c \cdot \left(y \cdot \color{blue}{1}\right)\right) \cdot x \]
            17. *-rgt-identityN/A

              \[\leadsto \left(c \cdot \color{blue}{y}\right) \cdot x \]
            18. lower-*.f6480.4

              \[\leadsto \color{blue}{\left(c \cdot y\right)} \cdot x \]
          5. Applied rewrites80.4%

            \[\leadsto \color{blue}{\left(c \cdot y\right) \cdot x} \]
          6. Step-by-step derivation
            1. Applied rewrites82.0%

              \[\leadsto \left(x \cdot c\right) \cdot \color{blue}{y} \]
          7. Recombined 2 regimes into one program.
          8. Add Preprocessing

          Alternative 7: 62.5% accurate, 12.8× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;c \leq 10^{-72}:\\ \;\;\;\;\left(c \cdot y\right) \cdot x\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot c\right) \cdot y\\ \end{array} \end{array} \]
          (FPCore (c x y)
           :precision binary64
           (if (<= c 1e-72) (* (* c y) x) (* (* x c) y)))
          double code(double c, double x, double y) {
          	double tmp;
          	if (c <= 1e-72) {
          		tmp = (c * y) * x;
          	} else {
          		tmp = (x * c) * y;
          	}
          	return tmp;
          }
          
          real(8) function code(c, x, y)
              real(8), intent (in) :: c
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              real(8) :: tmp
              if (c <= 1d-72) then
                  tmp = (c * y) * x
              else
                  tmp = (x * c) * y
              end if
              code = tmp
          end function
          
          public static double code(double c, double x, double y) {
          	double tmp;
          	if (c <= 1e-72) {
          		tmp = (c * y) * x;
          	} else {
          		tmp = (x * c) * y;
          	}
          	return tmp;
          }
          
          def code(c, x, y):
          	tmp = 0
          	if c <= 1e-72:
          		tmp = (c * y) * x
          	else:
          		tmp = (x * c) * y
          	return tmp
          
          function code(c, x, y)
          	tmp = 0.0
          	if (c <= 1e-72)
          		tmp = Float64(Float64(c * y) * x);
          	else
          		tmp = Float64(Float64(x * c) * y);
          	end
          	return tmp
          end
          
          function tmp_2 = code(c, x, y)
          	tmp = 0.0;
          	if (c <= 1e-72)
          		tmp = (c * y) * x;
          	else
          		tmp = (x * c) * y;
          	end
          	tmp_2 = tmp;
          end
          
          code[c_, x_, y_] := If[LessEqual[c, 1e-72], N[(N[(c * y), $MachinePrecision] * x), $MachinePrecision], N[(N[(x * c), $MachinePrecision] * y), $MachinePrecision]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;c \leq 10^{-72}:\\
          \;\;\;\;\left(c \cdot y\right) \cdot x\\
          
          \mathbf{else}:\\
          \;\;\;\;\left(x \cdot c\right) \cdot y\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if c < 9.9999999999999997e-73

            1. Initial program 45.4%

              \[c \cdot \log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right) \]
            2. Add Preprocessing
            3. Taylor expanded in x around 0

              \[\leadsto \color{blue}{c \cdot \left(x \cdot \left(y \cdot \log \mathsf{E}\left(\right)\right)\right)} \]
            4. Step-by-step derivation
              1. associate-*r*N/A

                \[\leadsto \color{blue}{\left(c \cdot x\right) \cdot \left(y \cdot \log \mathsf{E}\left(\right)\right)} \]
              2. log-EN/A

                \[\leadsto \left(c \cdot x\right) \cdot \left(y \cdot \color{blue}{1}\right) \]
              3. *-commutativeN/A

                \[\leadsto \left(c \cdot x\right) \cdot \color{blue}{\left(1 \cdot y\right)} \]
              4. *-lft-identityN/A

                \[\leadsto \left(c \cdot x\right) \cdot \color{blue}{y} \]
              5. *-commutativeN/A

                \[\leadsto \color{blue}{y \cdot \left(c \cdot x\right)} \]
              6. associate-*l*N/A

                \[\leadsto \color{blue}{\left(y \cdot c\right) \cdot x} \]
              7. *-commutativeN/A

                \[\leadsto \color{blue}{\left(c \cdot y\right)} \cdot x \]
              8. *-lft-identityN/A

                \[\leadsto \left(c \cdot \color{blue}{\left(1 \cdot y\right)}\right) \cdot x \]
              9. *-commutativeN/A

                \[\leadsto \left(c \cdot \color{blue}{\left(y \cdot 1\right)}\right) \cdot x \]
              10. log-EN/A

                \[\leadsto \left(c \cdot \left(y \cdot \color{blue}{\log \mathsf{E}\left(\right)}\right)\right) \cdot x \]
              11. lower-*.f64N/A

                \[\leadsto \color{blue}{\left(c \cdot \left(y \cdot \log \mathsf{E}\left(\right)\right)\right) \cdot x} \]
              12. log-EN/A

                \[\leadsto \left(c \cdot \left(y \cdot \color{blue}{1}\right)\right) \cdot x \]
              13. metadata-evalN/A

                \[\leadsto \left(c \cdot \left(y \cdot \color{blue}{{1}^{2}}\right)\right) \cdot x \]
              14. log-EN/A

                \[\leadsto \left(c \cdot \left(y \cdot {\color{blue}{\log \mathsf{E}\left(\right)}}^{2}\right)\right) \cdot x \]
              15. log-EN/A

                \[\leadsto \left(c \cdot \left(y \cdot {\color{blue}{1}}^{2}\right)\right) \cdot x \]
              16. metadata-evalN/A

                \[\leadsto \left(c \cdot \left(y \cdot \color{blue}{1}\right)\right) \cdot x \]
              17. *-rgt-identityN/A

                \[\leadsto \left(c \cdot \color{blue}{y}\right) \cdot x \]
              18. lower-*.f6463.8

                \[\leadsto \color{blue}{\left(c \cdot y\right)} \cdot x \]
            5. Applied rewrites63.8%

              \[\leadsto \color{blue}{\left(c \cdot y\right) \cdot x} \]

            if 9.9999999999999997e-73 < c

            1. Initial program 30.4%

              \[c \cdot \log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right) \]
            2. Add Preprocessing
            3. Taylor expanded in x around 0

              \[\leadsto \color{blue}{c \cdot \left(x \cdot \left(y \cdot \log \mathsf{E}\left(\right)\right)\right)} \]
            4. Step-by-step derivation
              1. associate-*r*N/A

                \[\leadsto \color{blue}{\left(c \cdot x\right) \cdot \left(y \cdot \log \mathsf{E}\left(\right)\right)} \]
              2. log-EN/A

                \[\leadsto \left(c \cdot x\right) \cdot \left(y \cdot \color{blue}{1}\right) \]
              3. *-commutativeN/A

                \[\leadsto \left(c \cdot x\right) \cdot \color{blue}{\left(1 \cdot y\right)} \]
              4. *-lft-identityN/A

                \[\leadsto \left(c \cdot x\right) \cdot \color{blue}{y} \]
              5. *-commutativeN/A

                \[\leadsto \color{blue}{y \cdot \left(c \cdot x\right)} \]
              6. associate-*l*N/A

                \[\leadsto \color{blue}{\left(y \cdot c\right) \cdot x} \]
              7. *-commutativeN/A

                \[\leadsto \color{blue}{\left(c \cdot y\right)} \cdot x \]
              8. *-lft-identityN/A

                \[\leadsto \left(c \cdot \color{blue}{\left(1 \cdot y\right)}\right) \cdot x \]
              9. *-commutativeN/A

                \[\leadsto \left(c \cdot \color{blue}{\left(y \cdot 1\right)}\right) \cdot x \]
              10. log-EN/A

                \[\leadsto \left(c \cdot \left(y \cdot \color{blue}{\log \mathsf{E}\left(\right)}\right)\right) \cdot x \]
              11. lower-*.f64N/A

                \[\leadsto \color{blue}{\left(c \cdot \left(y \cdot \log \mathsf{E}\left(\right)\right)\right) \cdot x} \]
              12. log-EN/A

                \[\leadsto \left(c \cdot \left(y \cdot \color{blue}{1}\right)\right) \cdot x \]
              13. metadata-evalN/A

                \[\leadsto \left(c \cdot \left(y \cdot \color{blue}{{1}^{2}}\right)\right) \cdot x \]
              14. log-EN/A

                \[\leadsto \left(c \cdot \left(y \cdot {\color{blue}{\log \mathsf{E}\left(\right)}}^{2}\right)\right) \cdot x \]
              15. log-EN/A

                \[\leadsto \left(c \cdot \left(y \cdot {\color{blue}{1}}^{2}\right)\right) \cdot x \]
              16. metadata-evalN/A

                \[\leadsto \left(c \cdot \left(y \cdot \color{blue}{1}\right)\right) \cdot x \]
              17. *-rgt-identityN/A

                \[\leadsto \left(c \cdot \color{blue}{y}\right) \cdot x \]
              18. lower-*.f6454.9

                \[\leadsto \color{blue}{\left(c \cdot y\right)} \cdot x \]
            5. Applied rewrites54.9%

              \[\leadsto \color{blue}{\left(c \cdot y\right) \cdot x} \]
            6. Step-by-step derivation
              1. Applied rewrites57.6%

                \[\leadsto \left(x \cdot c\right) \cdot \color{blue}{y} \]
            7. Recombined 2 regimes into one program.
            8. Add Preprocessing

            Alternative 8: 61.5% accurate, 19.8× speedup?

            \[\begin{array}{l} \\ \left(c \cdot y\right) \cdot x \end{array} \]
            (FPCore (c x y) :precision binary64 (* (* c y) x))
            double code(double c, double x, double y) {
            	return (c * y) * x;
            }
            
            real(8) function code(c, x, y)
                real(8), intent (in) :: c
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                code = (c * y) * x
            end function
            
            public static double code(double c, double x, double y) {
            	return (c * y) * x;
            }
            
            def code(c, x, y):
            	return (c * y) * x
            
            function code(c, x, y)
            	return Float64(Float64(c * y) * x)
            end
            
            function tmp = code(c, x, y)
            	tmp = (c * y) * x;
            end
            
            code[c_, x_, y_] := N[(N[(c * y), $MachinePrecision] * x), $MachinePrecision]
            
            \begin{array}{l}
            
            \\
            \left(c \cdot y\right) \cdot x
            \end{array}
            
            Derivation
            1. Initial program 40.4%

              \[c \cdot \log \left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right) \]
            2. Add Preprocessing
            3. Taylor expanded in x around 0

              \[\leadsto \color{blue}{c \cdot \left(x \cdot \left(y \cdot \log \mathsf{E}\left(\right)\right)\right)} \]
            4. Step-by-step derivation
              1. associate-*r*N/A

                \[\leadsto \color{blue}{\left(c \cdot x\right) \cdot \left(y \cdot \log \mathsf{E}\left(\right)\right)} \]
              2. log-EN/A

                \[\leadsto \left(c \cdot x\right) \cdot \left(y \cdot \color{blue}{1}\right) \]
              3. *-commutativeN/A

                \[\leadsto \left(c \cdot x\right) \cdot \color{blue}{\left(1 \cdot y\right)} \]
              4. *-lft-identityN/A

                \[\leadsto \left(c \cdot x\right) \cdot \color{blue}{y} \]
              5. *-commutativeN/A

                \[\leadsto \color{blue}{y \cdot \left(c \cdot x\right)} \]
              6. associate-*l*N/A

                \[\leadsto \color{blue}{\left(y \cdot c\right) \cdot x} \]
              7. *-commutativeN/A

                \[\leadsto \color{blue}{\left(c \cdot y\right)} \cdot x \]
              8. *-lft-identityN/A

                \[\leadsto \left(c \cdot \color{blue}{\left(1 \cdot y\right)}\right) \cdot x \]
              9. *-commutativeN/A

                \[\leadsto \left(c \cdot \color{blue}{\left(y \cdot 1\right)}\right) \cdot x \]
              10. log-EN/A

                \[\leadsto \left(c \cdot \left(y \cdot \color{blue}{\log \mathsf{E}\left(\right)}\right)\right) \cdot x \]
              11. lower-*.f64N/A

                \[\leadsto \color{blue}{\left(c \cdot \left(y \cdot \log \mathsf{E}\left(\right)\right)\right) \cdot x} \]
              12. log-EN/A

                \[\leadsto \left(c \cdot \left(y \cdot \color{blue}{1}\right)\right) \cdot x \]
              13. metadata-evalN/A

                \[\leadsto \left(c \cdot \left(y \cdot \color{blue}{{1}^{2}}\right)\right) \cdot x \]
              14. log-EN/A

                \[\leadsto \left(c \cdot \left(y \cdot {\color{blue}{\log \mathsf{E}\left(\right)}}^{2}\right)\right) \cdot x \]
              15. log-EN/A

                \[\leadsto \left(c \cdot \left(y \cdot {\color{blue}{1}}^{2}\right)\right) \cdot x \]
              16. metadata-evalN/A

                \[\leadsto \left(c \cdot \left(y \cdot \color{blue}{1}\right)\right) \cdot x \]
              17. *-rgt-identityN/A

                \[\leadsto \left(c \cdot \color{blue}{y}\right) \cdot x \]
              18. lower-*.f6460.8

                \[\leadsto \color{blue}{\left(c \cdot y\right)} \cdot x \]
            5. Applied rewrites60.8%

              \[\leadsto \color{blue}{\left(c \cdot y\right) \cdot x} \]
            6. Add Preprocessing

            Developer Target 1: 93.5% accurate, 1.0× speedup?

            \[\begin{array}{l} \\ c \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(x\right) \cdot y\right) \end{array} \]
            (FPCore (c x y) :precision binary64 (* c (log1p (* (expm1 x) y))))
            double code(double c, double x, double y) {
            	return c * log1p((expm1(x) * y));
            }
            
            public static double code(double c, double x, double y) {
            	return c * Math.log1p((Math.expm1(x) * y));
            }
            
            def code(c, x, y):
            	return c * math.log1p((math.expm1(x) * y))
            
            function code(c, x, y)
            	return Float64(c * log1p(Float64(expm1(x) * y)))
            end
            
            code[c_, x_, y_] := N[(c * N[Log[1 + N[(N[(Exp[x] - 1), $MachinePrecision] * y), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
            
            \begin{array}{l}
            
            \\
            c \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(x\right) \cdot y\right)
            \end{array}
            

            Reproduce

            ?
            herbie shell --seed 2024326 
            (FPCore (c x y)
              :name "Logarithmic Transform"
              :precision binary64
            
              :alt
              (* c (log1p (* (expm1 x) y)))
            
              (* c (log (+ 1.0 (* (- (pow (E) x) 1.0) y)))))