Logarithmic Transform

Percentage Accurate: 42.4% → 99.2%
Time: 13.2s
Alternatives: 13
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 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.

Initial Program: 42.4% 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: 99.2% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
t_0 := c \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(x\right) \cdot y\right)\\
\mathbf{if}\;y \leq -7 \cdot 10^{-59}:\\
\;\;\;\;t\_0\\

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

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -7.0000000000000002e-59 or 9.00000000000000085e-34 < y

    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.f6437.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-*.f6437.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.f6498.9

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

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

    if -7.0000000000000002e-59 < y < 9.00000000000000085e-34

    1. Initial program 44.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\left({\color{blue}{\mathsf{E}\left(\right)}}^{x} - 1\right) \cdot c\right) \cdot y \]
    5. Applied rewrites67.1%

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

        \[\leadsto \left(\left({\left(e^{3}\right)}^{\left(0.3333333333333333 \cdot x\right)} - 1\right) \cdot c\right) \cdot y \]
      2. Applied rewrites99.7%

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -7 \cdot 10^{-59}:\\ \;\;\;\;c \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(x\right) \cdot y\right)\\ \mathbf{elif}\;y \leq 9 \cdot 10^{-34}:\\ \;\;\;\;\frac{\mathsf{expm1}\left(3 \cdot x\right) \cdot c}{\mathsf{fma}\left(e^{x}, e^{x}, e^{x} + 1\right)} \cdot y\\ \mathbf{else}:\\ \;\;\;\;c \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(x\right) \cdot y\right)\\ \end{array} \]
    9. Add Preprocessing

    Alternative 2: 93.6% 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}
    
    Derivation
    1. Initial program 39.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-*.f6439.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.f6451.4

        \[\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-*.f6451.4

        \[\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.f6493.6

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

      \[\leadsto \color{blue}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(x\right)\right) \cdot c} \]
    5. Final simplification93.6%

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

    Alternative 3: 86.1% accurate, 1.3× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -0.39:\\ \;\;\;\;\mathsf{log1p}\left(\frac{y}{\frac{\mathsf{fma}\left(-0.5, x, 1\right)}{x}}\right) \cdot c\\ \mathbf{elif}\;y \leq 1.28 \cdot 10^{+41}:\\ \;\;\;\;\left(\mathsf{expm1}\left(x\right) \cdot y\right) \cdot c\\ \mathbf{else}:\\ \;\;\;\;\mathsf{log1p}\left(\frac{y}{\frac{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.001388888888888889, x \cdot x, 0.08333333333333333\right), x, -0.5\right), x, 1\right)}{x}}\right) \cdot c\\ \end{array} \end{array} \]
    (FPCore (c x y)
     :precision binary64
     (if (<= y -0.39)
       (* (log1p (/ y (/ (fma -0.5 x 1.0) x))) c)
       (if (<= y 1.28e+41)
         (* (* (expm1 x) y) c)
         (*
          (log1p
           (/
            y
            (/
             (fma
              (fma (fma -0.001388888888888889 (* x x) 0.08333333333333333) x -0.5)
              x
              1.0)
             x)))
          c))))
    double code(double c, double x, double y) {
    	double tmp;
    	if (y <= -0.39) {
    		tmp = log1p((y / (fma(-0.5, x, 1.0) / x))) * c;
    	} else if (y <= 1.28e+41) {
    		tmp = (expm1(x) * y) * c;
    	} else {
    		tmp = log1p((y / (fma(fma(fma(-0.001388888888888889, (x * x), 0.08333333333333333), x, -0.5), x, 1.0) / x))) * c;
    	}
    	return tmp;
    }
    
    function code(c, x, y)
    	tmp = 0.0
    	if (y <= -0.39)
    		tmp = Float64(log1p(Float64(y / Float64(fma(-0.5, x, 1.0) / x))) * c);
    	elseif (y <= 1.28e+41)
    		tmp = Float64(Float64(expm1(x) * y) * c);
    	else
    		tmp = Float64(log1p(Float64(y / Float64(fma(fma(fma(-0.001388888888888889, Float64(x * x), 0.08333333333333333), x, -0.5), x, 1.0) / x))) * c);
    	end
    	return tmp
    end
    
    code[c_, x_, y_] := If[LessEqual[y, -0.39], N[(N[Log[1 + N[(y / N[(N[(-0.5 * x + 1.0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * c), $MachinePrecision], If[LessEqual[y, 1.28e+41], N[(N[(N[(Exp[x] - 1), $MachinePrecision] * y), $MachinePrecision] * c), $MachinePrecision], N[(N[Log[1 + N[(y / N[(N[(N[(N[(-0.001388888888888889 * N[(x * x), $MachinePrecision] + 0.08333333333333333), $MachinePrecision] * x + -0.5), $MachinePrecision] * x + 1.0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * c), $MachinePrecision]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;y \leq -0.39:\\
    \;\;\;\;\mathsf{log1p}\left(\frac{y}{\frac{\mathsf{fma}\left(-0.5, x, 1\right)}{x}}\right) \cdot c\\
    
    \mathbf{elif}\;y \leq 1.28 \cdot 10^{+41}:\\
    \;\;\;\;\left(\mathsf{expm1}\left(x\right) \cdot y\right) \cdot c\\
    
    \mathbf{else}:\\
    \;\;\;\;\mathsf{log1p}\left(\frac{y}{\frac{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.001388888888888889, x \cdot x, 0.08333333333333333\right), x, -0.5\right), x, 1\right)}{x}}\right) \cdot c\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if y < -0.39000000000000001

      1. Initial program 55.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-*.f6455.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.f6455.0

          \[\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-*.f6455.0

          \[\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} \]
      5. Step-by-step derivation
        1. lift-expm1.f64N/A

          \[\leadsto \mathsf{log1p}\left(y \cdot \color{blue}{\left(e^{x} - 1\right)}\right) \cdot c \]
        2. flip--N/A

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

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

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

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

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

          \[\leadsto \mathsf{log1p}\left(y \cdot \frac{1}{\frac{\color{blue}{e^{x}} + 1}{e^{x} \cdot e^{x} - 1 \cdot 1}}\right) \cdot c \]
        8. pow2N/A

          \[\leadsto \mathsf{log1p}\left(y \cdot \frac{1}{\frac{e^{x} + 1}{\color{blue}{{\left(e^{x}\right)}^{2}} - 1 \cdot 1}}\right) \cdot c \]
        9. pow-expN/A

          \[\leadsto \mathsf{log1p}\left(y \cdot \frac{1}{\frac{e^{x} + 1}{\color{blue}{e^{x \cdot 2}} - 1 \cdot 1}}\right) \cdot c \]
        10. metadata-evalN/A

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

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

          \[\leadsto \mathsf{log1p}\left(y \cdot \frac{1}{\frac{e^{x} + 1}{\mathsf{expm1}\left(\color{blue}{x \cdot 2}\right)}}\right) \cdot c \]
      6. Applied rewrites99.5%

        \[\leadsto \mathsf{log1p}\left(y \cdot \color{blue}{\frac{1}{\frac{e^{x} + 1}{\mathsf{expm1}\left(x \cdot 2\right)}}}\right) \cdot c \]
      7. Taylor expanded in x around 0

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

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

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

          \[\leadsto \mathsf{log1p}\left(y \cdot \frac{1}{\frac{\color{blue}{\mathsf{fma}\left(-0.5, x, 1\right)}}{x}}\right) \cdot c \]
      9. Applied rewrites70.4%

        \[\leadsto \mathsf{log1p}\left(y \cdot \frac{1}{\color{blue}{\frac{\mathsf{fma}\left(-0.5, x, 1\right)}{x}}}\right) \cdot c \]
      10. Step-by-step derivation
        1. lift-*.f64N/A

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

          \[\leadsto \mathsf{log1p}\left(y \cdot \color{blue}{\frac{1}{\frac{\mathsf{fma}\left(\frac{-1}{2}, x, 1\right)}{x}}}\right) \cdot c \]
        3. un-div-invN/A

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

          \[\leadsto \mathsf{log1p}\left(\color{blue}{\frac{y}{\frac{\mathsf{fma}\left(-0.5, x, 1\right)}{x}}}\right) \cdot c \]
      11. Applied rewrites70.4%

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

      if -0.39000000000000001 < y < 1.27999999999999992e41

      1. Initial program 41.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-*.f6441.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.f6462.0

          \[\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-*.f6462.0

          \[\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.f6489.3

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

        \[\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.f6488.8

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

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

      if 1.27999999999999992e41 < 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.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} \]
      5. Step-by-step derivation
        1. lift-expm1.f64N/A

          \[\leadsto \mathsf{log1p}\left(y \cdot \color{blue}{\left(e^{x} - 1\right)}\right) \cdot c \]
        2. flip--N/A

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

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

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

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

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

          \[\leadsto \mathsf{log1p}\left(y \cdot \frac{1}{\frac{\color{blue}{e^{x}} + 1}{e^{x} \cdot e^{x} - 1 \cdot 1}}\right) \cdot c \]
        8. pow2N/A

          \[\leadsto \mathsf{log1p}\left(y \cdot \frac{1}{\frac{e^{x} + 1}{\color{blue}{{\left(e^{x}\right)}^{2}} - 1 \cdot 1}}\right) \cdot c \]
        9. pow-expN/A

          \[\leadsto \mathsf{log1p}\left(y \cdot \frac{1}{\frac{e^{x} + 1}{\color{blue}{e^{x \cdot 2}} - 1 \cdot 1}}\right) \cdot c \]
        10. metadata-evalN/A

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

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

          \[\leadsto \mathsf{log1p}\left(y \cdot \frac{1}{\frac{e^{x} + 1}{\mathsf{expm1}\left(\color{blue}{x \cdot 2}\right)}}\right) \cdot c \]
      6. Applied rewrites99.5%

        \[\leadsto \mathsf{log1p}\left(y \cdot \color{blue}{\frac{1}{\frac{e^{x} + 1}{\mathsf{expm1}\left(x \cdot 2\right)}}}\right) \cdot c \]
      7. Taylor expanded in x around 0

        \[\leadsto \mathsf{log1p}\left(y \cdot \frac{1}{\color{blue}{\frac{1 + x \cdot \left(x \cdot \left(\frac{1}{12} + \frac{-1}{720} \cdot {x}^{2}\right) - \frac{1}{2}\right)}{x}}}\right) \cdot c \]
      8. Step-by-step derivation
        1. lower-/.f64N/A

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

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

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

          \[\leadsto \mathsf{log1p}\left(y \cdot \frac{1}{\frac{\color{blue}{\mathsf{fma}\left(x \cdot \left(\frac{1}{12} + \frac{-1}{720} \cdot {x}^{2}\right) - \frac{1}{2}, x, 1\right)}}{x}}\right) \cdot c \]
        5. sub-negN/A

          \[\leadsto \mathsf{log1p}\left(y \cdot \frac{1}{\frac{\mathsf{fma}\left(\color{blue}{x \cdot \left(\frac{1}{12} + \frac{-1}{720} \cdot {x}^{2}\right) + \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}, x, 1\right)}{x}}\right) \cdot c \]
        6. *-commutativeN/A

          \[\leadsto \mathsf{log1p}\left(y \cdot \frac{1}{\frac{\mathsf{fma}\left(\color{blue}{\left(\frac{1}{12} + \frac{-1}{720} \cdot {x}^{2}\right) \cdot x} + \left(\mathsf{neg}\left(\frac{1}{2}\right)\right), x, 1\right)}{x}}\right) \cdot c \]
        7. metadata-evalN/A

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

          \[\leadsto \mathsf{log1p}\left(y \cdot \frac{1}{\frac{\mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(\frac{1}{12} + \frac{-1}{720} \cdot {x}^{2}, x, \frac{-1}{2}\right)}, x, 1\right)}{x}}\right) \cdot c \]
        9. +-commutativeN/A

          \[\leadsto \mathsf{log1p}\left(y \cdot \frac{1}{\frac{\mathsf{fma}\left(\mathsf{fma}\left(\color{blue}{\frac{-1}{720} \cdot {x}^{2} + \frac{1}{12}}, x, \frac{-1}{2}\right), x, 1\right)}{x}}\right) \cdot c \]
        10. *-commutativeN/A

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

          \[\leadsto \mathsf{log1p}\left(y \cdot \frac{1}{\frac{\mathsf{fma}\left(\mathsf{fma}\left(\color{blue}{\mathsf{fma}\left({x}^{2}, \frac{-1}{720}, \frac{1}{12}\right)}, x, \frac{-1}{2}\right), x, 1\right)}{x}}\right) \cdot c \]
        12. unpow2N/A

          \[\leadsto \mathsf{log1p}\left(y \cdot \frac{1}{\frac{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\color{blue}{x \cdot x}, \frac{-1}{720}, \frac{1}{12}\right), x, \frac{-1}{2}\right), x, 1\right)}{x}}\right) \cdot c \]
        13. lower-*.f6499.5

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

        \[\leadsto \mathsf{log1p}\left(y \cdot \frac{1}{\color{blue}{\frac{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(x \cdot x, -0.001388888888888889, 0.08333333333333333\right), x, -0.5\right), x, 1\right)}{x}}}\right) \cdot c \]
      10. Step-by-step derivation
        1. lift-*.f64N/A

          \[\leadsto \mathsf{log1p}\left(\color{blue}{y \cdot \frac{1}{\frac{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(x \cdot x, \frac{-1}{720}, \frac{1}{12}\right), x, \frac{-1}{2}\right), x, 1\right)}{x}}}\right) \cdot c \]
        2. lift-/.f64N/A

          \[\leadsto \mathsf{log1p}\left(y \cdot \color{blue}{\frac{1}{\frac{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(x \cdot x, \frac{-1}{720}, \frac{1}{12}\right), x, \frac{-1}{2}\right), x, 1\right)}{x}}}\right) \cdot c \]
        3. un-div-invN/A

          \[\leadsto \mathsf{log1p}\left(\color{blue}{\frac{y}{\frac{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(x \cdot x, \frac{-1}{720}, \frac{1}{12}\right), x, \frac{-1}{2}\right), x, 1\right)}{x}}}\right) \cdot c \]
        4. lower-/.f6499.6

          \[\leadsto \mathsf{log1p}\left(\color{blue}{\frac{y}{\frac{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(x \cdot x, -0.001388888888888889, 0.08333333333333333\right), x, -0.5\right), x, 1\right)}{x}}}\right) \cdot c \]
      11. Applied rewrites99.6%

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

    Alternative 4: 86.3% accurate, 1.4× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -0.39:\\ \;\;\;\;\mathsf{log1p}\left(\frac{y}{\frac{\mathsf{fma}\left(-0.5, x, 1\right)}{x}}\right) \cdot c\\ \mathbf{elif}\;y \leq 5:\\ \;\;\;\;\left(\mathsf{expm1}\left(x\right) \cdot y\right) \cdot c\\ \mathbf{else}:\\ \;\;\;\;\mathsf{log1p}\left(\frac{1}{\frac{\mathsf{fma}\left(\mathsf{fma}\left(0.08333333333333333, x, -0.5\right), x, 1\right)}{x}} \cdot y\right) \cdot c\\ \end{array} \end{array} \]
    (FPCore (c x y)
     :precision binary64
     (if (<= y -0.39)
       (* (log1p (/ y (/ (fma -0.5 x 1.0) x))) c)
       (if (<= y 5.0)
         (* (* (expm1 x) y) c)
         (*
          (log1p (* (/ 1.0 (/ (fma (fma 0.08333333333333333 x -0.5) x 1.0) x)) y))
          c))))
    double code(double c, double x, double y) {
    	double tmp;
    	if (y <= -0.39) {
    		tmp = log1p((y / (fma(-0.5, x, 1.0) / x))) * c;
    	} else if (y <= 5.0) {
    		tmp = (expm1(x) * y) * c;
    	} else {
    		tmp = log1p(((1.0 / (fma(fma(0.08333333333333333, x, -0.5), x, 1.0) / x)) * y)) * c;
    	}
    	return tmp;
    }
    
    function code(c, x, y)
    	tmp = 0.0
    	if (y <= -0.39)
    		tmp = Float64(log1p(Float64(y / Float64(fma(-0.5, x, 1.0) / x))) * c);
    	elseif (y <= 5.0)
    		tmp = Float64(Float64(expm1(x) * y) * c);
    	else
    		tmp = Float64(log1p(Float64(Float64(1.0 / Float64(fma(fma(0.08333333333333333, x, -0.5), x, 1.0) / x)) * y)) * c);
    	end
    	return tmp
    end
    
    code[c_, x_, y_] := If[LessEqual[y, -0.39], N[(N[Log[1 + N[(y / N[(N[(-0.5 * x + 1.0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * c), $MachinePrecision], If[LessEqual[y, 5.0], N[(N[(N[(Exp[x] - 1), $MachinePrecision] * y), $MachinePrecision] * c), $MachinePrecision], N[(N[Log[1 + N[(N[(1.0 / N[(N[(N[(0.08333333333333333 * x + -0.5), $MachinePrecision] * x + 1.0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]], $MachinePrecision] * c), $MachinePrecision]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;y \leq -0.39:\\
    \;\;\;\;\mathsf{log1p}\left(\frac{y}{\frac{\mathsf{fma}\left(-0.5, x, 1\right)}{x}}\right) \cdot c\\
    
    \mathbf{elif}\;y \leq 5:\\
    \;\;\;\;\left(\mathsf{expm1}\left(x\right) \cdot y\right) \cdot c\\
    
    \mathbf{else}:\\
    \;\;\;\;\mathsf{log1p}\left(\frac{1}{\frac{\mathsf{fma}\left(\mathsf{fma}\left(0.08333333333333333, x, -0.5\right), x, 1\right)}{x}} \cdot y\right) \cdot c\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if y < -0.39000000000000001

      1. Initial program 55.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-*.f6455.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.f6455.0

          \[\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-*.f6455.0

          \[\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} \]
      5. Step-by-step derivation
        1. lift-expm1.f64N/A

          \[\leadsto \mathsf{log1p}\left(y \cdot \color{blue}{\left(e^{x} - 1\right)}\right) \cdot c \]
        2. flip--N/A

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

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

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

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

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

          \[\leadsto \mathsf{log1p}\left(y \cdot \frac{1}{\frac{\color{blue}{e^{x}} + 1}{e^{x} \cdot e^{x} - 1 \cdot 1}}\right) \cdot c \]
        8. pow2N/A

          \[\leadsto \mathsf{log1p}\left(y \cdot \frac{1}{\frac{e^{x} + 1}{\color{blue}{{\left(e^{x}\right)}^{2}} - 1 \cdot 1}}\right) \cdot c \]
        9. pow-expN/A

          \[\leadsto \mathsf{log1p}\left(y \cdot \frac{1}{\frac{e^{x} + 1}{\color{blue}{e^{x \cdot 2}} - 1 \cdot 1}}\right) \cdot c \]
        10. metadata-evalN/A

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

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

          \[\leadsto \mathsf{log1p}\left(y \cdot \frac{1}{\frac{e^{x} + 1}{\mathsf{expm1}\left(\color{blue}{x \cdot 2}\right)}}\right) \cdot c \]
      6. Applied rewrites99.5%

        \[\leadsto \mathsf{log1p}\left(y \cdot \color{blue}{\frac{1}{\frac{e^{x} + 1}{\mathsf{expm1}\left(x \cdot 2\right)}}}\right) \cdot c \]
      7. Taylor expanded in x around 0

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

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

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

          \[\leadsto \mathsf{log1p}\left(y \cdot \frac{1}{\frac{\color{blue}{\mathsf{fma}\left(-0.5, x, 1\right)}}{x}}\right) \cdot c \]
      9. Applied rewrites70.4%

        \[\leadsto \mathsf{log1p}\left(y \cdot \frac{1}{\color{blue}{\frac{\mathsf{fma}\left(-0.5, x, 1\right)}{x}}}\right) \cdot c \]
      10. Step-by-step derivation
        1. lift-*.f64N/A

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

          \[\leadsto \mathsf{log1p}\left(y \cdot \color{blue}{\frac{1}{\frac{\mathsf{fma}\left(\frac{-1}{2}, x, 1\right)}{x}}}\right) \cdot c \]
        3. un-div-invN/A

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

          \[\leadsto \mathsf{log1p}\left(\color{blue}{\frac{y}{\frac{\mathsf{fma}\left(-0.5, x, 1\right)}{x}}}\right) \cdot c \]
      11. Applied rewrites70.4%

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

      if -0.39000000000000001 < y < 5

      1. Initial program 42.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-*.f6442.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.f6464.4

          \[\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-*.f6464.4

          \[\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.f6489.3

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

        \[\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.f6488.8

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

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

      if 5 < y

      1. Initial program 14.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-*.f6414.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.f6414.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-*.f6414.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.f6497.8

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

        \[\leadsto \color{blue}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(x\right)\right) \cdot c} \]
      5. Step-by-step derivation
        1. lift-expm1.f64N/A

          \[\leadsto \mathsf{log1p}\left(y \cdot \color{blue}{\left(e^{x} - 1\right)}\right) \cdot c \]
        2. flip--N/A

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

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

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

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

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

          \[\leadsto \mathsf{log1p}\left(y \cdot \frac{1}{\frac{\color{blue}{e^{x}} + 1}{e^{x} \cdot e^{x} - 1 \cdot 1}}\right) \cdot c \]
        8. pow2N/A

          \[\leadsto \mathsf{log1p}\left(y \cdot \frac{1}{\frac{e^{x} + 1}{\color{blue}{{\left(e^{x}\right)}^{2}} - 1 \cdot 1}}\right) \cdot c \]
        9. pow-expN/A

          \[\leadsto \mathsf{log1p}\left(y \cdot \frac{1}{\frac{e^{x} + 1}{\color{blue}{e^{x \cdot 2}} - 1 \cdot 1}}\right) \cdot c \]
        10. metadata-evalN/A

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

          \[\leadsto \mathsf{log1p}\left(y \cdot \frac{1}{\frac{e^{x} + 1}{\color{blue}{\mathsf{expm1}\left(x \cdot 2\right)}}}\right) \cdot c \]
        12. lower-*.f6497.7

          \[\leadsto \mathsf{log1p}\left(y \cdot \frac{1}{\frac{e^{x} + 1}{\mathsf{expm1}\left(\color{blue}{x \cdot 2}\right)}}\right) \cdot c \]
      6. Applied rewrites97.7%

        \[\leadsto \mathsf{log1p}\left(y \cdot \color{blue}{\frac{1}{\frac{e^{x} + 1}{\mathsf{expm1}\left(x \cdot 2\right)}}}\right) \cdot c \]
      7. Taylor expanded in x around 0

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

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

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

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

          \[\leadsto \mathsf{log1p}\left(y \cdot \frac{1}{\frac{\color{blue}{\mathsf{fma}\left(\frac{1}{12} \cdot x - \frac{1}{2}, x, 1\right)}}{x}}\right) \cdot c \]
        5. sub-negN/A

          \[\leadsto \mathsf{log1p}\left(y \cdot \frac{1}{\frac{\mathsf{fma}\left(\color{blue}{\frac{1}{12} \cdot x + \left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}, x, 1\right)}{x}}\right) \cdot c \]
        6. metadata-evalN/A

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

          \[\leadsto \mathsf{log1p}\left(y \cdot \frac{1}{\frac{\mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(0.08333333333333333, x, -0.5\right)}, x, 1\right)}{x}}\right) \cdot c \]
      9. Applied rewrites97.6%

        \[\leadsto \mathsf{log1p}\left(y \cdot \frac{1}{\color{blue}{\frac{\mathsf{fma}\left(\mathsf{fma}\left(0.08333333333333333, x, -0.5\right), x, 1\right)}{x}}}\right) \cdot c \]
    3. Recombined 3 regimes into one program.
    4. Final simplification86.3%

      \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -0.39:\\ \;\;\;\;\mathsf{log1p}\left(\frac{y}{\frac{\mathsf{fma}\left(-0.5, x, 1\right)}{x}}\right) \cdot c\\ \mathbf{elif}\;y \leq 5:\\ \;\;\;\;\left(\mathsf{expm1}\left(x\right) \cdot y\right) \cdot c\\ \mathbf{else}:\\ \;\;\;\;\mathsf{log1p}\left(\frac{1}{\frac{\mathsf{fma}\left(\mathsf{fma}\left(0.08333333333333333, x, -0.5\right), x, 1\right)}{x}} \cdot y\right) \cdot c\\ \end{array} \]
    5. Add Preprocessing

    Alternative 5: 86.3% accurate, 1.5× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -0.39:\\ \;\;\;\;\mathsf{log1p}\left(\frac{y}{\frac{\mathsf{fma}\left(-0.5, x, 1\right)}{x}}\right) \cdot c\\ \mathbf{elif}\;y \leq 0.2:\\ \;\;\;\;\left(\mathsf{expm1}\left(x\right) \cdot y\right) \cdot c\\ \mathbf{else}:\\ \;\;\;\;\mathsf{log1p}\left(\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.041666666666666664, x, 0.16666666666666666\right), x, 0.5\right), x, 1\right) \cdot x\right) \cdot y\right) \cdot c\\ \end{array} \end{array} \]
    (FPCore (c x y)
     :precision binary64
     (if (<= y -0.39)
       (* (log1p (/ y (/ (fma -0.5 x 1.0) x))) c)
       (if (<= y 0.2)
         (* (* (expm1 x) y) c)
         (*
          (log1p
           (*
            (*
             (fma
              (fma (fma 0.041666666666666664 x 0.16666666666666666) x 0.5)
              x
              1.0)
             x)
            y))
          c))))
    double code(double c, double x, double y) {
    	double tmp;
    	if (y <= -0.39) {
    		tmp = log1p((y / (fma(-0.5, x, 1.0) / x))) * c;
    	} else if (y <= 0.2) {
    		tmp = (expm1(x) * y) * c;
    	} else {
    		tmp = log1p(((fma(fma(fma(0.041666666666666664, x, 0.16666666666666666), x, 0.5), x, 1.0) * x) * y)) * c;
    	}
    	return tmp;
    }
    
    function code(c, x, y)
    	tmp = 0.0
    	if (y <= -0.39)
    		tmp = Float64(log1p(Float64(y / Float64(fma(-0.5, x, 1.0) / x))) * c);
    	elseif (y <= 0.2)
    		tmp = Float64(Float64(expm1(x) * y) * c);
    	else
    		tmp = Float64(log1p(Float64(Float64(fma(fma(fma(0.041666666666666664, x, 0.16666666666666666), x, 0.5), x, 1.0) * x) * y)) * c);
    	end
    	return tmp
    end
    
    code[c_, x_, y_] := If[LessEqual[y, -0.39], N[(N[Log[1 + N[(y / N[(N[(-0.5 * x + 1.0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * c), $MachinePrecision], If[LessEqual[y, 0.2], N[(N[(N[(Exp[x] - 1), $MachinePrecision] * y), $MachinePrecision] * c), $MachinePrecision], N[(N[Log[1 + N[(N[(N[(N[(N[(0.041666666666666664 * x + 0.16666666666666666), $MachinePrecision] * x + 0.5), $MachinePrecision] * x + 1.0), $MachinePrecision] * x), $MachinePrecision] * y), $MachinePrecision]], $MachinePrecision] * c), $MachinePrecision]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;y \leq -0.39:\\
    \;\;\;\;\mathsf{log1p}\left(\frac{y}{\frac{\mathsf{fma}\left(-0.5, x, 1\right)}{x}}\right) \cdot c\\
    
    \mathbf{elif}\;y \leq 0.2:\\
    \;\;\;\;\left(\mathsf{expm1}\left(x\right) \cdot y\right) \cdot c\\
    
    \mathbf{else}:\\
    \;\;\;\;\mathsf{log1p}\left(\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.041666666666666664, x, 0.16666666666666666\right), x, 0.5\right), x, 1\right) \cdot x\right) \cdot y\right) \cdot c\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if y < -0.39000000000000001

      1. Initial program 55.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-*.f6455.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.f6455.0

          \[\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-*.f6455.0

          \[\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} \]
      5. Step-by-step derivation
        1. lift-expm1.f64N/A

          \[\leadsto \mathsf{log1p}\left(y \cdot \color{blue}{\left(e^{x} - 1\right)}\right) \cdot c \]
        2. flip--N/A

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

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

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

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

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

          \[\leadsto \mathsf{log1p}\left(y \cdot \frac{1}{\frac{\color{blue}{e^{x}} + 1}{e^{x} \cdot e^{x} - 1 \cdot 1}}\right) \cdot c \]
        8. pow2N/A

          \[\leadsto \mathsf{log1p}\left(y \cdot \frac{1}{\frac{e^{x} + 1}{\color{blue}{{\left(e^{x}\right)}^{2}} - 1 \cdot 1}}\right) \cdot c \]
        9. pow-expN/A

          \[\leadsto \mathsf{log1p}\left(y \cdot \frac{1}{\frac{e^{x} + 1}{\color{blue}{e^{x \cdot 2}} - 1 \cdot 1}}\right) \cdot c \]
        10. metadata-evalN/A

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

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

          \[\leadsto \mathsf{log1p}\left(y \cdot \frac{1}{\frac{e^{x} + 1}{\mathsf{expm1}\left(\color{blue}{x \cdot 2}\right)}}\right) \cdot c \]
      6. Applied rewrites99.5%

        \[\leadsto \mathsf{log1p}\left(y \cdot \color{blue}{\frac{1}{\frac{e^{x} + 1}{\mathsf{expm1}\left(x \cdot 2\right)}}}\right) \cdot c \]
      7. Taylor expanded in x around 0

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

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

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

          \[\leadsto \mathsf{log1p}\left(y \cdot \frac{1}{\frac{\color{blue}{\mathsf{fma}\left(-0.5, x, 1\right)}}{x}}\right) \cdot c \]
      9. Applied rewrites70.4%

        \[\leadsto \mathsf{log1p}\left(y \cdot \frac{1}{\color{blue}{\frac{\mathsf{fma}\left(-0.5, x, 1\right)}{x}}}\right) \cdot c \]
      10. Step-by-step derivation
        1. lift-*.f64N/A

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

          \[\leadsto \mathsf{log1p}\left(y \cdot \color{blue}{\frac{1}{\frac{\mathsf{fma}\left(\frac{-1}{2}, x, 1\right)}{x}}}\right) \cdot c \]
        3. un-div-invN/A

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

          \[\leadsto \mathsf{log1p}\left(\color{blue}{\frac{y}{\frac{\mathsf{fma}\left(-0.5, x, 1\right)}{x}}}\right) \cdot c \]
      11. Applied rewrites70.4%

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

      if -0.39000000000000001 < y < 0.20000000000000001

      1. Initial program 42.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-*.f6442.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.f6464.4

          \[\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-*.f6464.4

          \[\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.f6489.3

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

        \[\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.f6488.8

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

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

      if 0.20000000000000001 < y

      1. Initial program 14.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-*.f6414.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.f6414.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-*.f6414.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.f6497.8

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

        \[\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 + x \cdot \left(\frac{1}{2} + x \cdot \left(\frac{1}{6} + \frac{1}{24} \cdot x\right)\right)\right)\right)}\right) \cdot c \]
      6. Step-by-step derivation
        1. *-commutativeN/A

          \[\leadsto \mathsf{log1p}\left(y \cdot \color{blue}{\left(\left(1 + x \cdot \left(\frac{1}{2} + x \cdot \left(\frac{1}{6} + \frac{1}{24} \cdot x\right)\right)\right) \cdot x\right)}\right) \cdot c \]
      7. Applied rewrites97.5%

        \[\leadsto \mathsf{log1p}\left(y \cdot \color{blue}{\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.041666666666666664, x, 0.16666666666666666\right), x, 0.5\right), x, 1\right) \cdot x\right)}\right) \cdot c \]
    3. Recombined 3 regimes into one program.
    4. Final simplification86.3%

      \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -0.39:\\ \;\;\;\;\mathsf{log1p}\left(\frac{y}{\frac{\mathsf{fma}\left(-0.5, x, 1\right)}{x}}\right) \cdot c\\ \mathbf{elif}\;y \leq 0.2:\\ \;\;\;\;\left(\mathsf{expm1}\left(x\right) \cdot y\right) \cdot c\\ \mathbf{else}:\\ \;\;\;\;\mathsf{log1p}\left(\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.041666666666666664, x, 0.16666666666666666\right), x, 0.5\right), x, 1\right) \cdot x\right) \cdot y\right) \cdot c\\ \end{array} \]
    5. Add Preprocessing

    Alternative 6: 83.5% accurate, 1.6× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -3300:\\ \;\;\;\;\left(\mathsf{expm1}\left(x\right) \cdot y\right) \cdot c\\ \mathbf{else}:\\ \;\;\;\;\mathsf{log1p}\left(\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.041666666666666664, x, 0.16666666666666666\right), x, 0.5\right), x, 1\right) \cdot x\right) \cdot y\right) \cdot c\\ \end{array} \end{array} \]
    (FPCore (c x y)
     :precision binary64
     (if (<= x -3300.0)
       (* (* (expm1 x) y) c)
       (*
        (log1p
         (*
          (*
           (fma (fma (fma 0.041666666666666664 x 0.16666666666666666) x 0.5) x 1.0)
           x)
          y))
        c)))
    double code(double c, double x, double y) {
    	double tmp;
    	if (x <= -3300.0) {
    		tmp = (expm1(x) * y) * c;
    	} else {
    		tmp = log1p(((fma(fma(fma(0.041666666666666664, x, 0.16666666666666666), x, 0.5), x, 1.0) * x) * y)) * c;
    	}
    	return tmp;
    }
    
    function code(c, x, y)
    	tmp = 0.0
    	if (x <= -3300.0)
    		tmp = Float64(Float64(expm1(x) * y) * c);
    	else
    		tmp = Float64(log1p(Float64(Float64(fma(fma(fma(0.041666666666666664, x, 0.16666666666666666), x, 0.5), x, 1.0) * x) * y)) * c);
    	end
    	return tmp
    end
    
    code[c_, x_, y_] := If[LessEqual[x, -3300.0], N[(N[(N[(Exp[x] - 1), $MachinePrecision] * y), $MachinePrecision] * c), $MachinePrecision], N[(N[Log[1 + N[(N[(N[(N[(N[(0.041666666666666664 * x + 0.16666666666666666), $MachinePrecision] * x + 0.5), $MachinePrecision] * x + 1.0), $MachinePrecision] * x), $MachinePrecision] * y), $MachinePrecision]], $MachinePrecision] * c), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;x \leq -3300:\\
    \;\;\;\;\left(\mathsf{expm1}\left(x\right) \cdot y\right) \cdot c\\
    
    \mathbf{else}:\\
    \;\;\;\;\mathsf{log1p}\left(\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.041666666666666664, x, 0.16666666666666666\right), x, 0.5\right), x, 1\right) \cdot x\right) \cdot y\right) \cdot c\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if x < -3300

      1. Initial program 55.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-*.f6455.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.f6499.8

          \[\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.8

          \[\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.8

          \[\leadsto \mathsf{log1p}\left(y \cdot \color{blue}{\mathsf{expm1}\left(x\right)}\right) \cdot c \]
      4. Applied rewrites99.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.f6461.3

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

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

      if -3300 < x

      1. Initial program 33.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-*.f6433.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.f6434.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-*.f6434.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.f6491.5

          \[\leadsto \mathsf{log1p}\left(y \cdot \color{blue}{\mathsf{expm1}\left(x\right)}\right) \cdot c \]
      4. Applied rewrites91.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 + x \cdot \left(\frac{1}{2} + x \cdot \left(\frac{1}{6} + \frac{1}{24} \cdot x\right)\right)\right)\right)}\right) \cdot c \]
      6. Step-by-step derivation
        1. *-commutativeN/A

          \[\leadsto \mathsf{log1p}\left(y \cdot \color{blue}{\left(\left(1 + x \cdot \left(\frac{1}{2} + x \cdot \left(\frac{1}{6} + \frac{1}{24} \cdot x\right)\right)\right) \cdot x\right)}\right) \cdot c \]
      7. Applied rewrites90.9%

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3300:\\ \;\;\;\;\left(\mathsf{expm1}\left(x\right) \cdot y\right) \cdot c\\ \mathbf{else}:\\ \;\;\;\;\mathsf{log1p}\left(\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.041666666666666664, x, 0.16666666666666666\right), x, 0.5\right), x, 1\right) \cdot x\right) \cdot y\right) \cdot c\\ \end{array} \]
    5. Add Preprocessing

    Alternative 7: 83.4% accurate, 1.6× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -250000:\\ \;\;\;\;\left(\mathsf{expm1}\left(x\right) \cdot y\right) \cdot c\\ \mathbf{else}:\\ \;\;\;\;\mathsf{log1p}\left(\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, x, 0.5\right), x, 1\right) \cdot x\right) \cdot y\right) \cdot c\\ \end{array} \end{array} \]
    (FPCore (c x y)
     :precision binary64
     (if (<= x -250000.0)
       (* (* (expm1 x) y) c)
       (* (log1p (* (* (fma (fma 0.16666666666666666 x 0.5) x 1.0) x) y)) c)))
    double code(double c, double x, double y) {
    	double tmp;
    	if (x <= -250000.0) {
    		tmp = (expm1(x) * y) * c;
    	} else {
    		tmp = log1p(((fma(fma(0.16666666666666666, x, 0.5), x, 1.0) * x) * y)) * c;
    	}
    	return tmp;
    }
    
    function code(c, x, y)
    	tmp = 0.0
    	if (x <= -250000.0)
    		tmp = Float64(Float64(expm1(x) * y) * c);
    	else
    		tmp = Float64(log1p(Float64(Float64(fma(fma(0.16666666666666666, x, 0.5), x, 1.0) * x) * y)) * c);
    	end
    	return tmp
    end
    
    code[c_, x_, y_] := If[LessEqual[x, -250000.0], N[(N[(N[(Exp[x] - 1), $MachinePrecision] * y), $MachinePrecision] * c), $MachinePrecision], N[(N[Log[1 + N[(N[(N[(N[(0.16666666666666666 * x + 0.5), $MachinePrecision] * x + 1.0), $MachinePrecision] * x), $MachinePrecision] * y), $MachinePrecision]], $MachinePrecision] * c), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;x \leq -250000:\\
    \;\;\;\;\left(\mathsf{expm1}\left(x\right) \cdot y\right) \cdot c\\
    
    \mathbf{else}:\\
    \;\;\;\;\mathsf{log1p}\left(\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, x, 0.5\right), x, 1\right) \cdot x\right) \cdot y\right) \cdot c\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if x < -2.5e5

      1. Initial program 54.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-*.f6454.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.8

          \[\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.8

          \[\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.8

          \[\leadsto \mathsf{log1p}\left(y \cdot \color{blue}{\mathsf{expm1}\left(x\right)}\right) \cdot c \]
      4. Applied rewrites99.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.f6462.1

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

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

      if -2.5e5 < x

      1. Initial program 34.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-*.f6434.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.f6435.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-*.f6435.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.f6491.5

          \[\leadsto \mathsf{log1p}\left(y \cdot \color{blue}{\mathsf{expm1}\left(x\right)}\right) \cdot c \]
      4. Applied rewrites91.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 + x \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot x\right)\right)\right)}\right) \cdot c \]
      6. Step-by-step derivation
        1. *-commutativeN/A

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

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

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

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

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

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -250000:\\ \;\;\;\;\left(\mathsf{expm1}\left(x\right) \cdot y\right) \cdot c\\ \mathbf{else}:\\ \;\;\;\;\mathsf{log1p}\left(\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, x, 0.5\right), x, 1\right) \cdot x\right) \cdot y\right) \cdot c\\ \end{array} \]
    5. Add Preprocessing

    Alternative 8: 83.3% accurate, 1.7× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -3300:\\ \;\;\;\;\left(\mathsf{expm1}\left(x\right) \cdot y\right) \cdot c\\ \mathbf{else}:\\ \;\;\;\;\mathsf{log1p}\left(\left(\mathsf{fma}\left(0.5, x, 1\right) \cdot x\right) \cdot y\right) \cdot c\\ \end{array} \end{array} \]
    (FPCore (c x y)
     :precision binary64
     (if (<= x -3300.0)
       (* (* (expm1 x) y) c)
       (* (log1p (* (* (fma 0.5 x 1.0) x) y)) c)))
    double code(double c, double x, double y) {
    	double tmp;
    	if (x <= -3300.0) {
    		tmp = (expm1(x) * y) * c;
    	} else {
    		tmp = log1p(((fma(0.5, x, 1.0) * x) * y)) * c;
    	}
    	return tmp;
    }
    
    function code(c, x, y)
    	tmp = 0.0
    	if (x <= -3300.0)
    		tmp = Float64(Float64(expm1(x) * y) * c);
    	else
    		tmp = Float64(log1p(Float64(Float64(fma(0.5, x, 1.0) * x) * y)) * c);
    	end
    	return tmp
    end
    
    code[c_, x_, y_] := If[LessEqual[x, -3300.0], N[(N[(N[(Exp[x] - 1), $MachinePrecision] * y), $MachinePrecision] * c), $MachinePrecision], N[(N[Log[1 + N[(N[(N[(0.5 * x + 1.0), $MachinePrecision] * x), $MachinePrecision] * y), $MachinePrecision]], $MachinePrecision] * c), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;x \leq -3300:\\
    \;\;\;\;\left(\mathsf{expm1}\left(x\right) \cdot y\right) \cdot c\\
    
    \mathbf{else}:\\
    \;\;\;\;\mathsf{log1p}\left(\left(\mathsf{fma}\left(0.5, x, 1\right) \cdot x\right) \cdot y\right) \cdot c\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if x < -3300

      1. Initial program 55.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-*.f6455.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.f6499.8

          \[\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.8

          \[\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.8

          \[\leadsto \mathsf{log1p}\left(y \cdot \color{blue}{\mathsf{expm1}\left(x\right)}\right) \cdot c \]
      4. Applied rewrites99.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.f6461.3

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

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

      if -3300 < x

      1. Initial program 33.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-*.f6433.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.f6434.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-*.f6434.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.f6491.5

          \[\leadsto \mathsf{log1p}\left(y \cdot \color{blue}{\mathsf{expm1}\left(x\right)}\right) \cdot c \]
      4. Applied rewrites91.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.f6490.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 rewrites90.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. Final simplification83.2%

      \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3300:\\ \;\;\;\;\left(\mathsf{expm1}\left(x\right) \cdot y\right) \cdot c\\ \mathbf{else}:\\ \;\;\;\;\mathsf{log1p}\left(\left(\mathsf{fma}\left(0.5, x, 1\right) \cdot x\right) \cdot y\right) \cdot c\\ \end{array} \]
    5. Add Preprocessing

    Alternative 9: 82.8% accurate, 1.9× speedup?

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

      1. Initial program 54.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-*.f6454.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.8

          \[\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.8

          \[\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.8

          \[\leadsto \mathsf{log1p}\left(y \cdot \color{blue}{\mathsf{expm1}\left(x\right)}\right) \cdot c \]
      4. Applied rewrites99.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.f6462.1

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

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

      if -2.5e5 < x

      1. Initial program 34.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-*.f6434.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.f6435.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-*.f6435.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.f6491.5

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

        \[\leadsto \color{blue}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(x\right)\right) \cdot c} \]
      5. Step-by-step derivation
        1. lift-expm1.f64N/A

          \[\leadsto \mathsf{log1p}\left(y \cdot \color{blue}{\left(e^{x} - 1\right)}\right) \cdot c \]
        2. flip--N/A

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

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

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

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

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

          \[\leadsto \mathsf{log1p}\left(y \cdot \frac{1}{\frac{\color{blue}{e^{x}} + 1}{e^{x} \cdot e^{x} - 1 \cdot 1}}\right) \cdot c \]
        8. pow2N/A

          \[\leadsto \mathsf{log1p}\left(y \cdot \frac{1}{\frac{e^{x} + 1}{\color{blue}{{\left(e^{x}\right)}^{2}} - 1 \cdot 1}}\right) \cdot c \]
        9. pow-expN/A

          \[\leadsto \mathsf{log1p}\left(y \cdot \frac{1}{\frac{e^{x} + 1}{\color{blue}{e^{x \cdot 2}} - 1 \cdot 1}}\right) \cdot c \]
        10. metadata-evalN/A

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

          \[\leadsto \mathsf{log1p}\left(y \cdot \frac{1}{\frac{e^{x} + 1}{\color{blue}{\mathsf{expm1}\left(x \cdot 2\right)}}}\right) \cdot c \]
        12. lower-*.f6491.5

          \[\leadsto \mathsf{log1p}\left(y \cdot \frac{1}{\frac{e^{x} + 1}{\mathsf{expm1}\left(\color{blue}{x \cdot 2}\right)}}\right) \cdot c \]
      6. Applied rewrites91.5%

        \[\leadsto \mathsf{log1p}\left(y \cdot \color{blue}{\frac{1}{\frac{e^{x} + 1}{\mathsf{expm1}\left(x \cdot 2\right)}}}\right) \cdot c \]
      7. Taylor expanded in x around 0

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

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

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

          \[\leadsto \mathsf{log1p}\left(y \cdot \frac{1}{\frac{\color{blue}{\mathsf{fma}\left(-0.5, x, 1\right)}}{x}}\right) \cdot c \]
      9. Applied rewrites90.2%

        \[\leadsto \mathsf{log1p}\left(y \cdot \frac{1}{\color{blue}{\frac{\mathsf{fma}\left(-0.5, x, 1\right)}{x}}}\right) \cdot c \]
      10. Taylor expanded in x around 0

        \[\leadsto \mathsf{log1p}\left(\color{blue}{x \cdot y}\right) \cdot c \]
      11. Step-by-step derivation
        1. lower-*.f6489.7

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

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

    Alternative 10: 74.6% accurate, 1.9× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 4.4 \cdot 10^{-275}:\\ \;\;\;\;\left(\mathsf{expm1}\left(x\right) \cdot y\right) \cdot c\\ \mathbf{else}:\\ \;\;\;\;\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.041666666666666664 \cdot c, x, 0.16666666666666666 \cdot c\right), x, 0.5 \cdot c\right), x, c\right) \cdot x\right) \cdot y\\ \end{array} \end{array} \]
    (FPCore (c x y)
     :precision binary64
     (if (<= x 4.4e-275)
       (* (* (expm1 x) y) c)
       (*
        (*
         (fma
          (fma
           (fma (* 0.041666666666666664 c) x (* 0.16666666666666666 c))
           x
           (* 0.5 c))
          x
          c)
         x)
        y)))
    double code(double c, double x, double y) {
    	double tmp;
    	if (x <= 4.4e-275) {
    		tmp = (expm1(x) * y) * c;
    	} else {
    		tmp = (fma(fma(fma((0.041666666666666664 * c), x, (0.16666666666666666 * c)), x, (0.5 * c)), x, c) * x) * y;
    	}
    	return tmp;
    }
    
    function code(c, x, y)
    	tmp = 0.0
    	if (x <= 4.4e-275)
    		tmp = Float64(Float64(expm1(x) * y) * c);
    	else
    		tmp = Float64(Float64(fma(fma(fma(Float64(0.041666666666666664 * c), x, Float64(0.16666666666666666 * c)), x, Float64(0.5 * c)), x, c) * x) * y);
    	end
    	return tmp
    end
    
    code[c_, x_, y_] := If[LessEqual[x, 4.4e-275], N[(N[(N[(Exp[x] - 1), $MachinePrecision] * y), $MachinePrecision] * c), $MachinePrecision], N[(N[(N[(N[(N[(N[(0.041666666666666664 * c), $MachinePrecision] * x + N[(0.16666666666666666 * c), $MachinePrecision]), $MachinePrecision] * x + N[(0.5 * c), $MachinePrecision]), $MachinePrecision] * x + c), $MachinePrecision] * x), $MachinePrecision] * y), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;x \leq 4.4 \cdot 10^{-275}:\\
    \;\;\;\;\left(\mathsf{expm1}\left(x\right) \cdot y\right) \cdot c\\
    
    \mathbf{else}:\\
    \;\;\;\;\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.041666666666666664 \cdot c, x, 0.16666666666666666 \cdot c\right), x, 0.5 \cdot c\right), x, c\right) \cdot x\right) \cdot y\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if x < 4.39999999999999977e-275

      1. Initial program 45.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-*.f6445.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.f6464.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-*.f6464.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.f6496.6

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

        \[\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.f6471.3

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

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

      if 4.39999999999999977e-275 < x

      1. Initial program 30.3%

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

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

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

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

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

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

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

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

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

          \[\leadsto \left(\left({\color{blue}{\mathsf{E}\left(\right)}}^{x} - 1\right) \cdot c\right) \cdot y \]
      5. Applied rewrites30.2%

        \[\leadsto \color{blue}{\left(\left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot c\right) \cdot y} \]
      6. Taylor expanded in x around 0

        \[\leadsto \left(x \cdot \left(c \cdot \log \mathsf{E}\left(\right) + x \cdot \left(\frac{1}{2} \cdot \left(c \cdot {\log \mathsf{E}\left(\right)}^{2}\right) + x \cdot \left(\frac{1}{24} \cdot \left(c \cdot \left(x \cdot {\log \mathsf{E}\left(\right)}^{4}\right)\right) + \frac{1}{6} \cdot \left(c \cdot {\log \mathsf{E}\left(\right)}^{3}\right)\right)\right)\right)\right) \cdot y \]
      7. Step-by-step derivation
        1. Applied rewrites73.3%

          \[\leadsto \left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.041666666666666664 \cdot c, x, 0.16666666666666666 \cdot c\right), x, 0.5 \cdot c\right), x, c\right) \cdot x\right) \cdot y \]
      8. Recombined 2 regimes into one program.
      9. Add Preprocessing

      Alternative 11: 63.2% accurate, 6.4× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;c \leq 8.2 \cdot 10^{+27}:\\ \;\;\;\;\left(c \cdot y\right) \cdot x\\ \mathbf{else}:\\ \;\;\;\;\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, x, 0.5\right) \cdot c, x, c\right) \cdot x\right) \cdot y\\ \end{array} \end{array} \]
      (FPCore (c x y)
       :precision binary64
       (if (<= c 8.2e+27)
         (* (* c y) x)
         (* (* (fma (* (fma 0.16666666666666666 x 0.5) c) x c) x) y)))
      double code(double c, double x, double y) {
      	double tmp;
      	if (c <= 8.2e+27) {
      		tmp = (c * y) * x;
      	} else {
      		tmp = (fma((fma(0.16666666666666666, x, 0.5) * c), x, c) * x) * y;
      	}
      	return tmp;
      }
      
      function code(c, x, y)
      	tmp = 0.0
      	if (c <= 8.2e+27)
      		tmp = Float64(Float64(c * y) * x);
      	else
      		tmp = Float64(Float64(fma(Float64(fma(0.16666666666666666, x, 0.5) * c), x, c) * x) * y);
      	end
      	return tmp
      end
      
      code[c_, x_, y_] := If[LessEqual[c, 8.2e+27], N[(N[(c * y), $MachinePrecision] * x), $MachinePrecision], N[(N[(N[(N[(N[(0.16666666666666666 * x + 0.5), $MachinePrecision] * c), $MachinePrecision] * x + c), $MachinePrecision] * x), $MachinePrecision] * y), $MachinePrecision]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;c \leq 8.2 \cdot 10^{+27}:\\
      \;\;\;\;\left(c \cdot y\right) \cdot x\\
      
      \mathbf{else}:\\
      \;\;\;\;\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, x, 0.5\right) \cdot c, x, c\right) \cdot x\right) \cdot y\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if c < 8.2000000000000005e27

        1. Initial program 45.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. associate-*r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        if 8.2000000000000005e27 < c

        1. Initial program 21.1%

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

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

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

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

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

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

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

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

            \[\leadsto \left(\left(\color{blue}{{\mathsf{E}\left(\right)}^{x}} - 1\right) \cdot c\right) \cdot y \]
          8. lower-E.f6419.5

            \[\leadsto \left(\left({\color{blue}{\mathsf{E}\left(\right)}}^{x} - 1\right) \cdot c\right) \cdot y \]
        5. Applied rewrites19.5%

          \[\leadsto \color{blue}{\left(\left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot c\right) \cdot y} \]
        6. Taylor expanded in x around 0

          \[\leadsto \left(x \cdot \left(c \cdot \log \mathsf{E}\left(\right) + x \cdot \left(\frac{1}{6} \cdot \left(c \cdot \left(x \cdot {\log \mathsf{E}\left(\right)}^{3}\right)\right) + \frac{1}{2} \cdot \left(c \cdot {\log \mathsf{E}\left(\right)}^{2}\right)\right)\right)\right) \cdot y \]
        7. Step-by-step derivation
          1. Applied rewrites60.2%

            \[\leadsto \left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666 \cdot c, x, 0.5 \cdot c\right), x, c\right) \cdot x\right) \cdot y \]
          2. Taylor expanded in c around 0

            \[\leadsto \left(\mathsf{fma}\left(c \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot x\right), x, c\right) \cdot x\right) \cdot y \]
          3. Step-by-step derivation
            1. Applied rewrites60.2%

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

          Alternative 12: 63.1% accurate, 12.8× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;c \leq 10^{+17}:\\ \;\;\;\;\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+17) (* (* c y) x) (* (* x c) y)))
          double code(double c, double x, double y) {
          	double tmp;
          	if (c <= 1e+17) {
          		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+17) 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+17) {
          		tmp = (c * y) * x;
          	} else {
          		tmp = (x * c) * y;
          	}
          	return tmp;
          }
          
          def code(c, x, y):
          	tmp = 0
          	if c <= 1e+17:
          		tmp = (c * y) * x
          	else:
          		tmp = (x * c) * y
          	return tmp
          
          function code(c, x, y)
          	tmp = 0.0
          	if (c <= 1e+17)
          		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+17)
          		tmp = (c * y) * x;
          	else
          		tmp = (x * c) * y;
          	end
          	tmp_2 = tmp;
          end
          
          code[c_, x_, y_] := If[LessEqual[c, 1e+17], 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^{+17}:\\
          \;\;\;\;\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 < 1e17

            1. Initial program 46.3%

              \[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. associate-*r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            if 1e17 < c

            1. Initial program 19.8%

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

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

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

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

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

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

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

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

                \[\leadsto \left(\left(\color{blue}{{\mathsf{E}\left(\right)}^{x}} - 1\right) \cdot c\right) \cdot y \]
              8. lower-E.f6419.7

                \[\leadsto \left(\left({\color{blue}{\mathsf{E}\left(\right)}}^{x} - 1\right) \cdot c\right) \cdot y \]
            5. Applied rewrites19.7%

              \[\leadsto \color{blue}{\left(\left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot c\right) \cdot y} \]
            6. Taylor expanded in x around 0

              \[\leadsto \left(\left(x \cdot \log \mathsf{E}\left(\right)\right) \cdot c\right) \cdot y \]
            7. Step-by-step derivation
              1. Applied rewrites60.1%

                \[\leadsto \left(x \cdot c\right) \cdot y \]
            8. Recombined 2 regimes into one program.
            9. Add Preprocessing

            Alternative 13: 61.6% 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 39.3%

              \[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. associate-*r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            Developer Target 1: 93.6% 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 2024295 
            (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)))))