Logarithmic Transform

Percentage Accurate: 41.7% → 99.0%
Time: 31.6s
Alternatives: 10
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 10 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: 41.7% accurate, 1.0× speedup?

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

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

Alternative 1: 99.0% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -2 \cdot 10^{-106} \lor \neg \left(y \leq 2 \cdot 10^{-11}\right):\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(x\right) \cdot y\right) \cdot c\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-0.5, {\left(\mathsf{expm1}\left(x\right)\right)}^{2} \cdot y, \mathsf{expm1}\left(x\right)\right) \cdot \left(c \cdot y\right)\\ \end{array} \end{array} \]
(FPCore (c x y)
 :precision binary64
 (if (or (<= y -2e-106) (not (<= y 2e-11)))
   (* (log1p (* (expm1 x) y)) c)
   (* (fma -0.5 (* (pow (expm1 x) 2.0) y) (expm1 x)) (* c y))))
double code(double c, double x, double y) {
	double tmp;
	if ((y <= -2e-106) || !(y <= 2e-11)) {
		tmp = log1p((expm1(x) * y)) * c;
	} else {
		tmp = fma(-0.5, (pow(expm1(x), 2.0) * y), expm1(x)) * (c * y);
	}
	return tmp;
}
function code(c, x, y)
	tmp = 0.0
	if ((y <= -2e-106) || !(y <= 2e-11))
		tmp = Float64(log1p(Float64(expm1(x) * y)) * c);
	else
		tmp = Float64(fma(-0.5, Float64((expm1(x) ^ 2.0) * y), expm1(x)) * Float64(c * y));
	end
	return tmp
