Numeric.Log:$cexpm1 from log-domain-0.10.2.1, B

Percentage Accurate: 100.0% → 100.0%
Time: 2.2s
Alternatives: 6
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ \left(x \cdot y + x\right) + y \end{array} \]
(FPCore (x y) :precision binary64 (+ (+ (* x y) x) y))
double code(double x, double y) {
	return ((x * y) + x) + y;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = ((x * y) + x) + y
end function
public static double code(double x, double y) {
	return ((x * y) + x) + y;
}
def code(x, y):
	return ((x * y) + x) + y
function code(x, y)
	return Float64(Float64(Float64(x * y) + x) + y)
end
function tmp = code(x, y)
	tmp = ((x * y) + x) + y;
end
code[x_, y_] := N[(N[(N[(x * y), $MachinePrecision] + x), $MachinePrecision] + y), $MachinePrecision]
\begin{array}{l}

\\
\left(x \cdot y + x\right) + y
\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 6 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: 100.0% accurate, 1.0× speedup?

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

\\
\left(x \cdot y + x\right) + y
\end{array}

Alternative 1: 100.0% accurate, 1.0× speedup?

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

\\
y + \left(x + x \cdot y\right)
\end{array}
Derivation
  1. Initial program 100.0%

    \[\left(x \cdot y + x\right) + y \]
  2. Final simplification100.0%

    \[\leadsto y + \left(x + x \cdot y\right) \]

Alternative 2: 60.4% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;y \leq 1.9 \cdot 10^{-96}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 32500000000000:\\ \;\;\;\;y\\ \mathbf{elif}\;y \leq 1.15 \cdot 10^{+49} \lor \neg \left(y \leq 3.5 \cdot 10^{+104}\right) \land \left(y \leq 2.85 \cdot 10^{+152} \lor \neg \left(y \leq 5.6 \cdot 10^{+161}\right) \land \left(y \leq 4.7 \cdot 10^{+214} \lor \neg \left(y \leq 4.2 \cdot 10^{+247}\right) \land y \leq 3.8 \cdot 10^{+260}\right)\right):\\ \;\;\;\;x \cdot y\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y -1.0)
   (* x y)
   (if (<= y 1.9e-96)
     x
     (if (<= y 32500000000000.0)
       y
       (if (or (<= y 1.15e+49)
               (and (not (<= y 3.5e+104))
                    (or (<= y 2.85e+152)
                        (and (not (<= y 5.6e+161))
                             (or (<= y 4.7e+214)
                                 (and (not (<= y 4.2e+247))
                                      (<= y 3.8e+260)))))))
         (* x y)
         y)))))
