Logarithmic Transform

Percentage Accurate: 40.8% → 98.3%
Time: 33.5s
Alternatives: 11
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 11 alternatives:

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

Initial Program: 40.8% accurate, 1.0× speedup?

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

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

Alternative 1: 98.3% accurate, 0.2× speedup?

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

\\
\begin{array}{l}
t_0 := \mathsf{expm1}\left(3 \cdot x\right)\\
t_1 := e^{x} - -1\\
\mathbf{if}\;y \leq -3 \cdot 10^{-123}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(x\right) \cdot y\right) \cdot c\\

\mathbf{elif}\;y \leq 530000000000:\\
\;\;\;\;\frac{t\_0 \cdot c}{\mathsf{fma}\left(e^{x}, e^{x}, t\_1\right)} \cdot y\\

\mathbf{else}:\\
\;\;\;\;\mathsf{log1p}\left(\frac{y \cdot t\_0}{{\left(e^{x}\right)}^{6} + {t\_1}^{3}} \cdot \mathsf{fma}\left(t\_1, t\_1 - {\left(e^{x}\right)}^{2}, {\left(e^{x}\right)}^{4}\right)\right) \cdot c\\


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

    1. Initial program 47.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-*.f6447.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.f6456.6

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\color{blue}{x \cdot 1}\right) \cdot y\right) \cdot c \]
      5. *-rgt-identity99.7

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

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

    if -2.99999999999999984e-123 < y < 5.3e11

    1. Initial program 40.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-*.f6440.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.f6461.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-*.f6461.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. lower-expm1.f64N/A

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

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

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

        \[\leadsto \mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(\color{blue}{x \cdot 1}\right)\right) \cdot c \]
      17. lower-*.f6485.1

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

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

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

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

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

        \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\color{blue}{x \cdot 1}\right) \cdot y\right) \cdot c \]
      5. *-rgt-identity85.1

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

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

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

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

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

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

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

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

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

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

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

      if 5.3e11 < y

      1. Initial program 13.4%

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

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

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

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

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

          \[\leadsto \log \color{blue}{\left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right)} \cdot c \]
        6. lower-log1p.f6413.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-*.f6413.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. lower-expm1.f64N/A

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

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

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

          \[\leadsto \mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(\color{blue}{x \cdot 1}\right)\right) \cdot c \]
        17. lower-*.f6497.3

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3 \cdot 10^{-123}:\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(x\right) \cdot y\right) \cdot c\\ \mathbf{elif}\;y \leq 530000000000:\\ \;\;\;\;\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}:\\ \;\;\;\;\mathsf{log1p}\left(\frac{y \cdot \mathsf{expm1}\left(3 \cdot x\right)}{{\left(e^{x}\right)}^{6} + {\left(e^{x} - -1\right)}^{3}} \cdot \mathsf{fma}\left(e^{x} - -1, \left(e^{x} - -1\right) - {\left(e^{x}\right)}^{2}, {\left(e^{x}\right)}^{4}\right)\right) \cdot c\\ \end{array} \]
    13. Add Preprocessing

    Alternative 2: 98.6% accurate, 0.5× speedup?

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

      1. Initial program 33.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-*.f6433.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.f6440.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-*.f6440.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. lower-expm1.f64N/A

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\color{blue}{x \cdot 1}\right) \cdot y\right) \cdot c \]
        5. *-rgt-identity98.9

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

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

      if -2.99999999999999984e-123 < y < 5.49999999999999977e-21

      1. Initial program 42.4%

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

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

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

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

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

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

          \[\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-*.f6463.5

          \[\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. lower-expm1.f64N/A

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

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

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

          \[\leadsto \mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(\color{blue}{x \cdot 1}\right)\right) \cdot c \]
        17. lower-*.f6484.1

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

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

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

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

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

          \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\color{blue}{x \cdot 1}\right) \cdot y\right) \cdot c \]
        5. *-rgt-identity84.1

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

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

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

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

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

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

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

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

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

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

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

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

      Alternative 3: 98.9% accurate, 1.0× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -3.2 \cdot 10^{-13} \lor \neg \left(y \leq 6.5 \cdot 10^{-91}\right):\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(x\right) \cdot y\right) \cdot c\\ \mathbf{else}:\\ \;\;\;\;\left(\mathsf{expm1}\left(x\right) \cdot c\right) \cdot y\\ \end{array} \end{array} \]
      (FPCore (c x y)
       :precision binary64
       (if (or (<= y -3.2e-13) (not (<= y 6.5e-91)))
         (* (log1p (* (expm1 x) y)) c)
         (* (* (expm1 x) c) y)))
      double code(double c, double x, double y) {
      	double tmp;
      	if ((y <= -3.2e-13) || !(y <= 6.5e-91)) {
      		tmp = log1p((expm1(x) * y)) * c;
      	} else {
      		tmp = (expm1(x) * c) * y;
      	}
      	return tmp;
      }
      
      public static double code(double c, double x, double y) {
      	double tmp;
      	if ((y <= -3.2e-13) || !(y <= 6.5e-91)) {
      		tmp = Math.log1p((Math.expm1(x) * y)) * c;
      	} else {
      		tmp = (Math.expm1(x) * c) * y;
      	}
      	return tmp;
      }
      
      def code(c, x, y):
      	tmp = 0
      	if (y <= -3.2e-13) or not (y <= 6.5e-91):
      		tmp = math.log1p((math.expm1(x) * y)) * c
      	else:
      		tmp = (math.expm1(x) * c) * y
      	return tmp
      
      function code(c, x, y)
      	tmp = 0.0
      	if ((y <= -3.2e-13) || !(y <= 6.5e-91))
      		tmp = Float64(log1p(Float64(expm1(x) * y)) * c);
      	else
      		tmp = Float64(Float64(expm1(x) * c) * y);
      	end
      	return tmp
      end
      
      code[c_, x_, y_] := If[Or[LessEqual[y, -3.2e-13], N[Not[LessEqual[y, 6.5e-91]], $MachinePrecision]], N[(N[Log[1 + N[(N[(Exp[x] - 1), $MachinePrecision] * y), $MachinePrecision]], $MachinePrecision] * c), $MachinePrecision], N[(N[(N[(Exp[x] - 1), $MachinePrecision] * c), $MachinePrecision] * y), $MachinePrecision]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;y \leq -3.2 \cdot 10^{-13} \lor \neg \left(y \leq 6.5 \cdot 10^{-91}\right):\\
      \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(x\right) \cdot y\right) \cdot c\\
      
      \mathbf{else}:\\
      \;\;\;\;\left(\mathsf{expm1}\left(x\right) \cdot c\right) \cdot y\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if y < -3.2e-13 or 6.5000000000000001e-91 < y

        1. Initial program 35.6%

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

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

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

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

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

            \[\leadsto \log \color{blue}{\left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right)} \cdot c \]
          6. lower-log1p.f6439.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-*.f6439.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. lower-expm1.f64N/A

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

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

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

            \[\leadsto \mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(\color{blue}{x \cdot 1}\right)\right) \cdot c \]
          17. lower-*.f6498.8

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

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

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

            \[\leadsto \mathsf{log1p}\left(\color{blue}{\mathsf{expm1}\left(x \cdot 1\right) \cdot y}\right) \cdot c \]
          3. lower-*.f6498.8

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

            \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\color{blue}{x \cdot 1}\right) \cdot y\right) \cdot c \]
          5. *-rgt-identity98.8

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

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

        if -3.2e-13 < y < 6.5000000000000001e-91

        1. Initial program 39.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-*.f6439.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.f6463.7

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

            \[\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. lower-expm1.f64N/A

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

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

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

            \[\leadsto \mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(\color{blue}{x \cdot 1}\right)\right) \cdot c \]
          17. lower-*.f6484.3

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

          \[\leadsto \color{blue}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(x \cdot 1\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 c \cdot \color{blue}{\left(\left(e^{x} - 1\right) \cdot y\right)} \]
          2. associate-*r*N/A

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

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

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

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

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

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3.2 \cdot 10^{-13} \lor \neg \left(y \leq 6.5 \cdot 10^{-91}\right):\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(x\right) \cdot y\right) \cdot c\\ \mathbf{else}:\\ \;\;\;\;\left(\mathsf{expm1}\left(x\right) \cdot c\right) \cdot y\\ \end{array} \]
      5. Add Preprocessing

      Alternative 4: 90.0% accurate, 1.5× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -150:\\ \;\;\;\;\mathsf{log1p}\left(x \cdot y\right) \cdot c\\ \mathbf{elif}\;y \leq 25000000000:\\ \;\;\;\;\left(\mathsf{expm1}\left(x\right) \cdot c\right) \cdot y\\ \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 -150.0)
         (* (log1p (* x y)) c)
         (if (<= y 25000000000.0)
           (* (* (expm1 x) c) y)
           (*
            (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 <= -150.0) {
      		tmp = log1p((x * y)) * c;
      	} else if (y <= 25000000000.0) {
      		tmp = (expm1(x) * c) * y;
      	} 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 <= -150.0)
      		tmp = Float64(log1p(Float64(x * y)) * c);
      	elseif (y <= 25000000000.0)
      		tmp = Float64(Float64(expm1(x) * c) * y);
      	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, -150.0], N[(N[Log[1 + N[(x * y), $MachinePrecision]], $MachinePrecision] * c), $MachinePrecision], If[LessEqual[y, 25000000000.0], N[(N[(N[(Exp[x] - 1), $MachinePrecision] * c), $MachinePrecision] * y), $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 -150:\\
      \;\;\;\;\mathsf{log1p}\left(x \cdot y\right) \cdot c\\
      
      \mathbf{elif}\;y \leq 25000000000:\\
      \;\;\;\;\left(\mathsf{expm1}\left(x\right) \cdot c\right) \cdot y\\
      
      \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 < -150

        1. Initial program 56.9%

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

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

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

            \[\leadsto c \cdot \log \left(1 + \color{blue}{\left(\left(\log \mathsf{E}\left(\right) + x \cdot \left(\frac{1}{2} \cdot {\log \mathsf{E}\left(\right)}^{2} + x \cdot \left(\frac{1}{24} \cdot \left(x \cdot {\log \mathsf{E}\left(\right)}^{4}\right) + \frac{1}{6} \cdot {\log \mathsf{E}\left(\right)}^{3}\right)\right)\right) \cdot x\right)} \cdot y\right) \]
        5. Applied rewrites28.4%

          \[\leadsto c \cdot \log \left(1 + \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)} \cdot y\right) \]
        6. Step-by-step derivation
          1. lift-*.f64N/A

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

            \[\leadsto \color{blue}{\log \left(1 + \left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{1}{24}, x, \frac{1}{6}\right), x, \frac{1}{2}\right), x, 1\right) \cdot x\right) \cdot y\right) \cdot c} \]
          3. lower-*.f6428.4

            \[\leadsto \color{blue}{\log \left(1 + \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} \]
          4. lift-log.f64N/A

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

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

            \[\leadsto \color{blue}{\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 \]
        7. Applied rewrites52.5%

          \[\leadsto \color{blue}{\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} \]
        8. Taylor expanded in x around 0

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

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

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

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

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

        if -150 < y < 2.5e10

        1. Initial program 37.9%

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

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

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

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

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

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

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

            \[\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. lower-expm1.f64N/A

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

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

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

            \[\leadsto \mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(\color{blue}{x \cdot 1}\right)\right) \cdot c \]
          17. lower-*.f6487.4

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

          \[\leadsto \color{blue}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(x \cdot 1\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 c \cdot \color{blue}{\left(\left(e^{x} - 1\right) \cdot y\right)} \]
          2. associate-*r*N/A

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

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

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

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

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

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

        if 2.5e10 < y

        1. Initial program 13.4%

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

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

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

            \[\leadsto c \cdot \log \left(1 + \color{blue}{\left(\left(\log \mathsf{E}\left(\right) + x \cdot \left(\frac{1}{2} \cdot {\log \mathsf{E}\left(\right)}^{2} + x \cdot \left(\frac{1}{24} \cdot \left(x \cdot {\log \mathsf{E}\left(\right)}^{4}\right) + \frac{1}{6} \cdot {\log \mathsf{E}\left(\right)}^{3}\right)\right)\right) \cdot x\right)} \cdot y\right) \]
        5. Applied rewrites55.0%

          \[\leadsto c \cdot \log \left(1 + \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)} \cdot y\right) \]
        6. Step-by-step derivation
          1. lift-*.f64N/A

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

            \[\leadsto \color{blue}{\log \left(1 + \left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{1}{24}, x, \frac{1}{6}\right), x, \frac{1}{2}\right), x, 1\right) \cdot x\right) \cdot y\right) \cdot c} \]
          3. lower-*.f6455.0

            \[\leadsto \color{blue}{\log \left(1 + \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} \]
          4. lift-log.f64N/A

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

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

            \[\leadsto \color{blue}{\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 \]
        7. Applied rewrites96.2%

          \[\leadsto \color{blue}{\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} \]
      3. Recombined 3 regimes into one program.
      4. Final simplification89.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -150:\\ \;\;\;\;\mathsf{log1p}\left(x \cdot y\right) \cdot c\\ \mathbf{elif}\;y \leq 25000000000:\\ \;\;\;\;\left(\mathsf{expm1}\left(x\right) \cdot c\right) \cdot y\\ \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 5: 90.0% accurate, 1.6× speedup?

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

        1. Initial program 56.9%

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

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

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

            \[\leadsto c \cdot \log \left(1 + \color{blue}{\left(\left(\log \mathsf{E}\left(\right) + x \cdot \left(\frac{1}{2} \cdot {\log \mathsf{E}\left(\right)}^{2} + x \cdot \left(\frac{1}{24} \cdot \left(x \cdot {\log \mathsf{E}\left(\right)}^{4}\right) + \frac{1}{6} \cdot {\log \mathsf{E}\left(\right)}^{3}\right)\right)\right) \cdot x\right)} \cdot y\right) \]
        5. Applied rewrites28.4%

          \[\leadsto c \cdot \log \left(1 + \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)} \cdot y\right) \]
        6. Step-by-step derivation
          1. lift-*.f64N/A

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

            \[\leadsto \color{blue}{\log \left(1 + \left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{1}{24}, x, \frac{1}{6}\right), x, \frac{1}{2}\right), x, 1\right) \cdot x\right) \cdot y\right) \cdot c} \]
          3. lower-*.f6428.4

            \[\leadsto \color{blue}{\log \left(1 + \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} \]
          4. lift-log.f64N/A

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

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

            \[\leadsto \color{blue}{\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 \]
        7. Applied rewrites52.5%

          \[\leadsto \color{blue}{\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} \]
        8. Taylor expanded in x around 0

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

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

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

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

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

        if -150 < y < 2.5e10

        1. Initial program 37.9%

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

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

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

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

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

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

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

            \[\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. lower-expm1.f64N/A

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

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

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

            \[\leadsto \mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(\color{blue}{x \cdot 1}\right)\right) \cdot c \]
          17. lower-*.f6487.4

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

          \[\leadsto \color{blue}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(x \cdot 1\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 c \cdot \color{blue}{\left(\left(e^{x} - 1\right) \cdot y\right)} \]
          2. associate-*r*N/A

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

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

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

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

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

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

        if 2.5e10 < y

        1. Initial program 13.4%

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

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

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

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

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

            \[\leadsto \log \color{blue}{\left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right)} \cdot c \]
          6. lower-log1p.f6413.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-*.f6413.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. lower-expm1.f64N/A

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

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

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

            \[\leadsto \mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(\color{blue}{x \cdot 1}\right)\right) \cdot c \]
          17. lower-*.f6497.3

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

          \[\leadsto \color{blue}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(x \cdot 1\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. fp-cancel-sign-sub-invN/A

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{log1p}\left(y \cdot \left(\left(1 - \left(\mathsf{neg}\left(x\right)\right) \cdot \color{blue}{\left(\frac{1}{6} \cdot \left(x \cdot {\log \mathsf{E}\left(\right)}^{3}\right) + \frac{1}{2} \cdot {\log \mathsf{E}\left(\right)}^{2}\right)}\right) \cdot x\right)\right) \cdot c \]
          11. fp-cancel-sign-sub-invN/A

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

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

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

          \[\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 3 regimes into one program.
      4. Final simplification89.7%

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

      Alternative 6: 90.0% accurate, 1.6× speedup?

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

        1. Initial program 56.9%

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

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

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

            \[\leadsto c \cdot \log \left(1 + \color{blue}{\left(\left(\log \mathsf{E}\left(\right) + x \cdot \left(\frac{1}{2} \cdot {\log \mathsf{E}\left(\right)}^{2} + x \cdot \left(\frac{1}{24} \cdot \left(x \cdot {\log \mathsf{E}\left(\right)}^{4}\right) + \frac{1}{6} \cdot {\log \mathsf{E}\left(\right)}^{3}\right)\right)\right) \cdot x\right)} \cdot y\right) \]
        5. Applied rewrites28.4%

          \[\leadsto c \cdot \log \left(1 + \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)} \cdot y\right) \]
        6. Step-by-step derivation
          1. lift-*.f64N/A

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

            \[\leadsto \color{blue}{\log \left(1 + \left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{1}{24}, x, \frac{1}{6}\right), x, \frac{1}{2}\right), x, 1\right) \cdot x\right) \cdot y\right) \cdot c} \]
          3. lower-*.f6428.4

            \[\leadsto \color{blue}{\log \left(1 + \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} \]
          4. lift-log.f64N/A

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

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

            \[\leadsto \color{blue}{\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 \]
        7. Applied rewrites52.5%

          \[\leadsto \color{blue}{\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} \]
        8. Taylor expanded in x around 0

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

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

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

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

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

        if -150 < y < 2.5e10

        1. Initial program 37.9%

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

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

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

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

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

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

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

            \[\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. lower-expm1.f64N/A

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

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

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

            \[\leadsto \mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(\color{blue}{x \cdot 1}\right)\right) \cdot c \]
          17. lower-*.f6487.4

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

          \[\leadsto \color{blue}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(x \cdot 1\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 c \cdot \color{blue}{\left(\left(e^{x} - 1\right) \cdot y\right)} \]
          2. associate-*r*N/A

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

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

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

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

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

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

        if 2.5e10 < y

        1. Initial program 13.4%

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

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

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

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

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

            \[\leadsto \log \color{blue}{\left(1 + \left({\mathsf{E}\left(\right)}^{x} - 1\right) \cdot y\right)} \cdot c \]
          6. lower-log1p.f6413.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-*.f6413.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. lower-expm1.f64N/A

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

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

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

            \[\leadsto \mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(\color{blue}{x \cdot 1}\right)\right) \cdot c \]
          17. lower-*.f6497.3

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

          \[\leadsto \color{blue}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(x \cdot 1\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.f6496.1

            \[\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 rewrites96.1%

          \[\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 3 regimes into one program.
      4. Final simplification89.7%

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

      Alternative 7: 82.2% accurate, 1.7× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := c \cdot \log \left(\mathsf{fma}\left(y, x, 1\right)\right)\\ \mathbf{if}\;y \leq -1.16 \cdot 10^{+154}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq 7 \cdot 10^{+73}:\\ \;\;\;\;\left(\mathsf{expm1}\left(x\right) \cdot c\right) \cdot y\\ \mathbf{elif}\;y \leq 1.12 \cdot 10^{+219}:\\ \;\;\;\;c \cdot \left(y \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
      (FPCore (c x y)
       :precision binary64
       (let* ((t_0 (* c (log (fma y x 1.0)))))
         (if (<= y -1.16e+154)
           t_0
           (if (<= y 7e+73)
             (* (* (expm1 x) c) y)
             (if (<= y 1.12e+219) (* c (* y x)) t_0)))))
      double code(double c, double x, double y) {
      	double t_0 = c * log(fma(y, x, 1.0));
      	double tmp;
      	if (y <= -1.16e+154) {
      		tmp = t_0;
      	} else if (y <= 7e+73) {
      		tmp = (expm1(x) * c) * y;
      	} else if (y <= 1.12e+219) {
      		tmp = c * (y * x);
      	} else {
      		tmp = t_0;
      	}
      	return tmp;
      }
      
      function code(c, x, y)
      	t_0 = Float64(c * log(fma(y, x, 1.0)))
      	tmp = 0.0
      	if (y <= -1.16e+154)
      		tmp = t_0;
      	elseif (y <= 7e+73)
      		tmp = Float64(Float64(expm1(x) * c) * y);
      	elseif (y <= 1.12e+219)
      		tmp = Float64(c * Float64(y * x));
      	else
      		tmp = t_0;
      	end
      	return tmp
      end
      
      code[c_, x_, y_] := Block[{t$95$0 = N[(c * N[Log[N[(y * x + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.16e+154], t$95$0, If[LessEqual[y, 7e+73], N[(N[(N[(Exp[x] - 1), $MachinePrecision] * c), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[y, 1.12e+219], N[(c * N[(y * x), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := c \cdot \log \left(\mathsf{fma}\left(y, x, 1\right)\right)\\
      \mathbf{if}\;y \leq -1.16 \cdot 10^{+154}:\\
      \;\;\;\;t\_0\\
      
      \mathbf{elif}\;y \leq 7 \cdot 10^{+73}:\\
      \;\;\;\;\left(\mathsf{expm1}\left(x\right) \cdot c\right) \cdot y\\
      
      \mathbf{elif}\;y \leq 1.12 \cdot 10^{+219}:\\
      \;\;\;\;c \cdot \left(y \cdot x\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_0\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if y < -1.16000000000000001e154 or 1.1199999999999999e219 < y

        1. Initial program 37.7%

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

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

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

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

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

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

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

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

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

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

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

        if -1.16000000000000001e154 < y < 7.00000000000000004e73

        1. Initial program 40.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-*.f6440.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.f6458.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-*.f6458.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. lower-expm1.f64N/A

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

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

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

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

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

          \[\leadsto \color{blue}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(x \cdot 1\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 c \cdot \color{blue}{\left(\left(e^{x} - 1\right) \cdot y\right)} \]
          2. associate-*r*N/A

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

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

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

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

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

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

        if 7.00000000000000004e73 < y < 1.1199999999999999e219

        1. Initial program 12.6%

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

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

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

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

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

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

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

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

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

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

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

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

      Alternative 8: 89.9% accurate, 1.8× speedup?

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

        1. Initial program 37.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 c \cdot \log \left(1 + \color{blue}{\left(x \cdot \left(\log \mathsf{E}\left(\right) + x \cdot \left(\frac{1}{2} \cdot {\log \mathsf{E}\left(\right)}^{2} + x \cdot \left(\frac{1}{24} \cdot \left(x \cdot {\log \mathsf{E}\left(\right)}^{4}\right) + \frac{1}{6} \cdot {\log \mathsf{E}\left(\right)}^{3}\right)\right)\right)\right)} \cdot y\right) \]
        4. Step-by-step derivation
          1. *-commutativeN/A

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

            \[\leadsto c \cdot \log \left(1 + \color{blue}{\left(\left(\log \mathsf{E}\left(\right) + x \cdot \left(\frac{1}{2} \cdot {\log \mathsf{E}\left(\right)}^{2} + x \cdot \left(\frac{1}{24} \cdot \left(x \cdot {\log \mathsf{E}\left(\right)}^{4}\right) + \frac{1}{6} \cdot {\log \mathsf{E}\left(\right)}^{3}\right)\right)\right) \cdot x\right)} \cdot y\right) \]
        5. Applied rewrites40.4%

          \[\leadsto c \cdot \log \left(1 + \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)} \cdot y\right) \]
        6. Step-by-step derivation
          1. lift-*.f64N/A

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

            \[\leadsto \color{blue}{\log \left(1 + \left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{1}{24}, x, \frac{1}{6}\right), x, \frac{1}{2}\right), x, 1\right) \cdot x\right) \cdot y\right) \cdot c} \]
          3. lower-*.f6440.4

            \[\leadsto \color{blue}{\log \left(1 + \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} \]
          4. lift-log.f64N/A

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

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

            \[\leadsto \color{blue}{\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 \]
        7. Applied rewrites72.2%

          \[\leadsto \color{blue}{\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} \]
        8. Taylor expanded in x around 0

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

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

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

            \[\leadsto \mathsf{log1p}\left(\color{blue}{\left(1 \cdot x\right)} \cdot y\right) \cdot c \]
        10. Applied rewrites74.9%

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

        if -150 < y < 2.5e10

        1. Initial program 37.9%

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

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

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

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

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

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

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

            \[\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. lower-expm1.f64N/A

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

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

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

            \[\leadsto \mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(\color{blue}{x \cdot 1}\right)\right) \cdot c \]
          17. lower-*.f6487.4

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

          \[\leadsto \color{blue}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(x \cdot 1\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 c \cdot \color{blue}{\left(\left(e^{x} - 1\right) \cdot y\right)} \]
          2. associate-*r*N/A

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

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

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

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

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

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -150 \lor \neg \left(y \leq 25000000000\right):\\ \;\;\;\;\mathsf{log1p}\left(x \cdot y\right) \cdot c\\ \mathbf{else}:\\ \;\;\;\;\left(\mathsf{expm1}\left(x\right) \cdot c\right) \cdot y\\ \end{array} \]
      5. Add Preprocessing

      Alternative 9: 78.1% accurate, 1.9× speedup?

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

        1. Initial program 41.9%

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

            \[\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.f6457.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-*.f6457.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. lower-expm1.f64N/A

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

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

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

            \[\leadsto \mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(\color{blue}{x \cdot 1}\right)\right) \cdot c \]
          17. lower-*.f6491.0

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

          \[\leadsto \color{blue}{\mathsf{log1p}\left(y \cdot \mathsf{expm1}\left(x \cdot 1\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 c \cdot \color{blue}{\left(\left(e^{x} - 1\right) \cdot y\right)} \]
          2. associate-*r*N/A

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

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

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

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

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

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

        if 7.00000000000000004e73 < y

        1. Initial program 9.8%

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

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

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

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

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

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

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

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

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

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

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

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

      Alternative 10: 62.9% accurate, 12.8× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;c \leq 4 \cdot 10^{+38}:\\ \;\;\;\;\left(y \cdot c\right) \cdot x\\ \mathbf{else}:\\ \;\;\;\;\left(c \cdot x\right) \cdot y\\ \end{array} \end{array} \]
      (FPCore (c x y)
       :precision binary64
       (if (<= c 4e+38) (* (* y c) x) (* (* c x) y)))
      double code(double c, double x, double y) {
      	double tmp;
      	if (c <= 4e+38) {
      		tmp = (y * c) * x;
      	} else {
      		tmp = (c * x) * y;
      	}
      	return tmp;
      }
      
      module fmin_fmax_functions
          implicit none
          private
          public fmax
          public fmin
      
          interface fmax
              module procedure fmax88
              module procedure fmax44
              module procedure fmax84
              module procedure fmax48
          end interface
          interface fmin
              module procedure fmin88
              module procedure fmin44
              module procedure fmin84
              module procedure fmin48
          end interface
      contains
          real(8) function fmax88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(4) function fmax44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(8) function fmax84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmax48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
          end function
          real(8) function fmin88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(4) function fmin44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(8) function fmin84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmin48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
          end function
      end module
      
      real(8) function code(c, x, y)
      use fmin_fmax_functions
          real(8), intent (in) :: c
          real(8), intent (in) :: x
          real(8), intent (in) :: y
          real(8) :: tmp
          if (c <= 4d+38) then
              tmp = (y * c) * x
          else
              tmp = (c * x) * y
          end if
          code = tmp
      end function
      
      public static double code(double c, double x, double y) {
      	double tmp;
      	if (c <= 4e+38) {
      		tmp = (y * c) * x;
      	} else {
      		tmp = (c * x) * y;
      	}
      	return tmp;
      }
      
      def code(c, x, y):
      	tmp = 0
      	if c <= 4e+38:
      		tmp = (y * c) * x
      	else:
      		tmp = (c * x) * y
      	return tmp
      
      function code(c, x, y)
      	tmp = 0.0
      	if (c <= 4e+38)
      		tmp = Float64(Float64(y * c) * x);
      	else
      		tmp = Float64(Float64(c * x) * y);
      	end
      	return tmp
      end
      
      function tmp_2 = code(c, x, y)
      	tmp = 0.0;
      	if (c <= 4e+38)
      		tmp = (y * c) * x;
      	else
      		tmp = (c * x) * y;
      	end
      	tmp_2 = tmp;
      end
      
      code[c_, x_, y_] := If[LessEqual[c, 4e+38], N[(N[(y * c), $MachinePrecision] * x), $MachinePrecision], N[(N[(c * x), $MachinePrecision] * y), $MachinePrecision]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;c \leq 4 \cdot 10^{+38}:\\
      \;\;\;\;\left(y \cdot c\right) \cdot x\\
      
      \mathbf{else}:\\
      \;\;\;\;\left(c \cdot x\right) \cdot y\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if c < 3.99999999999999991e38

        1. Initial program 46.8%

          \[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. *-rgt-identityN/A

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

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

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

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

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

            \[\leadsto \color{blue}{\left(c \cdot \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. associate-*r*N/A

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

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

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

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

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

        if 3.99999999999999991e38 < c

        1. Initial program 9.6%

          \[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. *-rgt-identityN/A

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

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

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

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

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

            \[\leadsto \color{blue}{\left(c \cdot \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. associate-*r*N/A

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

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

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

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

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

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

          \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq 4 \cdot 10^{+38}:\\ \;\;\;\;\left(y \cdot c\right) \cdot x\\ \mathbf{else}:\\ \;\;\;\;\left(c \cdot x\right) \cdot y\\ \end{array} \]
        9. Add Preprocessing

        Alternative 11: 58.9% accurate, 19.8× speedup?

        \[\begin{array}{l} \\ \left(c \cdot x\right) \cdot y \end{array} \]
        (FPCore (c x y) :precision binary64 (* (* c x) y))
        double code(double c, double x, double y) {
        	return (c * x) * y;
        }
        
        module fmin_fmax_functions
            implicit none
            private
            public fmax
            public fmin
        
            interface fmax
                module procedure fmax88
                module procedure fmax44
                module procedure fmax84
                module procedure fmax48
            end interface
            interface fmin
                module procedure fmin88
                module procedure fmin44
                module procedure fmin84
                module procedure fmin48
            end interface
        contains
            real(8) function fmax88(x, y) result (res)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
            end function
            real(4) function fmax44(x, y) result (res)
                real(4), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
            end function
            real(8) function fmax84(x, y) result(res)
                real(8), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
            end function
            real(8) function fmax48(x, y) result(res)
                real(4), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
            end function
            real(8) function fmin88(x, y) result (res)
                real(8), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
            end function
            real(4) function fmin44(x, y) result (res)
                real(4), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
            end function
            real(8) function fmin84(x, y) result(res)
                real(8), intent (in) :: x
                real(4), intent (in) :: y
                res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
            end function
            real(8) function fmin48(x, y) result(res)
                real(4), intent (in) :: x
                real(8), intent (in) :: y
                res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
            end function
        end module
        
        real(8) function code(c, x, y)
        use fmin_fmax_functions
            real(8), intent (in) :: c
            real(8), intent (in) :: x
            real(8), intent (in) :: y
            code = (c * x) * y
        end function
        
        public static double code(double c, double x, double y) {
        	return (c * x) * y;
        }
        
        def code(c, x, y):
        	return (c * x) * y
        
        function code(c, x, y)
        	return Float64(Float64(c * x) * y)
        end
        
        function tmp = code(c, x, y)
        	tmp = (c * x) * y;
        end
        
        code[c_, x_, y_] := N[(N[(c * x), $MachinePrecision] * y), $MachinePrecision]
        
        \begin{array}{l}
        
        \\
        \left(c \cdot x\right) \cdot y
        \end{array}
        
        Derivation
        1. Initial program 37.7%

          \[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. *-rgt-identityN/A

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

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

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

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

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

            \[\leadsto \color{blue}{\left(c \cdot \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. associate-*r*N/A

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

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

            \[\leadsto \color{blue}{\left(y \cdot c\right)} \cdot x \]
          23. lower-*.f6462.3

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

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

            \[\leadsto \left(c \cdot x\right) \cdot \color{blue}{y} \]
          2. Final simplification57.8%

            \[\leadsto \left(c \cdot x\right) \cdot y \]
          3. Add Preprocessing

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

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

          Reproduce

          ?
          herbie shell --seed 2025017 
          (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)))))