end
code[c_, x_, y_] := If[Or[LessEqual[y, -2e-106], N[Not[LessEqual[y, 2e-11]], $MachinePrecision]], N[(N[Log[1 + N[(N[(Exp[x] - 1), $MachinePrecision] * y), $MachinePrecision]], $MachinePrecision] * c), $MachinePrecision], N[(N[(-0.5 * N[(N[Power[N[(Exp[x] - 1), $MachinePrecision], 2.0], $MachinePrecision] * y), $MachinePrecision] + N[(Exp[x] - 1), $MachinePrecision]), $MachinePrecision] * N[(c * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -2 \cdot 10^{-106} \lor \neg \left(y \leq 2 \cdot 10^{-11}\right):\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(x\right) \cdot y\right) \cdot c\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.5, {\left(\mathsf{expm1}\left(x\right)\right)}^{2} \cdot y, \mathsf{expm1}\left(x\right)\right) \cdot \left(c \cdot y\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.99999999999999988e-106 or 1.99999999999999988e-11 < y

    1. Initial program 35.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-*.f6435.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.f6442.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-*.f6442.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.6

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

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

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

      if -1.99999999999999988e-106 < y < 1.99999999999999988e-11

      1. Initial program 35.0%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2 \cdot 10^{-106} \lor \neg \left(y \leq 2 \cdot 10^{-11}\right):\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(x\right) \cdot y\right) \cdot c\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-0.5, {\left(\mathsf{expm1}\left(x\right)\right)}^{2} \cdot y, \mathsf{expm1}\left(x\right)\right) \cdot \left(c \cdot y\right)\\ \end{array} \]
      9. Add Preprocessing

      Alternative 2: 92.4% accurate, 0.9× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;c \leq 1.1 \cdot 10^{+177} \lor \neg \left(c \leq 4 \cdot 10^{+231}\right):\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(x\right) \cdot y\right) \cdot c\\ \mathbf{else}:\\ \;\;\;\;\left(c \cdot \mathsf{fma}\left({\left({\mathsf{E}\left(\right)}^{x} - 1\right)}^{2} \cdot y, -0.5, \mathsf{fma}\left(0.5, x, 1\right) \cdot x\right)\right) \cdot y\\ \end{array} \end{array} \]
      (FPCore (c x y)
       :precision binary64
       (if (or (<= c 1.1e+177) (not (<= c 4e+231)))
         (* (log1p (* (expm1 x) y)) c)
         (*
          (* c (fma (* (pow (- (pow (E) x) 1.0) 2.0) y) -0.5 (* (fma 0.5 x 1.0) x)))
          y)))
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;c \leq 1.1 \cdot 10^{+177} \lor \neg \left(c \leq 4 \cdot 10^{+231}\right):\\
      \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(x\right) \cdot y\right) \cdot c\\
      
      \mathbf{else}:\\
      \;\;\;\;\left(c \cdot \mathsf{fma}\left({\left({\mathsf{E}\left(\right)}^{x} - 1\right)}^{2} \cdot y, -0.5, \mathsf{fma}\left(0.5, x, 1\right) \cdot x\right)\right) \cdot y\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if c < 1.0999999999999999e177 or 4.0000000000000002e231 < c

        1. Initial program 37.1%

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

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

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

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

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

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

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

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

          if 1.0999999999999999e177 < c < 4.0000000000000002e231

          1. Initial program 4.4%

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \left(c \cdot \mathsf{fma}\left({\left({\mathsf{E}\left(\right)}^{x} - 1\right)}^{2} \cdot y, -0.5, \mathsf{fma}\left(0.5, x, 1\right) \cdot x\right)\right) \cdot y \]
          8. Recombined 2 regimes into one program.
          9. Final simplification95.1%

            \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq 1.1 \cdot 10^{+177} \lor \neg \left(c \leq 4 \cdot 10^{+231}\right):\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(x\right) \cdot y\right) \cdot c\\ \mathbf{else}:\\ \;\;\;\;\left(c \cdot \mathsf{fma}\left({\left({\mathsf{E}\left(\right)}^{x} - 1\right)}^{2} \cdot y, -0.5, \mathsf{fma}\left(0.5, x, 1\right) \cdot x\right)\right) \cdot y\\ \end{array} \]
          10. Add Preprocessing

          Alternative 3: 92.4% accurate, 1.0× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;c \leq 1.1 \cdot 10^{+177} \lor \neg \left(c \leq 4 \cdot 10^{+231}\right):\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(x\right) \cdot y\right) \cdot c\\ \mathbf{else}:\\ \;\;\;\;\left(\mathsf{fma}\left(\left(x \cdot x\right) \cdot y, \mathsf{fma}\left(\mathsf{fma}\left(-0.2916666666666667, x, -0.5\right), x, -0.5\right), \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 c\right) \cdot y\\ \end{array} \end{array} \]
          (FPCore (c x y)
           :precision binary64
           (if (or (<= c 1.1e+177) (not (<= c 4e+231)))
             (* (log1p (* (expm1 x) y)) c)
             (*
              (*
               (fma
                (* (* x x) y)
                (fma (fma -0.2916666666666667 x -0.5) x -0.5)
                (*
                 (fma (fma (fma 0.041666666666666664 x 0.16666666666666666) x 0.5) x 1.0)
                 x))
               c)
              y)))
          double code(double c, double x, double y) {
          	double tmp;
          	if ((c <= 1.1e+177) || !(c <= 4e+231)) {
          		tmp = log1p((expm1(x) * y)) * c;
          	} else {
          		tmp = (fma(((x * x) * y), fma(fma(-0.2916666666666667, x, -0.5), x, -0.5), (fma(fma(fma(0.041666666666666664, x, 0.16666666666666666), x, 0.5), x, 1.0) * x)) * c) * y;
          	}
          	return tmp;
          }
          
          function code(c, x, y)
          	tmp = 0.0
          	if ((c <= 1.1e+177) || !(c <= 4e+231))
          		tmp = Float64(log1p(Float64(expm1(x) * y)) * c);
          	else
          		tmp = Float64(Float64(fma(Float64(Float64(x * x) * y), fma(fma(-0.2916666666666667, x, -0.5), x, -0.5), Float64(fma(fma(fma(0.041666666666666664, x, 0.16666666666666666), x, 0.5), x, 1.0) * x)) * c) * y);
          	end
          	return tmp
          end
          
          code[c_, x_, y_] := If[Or[LessEqual[c, 1.1e+177], N[Not[LessEqual[c, 4e+231]], $MachinePrecision]], N[(N[Log[1 + N[(N[(Exp[x] - 1), $MachinePrecision] * y), $MachinePrecision]], $MachinePrecision] * c), $MachinePrecision], N[(N[(N[(N[(N[(x * x), $MachinePrecision] * y), $MachinePrecision] * N[(N[(-0.2916666666666667 * x + -0.5), $MachinePrecision] * x + -0.5), $MachinePrecision] + N[(N[(N[(N[(0.041666666666666664 * x + 0.16666666666666666), $MachinePrecision] * x + 0.5), $MachinePrecision] * x + 1.0), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * y), $MachinePrecision]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;c \leq 1.1 \cdot 10^{+177} \lor \neg \left(c \leq 4 \cdot 10^{+231}\right):\\
          \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(x\right) \cdot y\right) \cdot c\\
          
          \mathbf{else}:\\
          \;\;\;\;\left(\mathsf{fma}\left(\left(x \cdot x\right) \cdot y, \mathsf{fma}\left(\mathsf{fma}\left(-0.2916666666666667, x, -0.5\right), x, -0.5\right), \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 c\right) \cdot y\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if c < 1.0999999999999999e177 or 4.0000000000000002e231 < c

            1. Initial program 37.1%

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

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

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

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

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

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

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

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

              if 1.0999999999999999e177 < c < 4.0000000000000002e231

              1. Initial program 4.4%

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(c \cdot \mathsf{fma}\left(\mathsf{fma}\left(-0.5, y, 0.16666666666666666\right), y, \left(\mathsf{fma}\left(0.5833333333333334 \cdot y, -0.5, 0.041666666666666664\right) \cdot y\right) \cdot x\right), x, \left(\mathsf{fma}\left(-0.5, y, 0.5\right) \cdot y\right) \cdot c\right), x, c \cdot y\right) \cdot \color{blue}{x} \]
              8. Taylor expanded in y around 0

                \[\leadsto y \cdot \left(x \cdot \left(c + x \cdot \left(\frac{1}{2} \cdot c + c \cdot \left(x \cdot \left(\frac{1}{6} + \frac{1}{24} \cdot x\right)\right)\right)\right) + \color{blue}{{x}^{2} \cdot \left(y \cdot \left(\frac{-1}{2} \cdot c + c \cdot \left(x \cdot \left(\frac{-7}{24} \cdot x - \frac{1}{2}\right)\right)\right)\right)}\right) \]
              9. Step-by-step derivation
                1. Applied rewrites93.2%

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

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

                    \[\leadsto \left(\mathsf{fma}\left(\left(x \cdot x\right) \cdot y, \mathsf{fma}\left(\mathsf{fma}\left(-0.2916666666666667, x, -0.5\right), x, -0.5\right), \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 c\right) \cdot y \]
                4. Recombined 2 regimes into one program.
                5. Final simplification95.1%

                  \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq 1.1 \cdot 10^{+177} \lor \neg \left(c \leq 4 \cdot 10^{+231}\right):\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(x\right) \cdot y\right) \cdot c\\ \mathbf{else}:\\ \;\;\;\;\left(\mathsf{fma}\left(\left(x \cdot x\right) \cdot y, \mathsf{fma}\left(\mathsf{fma}\left(-0.2916666666666667, x, -0.5\right), x, -0.5\right), \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 c\right) \cdot y\\ \end{array} \]
                6. Add Preprocessing

                Alternative 4: 83.1% accurate, 1.4× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -0.066:\\ \;\;\;\;\left(\mathsf{expm1}\left(x\right) \cdot y\right) \cdot c\\ \mathbf{elif}\;x \leq -2.6 \cdot 10^{-191} \lor \neg \left(x \leq 4.2 \cdot 10^{-208}\right):\\ \;\;\;\;\mathsf{log1p}\left(y \cdot \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.041666666666666664, x, 0.16666666666666666\right), x, 0.5\right) \cdot x, x, x\right)\right) \cdot c\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot c\right) \cdot y\\ \end{array} \end{array} \]
                (FPCore (c x y)
                 :precision binary64
                 (if (<= x -0.066)
                   (* (* (expm1 x) y) c)
                   (if (or (<= x -2.6e-191) (not (<= x 4.2e-208)))
                     (*
                      (log1p
                       (*
                        y
                        (fma
                         (* (fma (fma 0.041666666666666664 x 0.16666666666666666) x 0.5) x)
                         x
                         x)))
                      c)
                     (* (* x c) y))))
                double code(double c, double x, double y) {
                	double tmp;
                	if (x <= -0.066) {
                		tmp = (expm1(x) * y) * c;
                	} else if ((x <= -2.6e-191) || !(x <= 4.2e-208)) {
                		tmp = log1p((y * fma((fma(fma(0.041666666666666664, x, 0.16666666666666666), x, 0.5) * x), x, x))) * c;
                	} else {
                		tmp = (x * c) * y;
                	}
                	return tmp;
                }
                
                function code(c, x, y)
                	tmp = 0.0
                	if (x <= -0.066)
                		tmp = Float64(Float64(expm1(x) * y) * c);
                	elseif ((x <= -2.6e-191) || !(x <= 4.2e-208))
                		tmp = Float64(log1p(Float64(y * fma(Float64(fma(fma(0.041666666666666664, x, 0.16666666666666666), x, 0.5) * x), x, x))) * c);
                	else
                		tmp = Float64(Float64(x * c) * y);
                	end
                	return tmp
                end
                
                code[c_, x_, y_] := If[LessEqual[x, -0.066], N[(N[(N[(Exp[x] - 1), $MachinePrecision] * y), $MachinePrecision] * c), $MachinePrecision], If[Or[LessEqual[x, -2.6e-191], N[Not[LessEqual[x, 4.2e-208]], $MachinePrecision]], N[(N[Log[1 + N[(y * N[(N[(N[(N[(0.041666666666666664 * x + 0.16666666666666666), $MachinePrecision] * x + 0.5), $MachinePrecision] * x), $MachinePrecision] * x + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * c), $MachinePrecision], N[(N[(x * c), $MachinePrecision] * y), $MachinePrecision]]]
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                \mathbf{if}\;x \leq -0.066:\\
                \;\;\;\;\left(\mathsf{expm1}\left(x\right) \cdot y\right) \cdot c\\
                
                \mathbf{elif}\;x \leq -2.6 \cdot 10^{-191} \lor \neg \left(x \leq 4.2 \cdot 10^{-208}\right):\\
                \;\;\;\;\mathsf{log1p}\left(y \cdot \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.041666666666666664, x, 0.16666666666666666\right), x, 0.5\right) \cdot x, x, x\right)\right) \cdot c\\
                
                \mathbf{else}:\\
                \;\;\;\;\left(x \cdot c\right) \cdot y\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 3 regimes
                2. if x < -0.066000000000000003

                  1. Initial program 43.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-*.f6443.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.f6499.9

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

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

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

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

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

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

                      \[\leadsto \mathsf{log1p}\left(y \cdot \left(\color{blue}{e^{\log \mathsf{E}\left(\right) \cdot x}} - 1\right)\right) \cdot c \]
                    13. 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.9

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

                    \[\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 \color{blue}{\left(y \cdot \left(e^{x} - 1\right)\right) \cdot c} \]
                    2. lower-*.f64N/A

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

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

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

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

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

                  if -0.066000000000000003 < x < -2.59999999999999986e-191 or 4.20000000000000024e-208 < x

                  1. Initial program 26.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-*.f6426.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.f6428.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-*.f6428.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-*.f6492.3

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

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

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

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

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

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

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

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

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

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

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

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

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

                  if -2.59999999999999986e-191 < x < 4.20000000000000024e-208

                  1. Initial program 38.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 \left(c \cdot \color{blue}{\left(y \cdot 1\right)}\right) \cdot x \]
                    8. metadata-evalN/A

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -0.066:\\ \;\;\;\;\left(\mathsf{expm1}\left(x\right) \cdot y\right) \cdot c\\ \mathbf{elif}\;x \leq -2.6 \cdot 10^{-191} \lor \neg \left(x \leq 4.2 \cdot 10^{-208}\right):\\ \;\;\;\;\mathsf{log1p}\left(y \cdot \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.041666666666666664, x, 0.16666666666666666\right), x, 0.5\right) \cdot x, x, x\right)\right) \cdot c\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot c\right) \cdot y\\ \end{array} \]
                  9. Add Preprocessing

                  Alternative 5: 83.1% accurate, 1.4× speedup?

                  \[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(\mathsf{fma}\left(0.041666666666666664, x, 0.16666666666666666\right), x, 0.5\right)\\ \mathbf{if}\;x \leq -0.066:\\ \;\;\;\;\left(\mathsf{expm1}\left(x\right) \cdot y\right) \cdot c\\ \mathbf{elif}\;x \leq -2.6 \cdot 10^{-191}:\\ \;\;\;\;\mathsf{log1p}\left(\left(\mathsf{fma}\left(t\_0, x, 1\right) \cdot x\right) \cdot y\right) \cdot c\\ \mathbf{elif}\;x \leq 4.2 \cdot 10^{-208}:\\ \;\;\;\;\left(x \cdot c\right) \cdot y\\ \mathbf{else}:\\ \;\;\;\;\mathsf{log1p}\left(y \cdot \mathsf{fma}\left(t\_0 \cdot x, x, x\right)\right) \cdot c\\ \end{array} \end{array} \]
                  (FPCore (c x y)
                   :precision binary64
                   (let* ((t_0 (fma (fma 0.041666666666666664 x 0.16666666666666666) x 0.5)))
                     (if (<= x -0.066)
                       (* (* (expm1 x) y) c)
                       (if (<= x -2.6e-191)
                         (* (log1p (* (* (fma t_0 x 1.0) x) y)) c)
                         (if (<= x 4.2e-208)
                           (* (* x c) y)
                           (* (log1p (* y (fma (* t_0 x) x x))) c))))))
                  double code(double c, double x, double y) {
                  	double t_0 = fma(fma(0.041666666666666664, x, 0.16666666666666666), x, 0.5);
                  	double tmp;
                  	if (x <= -0.066) {
                  		tmp = (expm1(x) * y) * c;
                  	} else if (x <= -2.6e-191) {
                  		tmp = log1p(((fma(t_0, x, 1.0) * x) * y)) * c;
                  	} else if (x <= 4.2e-208) {
                  		tmp = (x * c) * y;
                  	} else {
                  		tmp = log1p((y * fma((t_0 * x), x, x))) * c;
                  	}
                  	return tmp;
                  }
                  
                  function code(c, x, y)
                  	t_0 = fma(fma(0.041666666666666664, x, 0.16666666666666666), x, 0.5)
                  	tmp = 0.0
                  	if (x <= -0.066)
                  		tmp = Float64(Float64(expm1(x) * y) * c);
                  	elseif (x <= -2.6e-191)
                  		tmp = Float64(log1p(Float64(Float64(fma(t_0, x, 1.0) * x) * y)) * c);
                  	elseif (x <= 4.2e-208)
                  		tmp = Float64(Float64(x * c) * y);
                  	else
                  		tmp = Float64(log1p(Float64(y * fma(Float64(t_0 * x), x, x))) * c);
                  	end
                  	return tmp
                  end
                  
                  code[c_, x_, y_] := Block[{t$95$0 = N[(N[(0.041666666666666664 * x + 0.16666666666666666), $MachinePrecision] * x + 0.5), $MachinePrecision]}, If[LessEqual[x, -0.066], N[(N[(N[(Exp[x] - 1), $MachinePrecision] * y), $MachinePrecision] * c), $MachinePrecision], If[LessEqual[x, -2.6e-191], N[(N[Log[1 + N[(N[(N[(t$95$0 * x + 1.0), $MachinePrecision] * x), $MachinePrecision] * y), $MachinePrecision]], $MachinePrecision] * c), $MachinePrecision], If[LessEqual[x, 4.2e-208], N[(N[(x * c), $MachinePrecision] * y), $MachinePrecision], N[(N[Log[1 + N[(y * N[(N[(t$95$0 * x), $MachinePrecision] * x + x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * c), $MachinePrecision]]]]]
                  
                  \begin{array}{l}
                  
                  \\
                  \begin{array}{l}
                  t_0 := \mathsf{fma}\left(\mathsf{fma}\left(0.041666666666666664, x, 0.16666666666666666\right), x, 0.5\right)\\
                  \mathbf{if}\;x \leq -0.066:\\
                  \;\;\;\;\left(\mathsf{expm1}\left(x\right) \cdot y\right) \cdot c\\
                  
                  \mathbf{elif}\;x \leq -2.6 \cdot 10^{-191}:\\
                  \;\;\;\;\mathsf{log1p}\left(\left(\mathsf{fma}\left(t\_0, x, 1\right) \cdot x\right) \cdot y\right) \cdot c\\
                  
                  \mathbf{elif}\;x \leq 4.2 \cdot 10^{-208}:\\
                  \;\;\;\;\left(x \cdot c\right) \cdot y\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;\mathsf{log1p}\left(y \cdot \mathsf{fma}\left(t\_0 \cdot x, x, x\right)\right) \cdot c\\
                  
                  
                  \end{array}
                  \end{array}
                  
                  Derivation
                  1. Split input into 4 regimes
                  2. if x < -0.066000000000000003

                    1. Initial program 43.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-*.f6443.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.f6499.9

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

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

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

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

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

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

                        \[\leadsto \mathsf{log1p}\left(y \cdot \left(\color{blue}{e^{\log \mathsf{E}\left(\right) \cdot x}} - 1\right)\right) \cdot c \]
                      13. 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.9

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

                      \[\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 \color{blue}{\left(y \cdot \left(e^{x} - 1\right)\right) \cdot c} \]
                      2. lower-*.f64N/A

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

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

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

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

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

                    if -0.066000000000000003 < x < -2.59999999999999986e-191

                    1. Initial program 22.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-*.f6422.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.f6426.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-*.f6426.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-*.f6495.5

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

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

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

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

                        \[\leadsto \mathsf{log1p}\left(\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) \cdot c \]

                      if -2.59999999999999986e-191 < x < 4.20000000000000024e-208

                      1. Initial program 38.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 \left(c \cdot \color{blue}{\left(y \cdot 1\right)}\right) \cdot x \]
                        8. metadata-evalN/A

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

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

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

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

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

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

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

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

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

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

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

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

                        if 4.20000000000000024e-208 < x

                        1. Initial program 28.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-*.f6428.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.f6430.2

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

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

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

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

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

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

                            \[\leadsto \mathsf{log1p}\left(y \cdot \left(\color{blue}{e^{\log \mathsf{E}\left(\right) \cdot x}} - 1\right)\right) \cdot c \]
                          13. 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-*.f6489.7

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -0.066:\\ \;\;\;\;\left(\mathsf{expm1}\left(x\right) \cdot y\right) \cdot c\\ \mathbf{elif}\;x \leq -2.6 \cdot 10^{-191}:\\ \;\;\;\;\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\\ \mathbf{elif}\;x \leq 4.2 \cdot 10^{-208}:\\ \;\;\;\;\left(x \cdot c\right) \cdot y\\ \mathbf{else}:\\ \;\;\;\;\mathsf{log1p}\left(y \cdot \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.041666666666666664, x, 0.16666666666666666\right), x, 0.5\right) \cdot x, x, x\right)\right) \cdot c\\ \end{array} \]
                      9. Add Preprocessing

                      Alternative 6: 83.0% accurate, 1.5× speedup?

                      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -235:\\ \;\;\;\;\left(\mathsf{expm1}\left(x\right) \cdot y\right) \cdot c\\ \mathbf{elif}\;x \leq -2.6 \cdot 10^{-191} \lor \neg \left(x \leq 4.2 \cdot 10^{-208}\right):\\ \;\;\;\;\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\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot c\right) \cdot y\\ \end{array} \end{array} \]
                      (FPCore (c x y)
                       :precision binary64
                       (if (<= x -235.0)
                         (* (* (expm1 x) y) c)
                         (if (or (<= x -2.6e-191) (not (<= x 4.2e-208)))
                           (* (log1p (* y (* (fma (fma 0.16666666666666666 x 0.5) x 1.0) x))) c)
                           (* (* x c) y))))
                      double code(double c, double x, double y) {
                      	double tmp;
                      	if (x <= -235.0) {
                      		tmp = (expm1(x) * y) * c;
                      	} else if ((x <= -2.6e-191) || !(x <= 4.2e-208)) {
                      		tmp = log1p((y * (fma(fma(0.16666666666666666, x, 0.5), x, 1.0) * x))) * c;
                      	} else {
                      		tmp = (x * c) * y;
                      	}
                      	return tmp;
                      }
                      
                      function code(c, x, y)
                      	tmp = 0.0
                      	if (x <= -235.0)
                      		tmp = Float64(Float64(expm1(x) * y) * c);
                      	elseif ((x <= -2.6e-191) || !(x <= 4.2e-208))
                      		tmp = Float64(log1p(Float64(y * Float64(fma(fma(0.16666666666666666, x, 0.5), x, 1.0) * x))) * c);
                      	else
                      		tmp = Float64(Float64(x * c) * y);
                      	end
                      	return tmp
                      end
                      
                      code[c_, x_, y_] := If[LessEqual[x, -235.0], N[(N[(N[(Exp[x] - 1), $MachinePrecision] * y), $MachinePrecision] * c), $MachinePrecision], If[Or[LessEqual[x, -2.6e-191], N[Not[LessEqual[x, 4.2e-208]], $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], N[(N[(x * c), $MachinePrecision] * y), $MachinePrecision]]]
                      
                      \begin{array}{l}
                      
                      \\
                      \begin{array}{l}
                      \mathbf{if}\;x \leq -235:\\
                      \;\;\;\;\left(\mathsf{expm1}\left(x\right) \cdot y\right) \cdot c\\
                      
                      \mathbf{elif}\;x \leq -2.6 \cdot 10^{-191} \lor \neg \left(x \leq 4.2 \cdot 10^{-208}\right):\\
                      \;\;\;\;\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\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;\left(x \cdot c\right) \cdot y\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 3 regimes
                      2. if x < -235

                        1. Initial program 43.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-*.f6443.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.f6499.9

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

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

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

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

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

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

                            \[\leadsto \mathsf{log1p}\left(y \cdot \left(\color{blue}{e^{\log \mathsf{E}\left(\right) \cdot x}} - 1\right)\right) \cdot c \]
                          13. 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.9

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

                          \[\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 \color{blue}{\left(y \cdot \left(e^{x} - 1\right)\right) \cdot c} \]
                          2. lower-*.f64N/A

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

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

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

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

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

                        if -235 < x < -2.59999999999999986e-191 or 4.20000000000000024e-208 < x

                        1. Initial program 26.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-*.f6426.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.f6429.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-*.f6429.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-*.f6492.4

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

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

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

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

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

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

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

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

                          \[\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 \]

                        if -2.59999999999999986e-191 < x < 4.20000000000000024e-208

                        1. Initial program 38.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 \left(c \cdot \color{blue}{\left(y \cdot 1\right)}\right) \cdot x \]
                          8. metadata-evalN/A

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

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

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

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

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

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

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

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

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

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

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

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

                          \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -235:\\ \;\;\;\;\left(\mathsf{expm1}\left(x\right) \cdot y\right) \cdot c\\ \mathbf{elif}\;x \leq -2.6 \cdot 10^{-191} \lor \neg \left(x \leq 4.2 \cdot 10^{-208}\right):\\ \;\;\;\;\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\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot c\right) \cdot y\\ \end{array} \]
                        9. Add Preprocessing

                        Alternative 7: 82.9% accurate, 1.6× speedup?

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

                          1. Initial program 43.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-*.f6443.8

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

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

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

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

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

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

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

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

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

                              \[\leadsto \mathsf{log1p}\left(y \cdot \left(\color{blue}{e^{\log \mathsf{E}\left(\right) \cdot x}} - 1\right)\right) \cdot c \]
                            13. 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.9

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

                            \[\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 \color{blue}{\left(y \cdot \left(e^{x} - 1\right)\right) \cdot c} \]
                            2. lower-*.f64N/A

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

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

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

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

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

                          if -0.00279999999999999997 < x < -2.59999999999999986e-191 or 4.20000000000000024e-208 < x

                          1. Initial program 25.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-*.f6425.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.f6427.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-*.f6427.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-*.f6492.2

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

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

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

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

                          if -2.59999999999999986e-191 < x < 4.20000000000000024e-208

                          1. Initial program 38.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 \left(c \cdot \color{blue}{\left(y \cdot 1\right)}\right) \cdot x \]
                            8. metadata-evalN/A

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

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

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

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

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

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

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

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

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

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

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

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

                            \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -0.0028:\\ \;\;\;\;\left(\mathsf{expm1}\left(x\right) \cdot y\right) \cdot c\\ \mathbf{elif}\;x \leq -2.6 \cdot 10^{-191} \lor \neg \left(x \leq 4.2 \cdot 10^{-208}\right):\\ \;\;\;\;\mathsf{log1p}\left(y \cdot \left(\mathsf{fma}\left(0.5, x, 1\right) \cdot x\right)\right) \cdot c\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot c\right) \cdot y\\ \end{array} \]
                          9. Add Preprocessing

                          Alternative 8: 76.3% accurate, 1.9× speedup?

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

                            1. Initial program 43.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-*.f6443.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.f6497.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-*.f6497.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-*.f6499.8

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

                              \[\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 \color{blue}{\left(y \cdot \left(e^{x} - 1\right)\right) \cdot c} \]
                              2. lower-*.f64N/A

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

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

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

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

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

                            if -3.6000000000000001e-18 < x

                            1. Initial program 30.0%

                              \[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 \left(c \cdot \color{blue}{\left(y \cdot 1\right)}\right) \cdot x \]
                              8. metadata-evalN/A

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

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

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

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

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

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

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

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

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

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

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

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

                              \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3.6 \cdot 10^{-18}:\\ \;\;\;\;\left(\mathsf{expm1}\left(x\right) \cdot y\right) \cdot c\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot c\right) \cdot y\\ \end{array} \]
                            9. Add Preprocessing

                            Alternative 9: 62.7% accurate, 12.8× speedup?

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

                              1. Initial program 43.1%

                                \[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 \left(c \cdot \color{blue}{\left(y \cdot 1\right)}\right) \cdot x \]
                                8. metadata-evalN/A

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

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

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

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

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

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

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

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

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

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

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

                              if 9.9999999999999995e-8 < c

                              1. Initial program 17.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 \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 \left(c \cdot \color{blue}{\left(y \cdot 1\right)}\right) \cdot x \]
                                8. metadata-evalN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

                              Alternative 10: 61.2% accurate, 19.8× speedup?

                              \[\begin{array}{l} \\ \left(c \cdot y\right) \cdot x \end{array} \]
                              (FPCore (c x y) :precision binary64 (* (* c y) x))
                              double code(double c, double x, double y) {
                              	return (c * y) * x;
                              }
                              
                              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 * y) * x
                              end function
                              
                              public static double code(double c, double x, double y) {
                              	return (c * y) * x;
                              }
                              
                              def code(c, x, y):
                              	return (c * y) * x
                              
                              function code(c, x, y)
                              	return Float64(Float64(c * y) * x)
                              end
                              
                              function tmp = code(c, x, y)
                              	tmp = (c * y) * x;
                              end
                              
                              code[c_, x_, y_] := N[(N[(c * y), $MachinePrecision] * x), $MachinePrecision]
                              
                              \begin{array}{l}
                              
                              \\
                              \left(c \cdot y\right) \cdot x
                              \end{array}
                              
                              Derivation
                              1. Initial program 35.1%

                                \[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 \left(c \cdot \color{blue}{\left(y \cdot 1\right)}\right) \cdot x \]
                                8. metadata-evalN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                              Reproduce

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