double code(double x, double y) {
	double tmp;
	if (y <= -1.0) {
		tmp = x * y;
	} else if (y <= 1.9e-96) {
		tmp = x;
	} else if (y <= 32500000000000.0) {
		tmp = y;
	} else if ((y <= 1.15e+49) || (!(y <= 3.5e+104) && ((y <= 2.85e+152) || (!(y <= 5.6e+161) && ((y <= 4.7e+214) || (!(y <= 4.2e+247) && (y <= 3.8e+260))))))) {
		tmp = x * y;
	} else {
		tmp = y;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (y <= (-1.0d0)) then
        tmp = x * y
    else if (y <= 1.9d-96) then
        tmp = x
    else if (y <= 32500000000000.0d0) then
        tmp = y
    else if ((y <= 1.15d+49) .or. (.not. (y <= 3.5d+104)) .and. (y <= 2.85d+152) .or. (.not. (y <= 5.6d+161)) .and. (y <= 4.7d+214) .or. (.not. (y <= 4.2d+247)) .and. (y <= 3.8d+260)) then
        tmp = x * y
    else
        tmp = y
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (y <= -1.0) {
		tmp = x * y;
	} else if (y <= 1.9e-96) {
		tmp = x;
	} else if (y <= 32500000000000.0) {
		tmp = y;
	} else if ((y <= 1.15e+49) || (!(y <= 3.5e+104) && ((y <= 2.85e+152) || (!(y <= 5.6e+161) && ((y <= 4.7e+214) || (!(y <= 4.2e+247) && (y <= 3.8e+260))))))) {
		tmp = x * y;
	} else {
		tmp = y;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= -1.0:
		tmp = x * y
	elif y <= 1.9e-96:
		tmp = x
	elif y <= 32500000000000.0:
		tmp = y
	elif (y <= 1.15e+49) or (not (y <= 3.5e+104) and ((y <= 2.85e+152) or (not (y <= 5.6e+161) and ((y <= 4.7e+214) or (not (y <= 4.2e+247) and (y <= 3.8e+260)))))):
		tmp = x * y
	else:
		tmp = y
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= -1.0)
		tmp = Float64(x * y);
	elseif (y <= 1.9e-96)
		tmp = x;
	elseif (y <= 32500000000000.0)
		tmp = y;
	elseif ((y <= 1.15e+49) || (!(y <= 3.5e+104) && ((y <= 2.85e+152) || (!(y <= 5.6e+161) && ((y <= 4.7e+214) || (!(y <= 4.2e+247) && (y <= 3.8e+260)))))))
		tmp = Float64(x * y);
	else
		tmp = y;
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= -1.0)
		tmp = x * y;
	elseif (y <= 1.9e-96)
		tmp = x;
	elseif (y <= 32500000000000.0)
		tmp = y;
	elseif ((y <= 1.15e+49) || (~((y <= 3.5e+104)) && ((y <= 2.85e+152) || (~((y <= 5.6e+161)) && ((y <= 4.7e+214) || (~((y <= 4.2e+247)) && (y <= 3.8e+260)))))))
		tmp = x * y;
	else
		tmp = y;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[y, -1.0], N[(x * y), $MachinePrecision], If[LessEqual[y, 1.9e-96], x, If[LessEqual[y, 32500000000000.0], y, If[Or[LessEqual[y, 1.15e+49], And[N[Not[LessEqual[y, 3.5e+104]], $MachinePrecision], Or[LessEqual[y, 2.85e+152], And[N[Not[LessEqual[y, 5.6e+161]], $MachinePrecision], Or[LessEqual[y, 4.7e+214], And[N[Not[LessEqual[y, 4.2e+247]], $MachinePrecision], LessEqual[y, 3.8e+260]]]]]]], N[(x * y), $MachinePrecision], y]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;x \cdot y\\

\mathbf{elif}\;y \leq 1.9 \cdot 10^{-96}:\\
\;\;\;\;x\\

\mathbf{elif}\;y \leq 32500000000000:\\
\;\;\;\;y\\

\mathbf{elif}\;y \leq 1.15 \cdot 10^{+49} \lor \neg \left(y \leq 3.5 \cdot 10^{+104}\right) \land \left(y \leq 2.85 \cdot 10^{+152} \lor \neg \left(y \leq 5.6 \cdot 10^{+161}\right) \land \left(y \leq 4.7 \cdot 10^{+214} \lor \neg \left(y \leq 4.2 \cdot 10^{+247}\right) \land y \leq 3.8 \cdot 10^{+260}\right)\right):\\
\;\;\;\;x \cdot y\\

\mathbf{else}:\\
\;\;\;\;y\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1 or 3.25e13 < y < 1.15000000000000001e49 or 3.5000000000000002e104 < y < 2.85000000000000003e152 or 5.60000000000000041e161 < y < 4.7e214 or 4.2e247 < y < 3.7999999999999997e260

    1. Initial program 100.0%

      \[\left(x \cdot y + x\right) + y \]
    2. Taylor expanded in x around inf 61.9%

      \[\leadsto \color{blue}{x \cdot \left(1 + y\right)} \]
    3. Step-by-step derivation
      1. +-commutative61.9%

        \[\leadsto x \cdot \color{blue}{\left(y + 1\right)} \]
    4. Simplified61.9%

      \[\leadsto \color{blue}{x \cdot \left(y + 1\right)} \]
    5. Taylor expanded in y around inf 61.3%

      \[\leadsto \color{blue}{x \cdot y} \]

    if -1 < y < 1.9e-96

    1. Initial program 100.0%

      \[\left(x \cdot y + x\right) + y \]
    2. Taylor expanded in y around 0 74.3%

      \[\leadsto \color{blue}{x} \]

    if 1.9e-96 < y < 3.25e13 or 1.15000000000000001e49 < y < 3.5000000000000002e104 or 2.85000000000000003e152 < y < 5.60000000000000041e161 or 4.7e214 < y < 4.2e247 or 3.7999999999999997e260 < y

    1. Initial program 100.0%

      \[\left(x \cdot y + x\right) + y \]
    2. Taylor expanded in x around 0 66.3%

      \[\leadsto \color{blue}{y} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification67.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;y \leq 1.9 \cdot 10^{-96}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 32500000000000:\\ \;\;\;\;y\\ \mathbf{elif}\;y \leq 1.15 \cdot 10^{+49} \lor \neg \left(y \leq 3.5 \cdot 10^{+104}\right) \land \left(y \leq 2.85 \cdot 10^{+152} \lor \neg \left(y \leq 5.6 \cdot 10^{+161}\right) \land \left(y \leq 4.7 \cdot 10^{+214} \lor \neg \left(y \leq 4.2 \cdot 10^{+247}\right) \land y \leq 3.8 \cdot 10^{+260}\right)\right):\\ \;\;\;\;x \cdot y\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \]

Alternative 3: 73.0% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -5.2 \cdot 10^{-14}:\\ \;\;\;\;x \cdot \left(y + 1\right)\\ \mathbf{elif}\;x \leq -2.05 \cdot 10^{-44}:\\ \;\;\;\;y\\ \mathbf{elif}\;x \leq -3.4 \cdot 10^{-142}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 1:\\ \;\;\;\;y\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= x -5.2e-14)
   (* x (+ y 1.0))
   (if (<= x -2.05e-44) y (if (<= x -3.4e-142) x (if (<= x 1.0) y (* x y))))))
double code(double x, double y) {
	double tmp;
	if (x <= -5.2e-14) {
		tmp = x * (y + 1.0);
	} else if (x <= -2.05e-44) {
		tmp = y;
	} else if (x <= -3.4e-142) {
		tmp = x;
	} else if (x <= 1.0) {
		tmp = y;
	} else {
		tmp = x * y;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (x <= (-5.2d-14)) then
        tmp = x * (y + 1.0d0)
    else if (x <= (-2.05d-44)) then
        tmp = y
    else if (x <= (-3.4d-142)) then
        tmp = x
    else if (x <= 1.0d0) then
        tmp = y
    else
        tmp = x * y
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (x <= -5.2e-14) {
		tmp = x * (y + 1.0);
	} else if (x <= -2.05e-44) {
		tmp = y;
	} else if (x <= -3.4e-142) {
		tmp = x;
	} else if (x <= 1.0) {
		tmp = y;
	} else {
		tmp = x * y;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if x <= -5.2e-14:
		tmp = x * (y + 1.0)
	elif x <= -2.05e-44:
		tmp = y
	elif x <= -3.4e-142:
		tmp = x
	elif x <= 1.0:
		tmp = y
	else:
		tmp = x * y
	return tmp
function code(x, y)
	tmp = 0.0
	if (x <= -5.2e-14)
		tmp = Float64(x * Float64(y + 1.0));
	elseif (x <= -2.05e-44)
		tmp = y;
	elseif (x <= -3.4e-142)
		tmp = x;
	elseif (x <= 1.0)
		tmp = y;
	else
		tmp = Float64(x * y);
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -5.2e-14)
		tmp = x * (y + 1.0);
	elseif (x <= -2.05e-44)
		tmp = y;
	elseif (x <= -3.4e-142)
		tmp = x;
	elseif (x <= 1.0)
		tmp = y;
	else
		tmp = x * y;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[x, -5.2e-14], N[(x * N[(y + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2.05e-44], y, If[LessEqual[x, -3.4e-142], x, If[LessEqual[x, 1.0], y, N[(x * y), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.2 \cdot 10^{-14}:\\
\;\;\;\;x \cdot \left(y + 1\right)\\

\mathbf{elif}\;x \leq -2.05 \cdot 10^{-44}:\\
\;\;\;\;y\\

\mathbf{elif}\;x \leq -3.4 \cdot 10^{-142}:\\
\;\;\;\;x\\

\mathbf{elif}\;x \leq 1:\\
\;\;\;\;y\\

\mathbf{else}:\\
\;\;\;\;x \cdot y\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -5.19999999999999993e-14

    1. Initial program 100.0%

      \[\left(x \cdot y + x\right) + y \]
    2. Taylor expanded in x around inf 97.1%

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

        \[\leadsto x \cdot \color{blue}{\left(y + 1\right)} \]
    4. Simplified97.1%

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

    if -5.19999999999999993e-14 < x < -2.04999999999999996e-44 or -3.40000000000000029e-142 < x < 1

    1. Initial program 100.0%

      \[\left(x \cdot y + x\right) + y \]
    2. Taylor expanded in x around 0 82.7%

      \[\leadsto \color{blue}{y} \]

    if -2.04999999999999996e-44 < x < -3.40000000000000029e-142

    1. Initial program 100.0%

      \[\left(x \cdot y + x\right) + y \]
    2. Taylor expanded in y around 0 49.7%

      \[\leadsto \color{blue}{x} \]

    if 1 < x

    1. Initial program 100.0%

      \[\left(x \cdot y + x\right) + y \]
    2. Taylor expanded in x around inf 99.9%

      \[\leadsto \color{blue}{x \cdot \left(1 + y\right)} \]
    3. Step-by-step derivation
      1. +-commutative99.9%

        \[\leadsto x \cdot \color{blue}{\left(y + 1\right)} \]
    4. Simplified99.9%

      \[\leadsto \color{blue}{x \cdot \left(y + 1\right)} \]
    5. Taylor expanded in y around inf 55.8%

      \[\leadsto \color{blue}{x \cdot y} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification77.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -5.2 \cdot 10^{-14}:\\ \;\;\;\;x \cdot \left(y + 1\right)\\ \mathbf{elif}\;x \leq -2.05 \cdot 10^{-44}:\\ \;\;\;\;y\\ \mathbf{elif}\;x \leq -3.4 \cdot 10^{-142}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 1:\\ \;\;\;\;y\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]

Alternative 4: 73.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 1.35 \cdot 10^{-96}:\\ \;\;\;\;x \cdot \left(y + 1\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(x + 1\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= y 1.35e-96) (* x (+ y 1.0)) (* y (+ x 1.0))))
double code(double x, double y) {
	double tmp;
	if (y <= 1.35e-96) {
		tmp = x * (y + 1.0);
	} else {
		tmp = y * (x + 1.0);
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (y <= 1.35d-96) then
        tmp = x * (y + 1.0d0)
    else
        tmp = y * (x + 1.0d0)
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (y <= 1.35e-96) {
		tmp = x * (y + 1.0);
	} else {
		tmp = y * (x + 1.0);
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= 1.35e-96:
		tmp = x * (y + 1.0)
	else:
		tmp = y * (x + 1.0)
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= 1.35e-96)
		tmp = Float64(x * Float64(y + 1.0));
	else
		tmp = Float64(y * Float64(x + 1.0));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= 1.35e-96)
		tmp = x * (y + 1.0);
	else
		tmp = y * (x + 1.0);
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[y, 1.35e-96], N[(x * N[(y + 1.0), $MachinePrecision]), $MachinePrecision], N[(y * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.35 \cdot 10^{-96}:\\
\;\;\;\;x \cdot \left(y + 1\right)\\

\mathbf{else}:\\
\;\;\;\;y \cdot \left(x + 1\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 1.35e-96

    1. Initial program 100.0%

      \[\left(x \cdot y + x\right) + y \]
    2. Taylor expanded in x around inf 69.6%

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

        \[\leadsto x \cdot \color{blue}{\left(y + 1\right)} \]
    4. Simplified69.6%

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

    if 1.35e-96 < y

    1. Initial program 100.0%

      \[\left(x \cdot y + x\right) + y \]
    2. Taylor expanded in y around inf 92.3%

      \[\leadsto \color{blue}{y \cdot \left(1 + x\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification77.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 1.35 \cdot 10^{-96}:\\ \;\;\;\;x \cdot \left(y + 1\right)\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(x + 1\right)\\ \end{array} \]

Alternative 5: 48.5% accurate, 2.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 1.8 \cdot 10^{-96}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \end{array} \]
(FPCore (x y) :precision binary64 (if (<= y 1.8e-96) x y))
double code(double x, double y) {
	double tmp;
	if (y <= 1.8e-96) {
		tmp = x;
	} else {
		tmp = y;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (y <= 1.8d-96) then
        tmp = x
    else
        tmp = y
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (y <= 1.8e-96) {
		tmp = x;
	} else {
		tmp = y;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= 1.8e-96:
		tmp = x
	else:
		tmp = y
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= 1.8e-96)
		tmp = x;
	else
		tmp = y;
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= 1.8e-96)
		tmp = x;
	else
		tmp = y;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[y, 1.8e-96], x, y]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.8 \cdot 10^{-96}:\\
\;\;\;\;x\\

\mathbf{else}:\\
\;\;\;\;y\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 1.80000000000000004e-96

    1. Initial program 100.0%

      \[\left(x \cdot y + x\right) + y \]
    2. Taylor expanded in y around 0 47.0%

      \[\leadsto \color{blue}{x} \]

    if 1.80000000000000004e-96 < y

    1. Initial program 100.0%

      \[\left(x \cdot y + x\right) + y \]
    2. Taylor expanded in x around 0 52.8%

      \[\leadsto \color{blue}{y} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification48.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 1.8 \cdot 10^{-96}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y\\ \end{array} \]

Alternative 6: 38.1% accurate, 7.0× speedup?

\[\begin{array}{l} \\ x \end{array} \]
(FPCore (x y) :precision binary64 x)
double code(double x, double y) {
	return x;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = x
end function
public static double code(double x, double y) {
	return x;
}
def code(x, y):
	return x
function code(x, y)
	return x
end
function tmp = code(x, y)
	tmp = x;
end
code[x_, y_] := x
\begin{array}{l}

\\
x
\end{array}
Derivation
  1. Initial program 100.0%

    \[\left(x \cdot y + x\right) + y \]
  2. Taylor expanded in y around 0 35.1%

    \[\leadsto \color{blue}{x} \]
  3. Final simplification35.1%

    \[\leadsto x \]

Reproduce

?
herbie shell --seed 2023322 
(FPCore (x y)
  :name "Numeric.Log:$cexpm1 from log-domain-0.10.2.1, B"
  :precision binary64
  (+ (+ (* x y) x) y))