Numeric.SpecFunctions:invErfc from math-functions-0.1.5.2, A

Percentage Accurate: 95.5% → 99.9%
Time: 11.0s
Alternatives: 14
Speedup: 5.8×

Specification

?
\[\begin{array}{l} \\ x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (+ x (/ y (- (* 1.1283791670955126 (exp z)) (* x y)))))
double code(double x, double y, double z) {
	return x + (y / ((1.1283791670955126 * exp(z)) - (x * y)));
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = x + (y / ((1.1283791670955126d0 * exp(z)) - (x * y)))
end function
public static double code(double x, double y, double z) {
	return x + (y / ((1.1283791670955126 * Math.exp(z)) - (x * y)));
}
def code(x, y, z):
	return x + (y / ((1.1283791670955126 * math.exp(z)) - (x * y)))
function code(x, y, z)
	return Float64(x + Float64(y / Float64(Float64(1.1283791670955126 * exp(z)) - Float64(x * y))))
end
function tmp = code(x, y, z)
	tmp = x + (y / ((1.1283791670955126 * exp(z)) - (x * y)));
end
code[x_, y_, z_] := N[(x + N[(y / N[(N[(1.1283791670955126 * N[Exp[z], $MachinePrecision]), $MachinePrecision] - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot 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 14 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: 95.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (+ x (/ y (- (* 1.1283791670955126 (exp z)) (* x y)))))
double code(double x, double y, double z) {
	return x + (y / ((1.1283791670955126 * exp(z)) - (x * y)));
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = x + (y / ((1.1283791670955126d0 * exp(z)) - (x * y)))
end function
public static double code(double x, double y, double z) {
	return x + (y / ((1.1283791670955126 * Math.exp(z)) - (x * y)));
}
def code(x, y, z):
	return x + (y / ((1.1283791670955126 * math.exp(z)) - (x * y)))
function code(x, y, z)
	return Float64(x + Float64(y / Float64(Float64(1.1283791670955126 * exp(z)) - Float64(x * y))))
end
function tmp = code(x, y, z)
	tmp = x + (y / ((1.1283791670955126 * exp(z)) - (x * y)));
end
code[x_, y_, z_] := N[(x + N[(y / N[(N[(1.1283791670955126 * N[Exp[z], $MachinePrecision]), $MachinePrecision] - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}
\end{array}

Alternative 1: 99.9% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;e^{z} \leq 0:\\ \;\;\;\;x + \frac{-1}{x}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{y}{\mathsf{fma}\left(x, y, e^{z} \cdot -1.1283791670955126\right)}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= (exp z) 0.0)
   (+ x (/ -1.0 x))
   (- x (/ y (fma x y (* (exp z) -1.1283791670955126))))))
double code(double x, double y, double z) {
	double tmp;
	if (exp(z) <= 0.0) {
		tmp = x + (-1.0 / x);
	} else {
		tmp = x - (y / fma(x, y, (exp(z) * -1.1283791670955126)));
	}
	return tmp;
}
function code(x, y, z)
	tmp = 0.0
	if (exp(z) <= 0.0)
		tmp = Float64(x + Float64(-1.0 / x));
	else
		tmp = Float64(x - Float64(y / fma(x, y, Float64(exp(z) * -1.1283791670955126))));
	end
	return tmp
end
code[x_, y_, z_] := If[LessEqual[N[Exp[z], $MachinePrecision], 0.0], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], N[(x - N[(y / N[(x * y + N[(N[Exp[z], $MachinePrecision] * -1.1283791670955126), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;e^{z} \leq 0:\\
\;\;\;\;x + \frac{-1}{x}\\

\mathbf{else}:\\
\;\;\;\;x - \frac{y}{\mathsf{fma}\left(x, y, e^{z} \cdot -1.1283791670955126\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (exp.f64 z) < 0.0

    1. Initial program 88.9%

      \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 100.0%

      \[\leadsto \color{blue}{x - \frac{1}{x}} \]

    if 0.0 < (exp.f64 z)

    1. Initial program 96.7%

      \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
    2. Step-by-step derivation
      1. remove-double-neg96.7%

        \[\leadsto x + \frac{\color{blue}{-\left(-y\right)}}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
      2. distribute-frac-neg96.7%

        \[\leadsto x + \color{blue}{\left(-\frac{-y}{1.1283791670955126 \cdot e^{z} - x \cdot y}\right)} \]
      3. unsub-neg96.7%

        \[\leadsto \color{blue}{x - \frac{-y}{1.1283791670955126 \cdot e^{z} - x \cdot y}} \]
      4. distribute-frac-neg96.7%

        \[\leadsto x - \color{blue}{\left(-\frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}\right)} \]
      5. distribute-neg-frac296.7%

        \[\leadsto x - \color{blue}{\frac{y}{-\left(1.1283791670955126 \cdot e^{z} - x \cdot y\right)}} \]
      6. neg-sub096.7%

        \[\leadsto x - \frac{y}{\color{blue}{0 - \left(1.1283791670955126 \cdot e^{z} - x \cdot y\right)}} \]
      7. associate--r-96.7%

        \[\leadsto x - \frac{y}{\color{blue}{\left(0 - 1.1283791670955126 \cdot e^{z}\right) + x \cdot y}} \]
      8. neg-sub096.7%

        \[\leadsto x - \frac{y}{\color{blue}{\left(-1.1283791670955126 \cdot e^{z}\right)} + x \cdot y} \]
      9. +-commutative96.7%

        \[\leadsto x - \frac{y}{\color{blue}{x \cdot y + \left(-1.1283791670955126 \cdot e^{z}\right)}} \]
      10. fma-define99.9%

        \[\leadsto x - \frac{y}{\color{blue}{\mathsf{fma}\left(x, y, -1.1283791670955126 \cdot e^{z}\right)}} \]
      11. *-commutative99.9%

        \[\leadsto x - \frac{y}{\mathsf{fma}\left(x, y, -\color{blue}{e^{z} \cdot 1.1283791670955126}\right)} \]
      12. distribute-rgt-neg-in99.9%

        \[\leadsto x - \frac{y}{\mathsf{fma}\left(x, y, \color{blue}{e^{z} \cdot \left(-1.1283791670955126\right)}\right)} \]
      13. metadata-eval99.9%

        \[\leadsto x - \frac{y}{\mathsf{fma}\left(x, y, e^{z} \cdot \color{blue}{-1.1283791670955126}\right)} \]
    3. Simplified99.9%

      \[\leadsto \color{blue}{x - \frac{y}{\mathsf{fma}\left(x, y, e^{z} \cdot -1.1283791670955126\right)}} \]
    4. Add Preprocessing
  3. Recombined 2 regimes into one program.
  4. Final simplification99.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;e^{z} \leq 0:\\ \;\;\;\;x + \frac{-1}{x}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{y}{\mathsf{fma}\left(x, y, e^{z} \cdot -1.1283791670955126\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 99.4% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;e^{z} \leq 0:\\ \;\;\;\;x + \frac{-1}{x}\\ \mathbf{elif}\;e^{z} \leq 1:\\ \;\;\;\;x - \frac{y}{\mathsf{fma}\left(y, x, -1.1283791670955126\right)}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{y \cdot -0.8862269254527579}{e^{z}}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= (exp z) 0.0)
   (+ x (/ -1.0 x))
   (if (<= (exp z) 1.0)
     (- x (/ y (fma y x -1.1283791670955126)))
     (- x (/ (* y -0.8862269254527579) (exp z))))))
double code(double x, double y, double z) {
	double tmp;
	if (exp(z) <= 0.0) {
		tmp = x + (-1.0 / x);
	} else if (exp(z) <= 1.0) {
		tmp = x - (y / fma(y, x, -1.1283791670955126));
	} else {
		tmp = x - ((y * -0.8862269254527579) / exp(z));
	}
	return tmp;
}
function code(x, y, z)
	tmp = 0.0
	if (exp(z) <= 0.0)
		tmp = Float64(x + Float64(-1.0 / x));
	elseif (exp(z) <= 1.0)
		tmp = Float64(x - Float64(y / fma(y, x, -1.1283791670955126)));
	else
		tmp = Float64(x - Float64(Float64(y * -0.8862269254527579) / exp(z)));
	end
	return tmp
end
code[x_, y_, z_] := If[LessEqual[N[Exp[z], $MachinePrecision], 0.0], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Exp[z], $MachinePrecision], 1.0], N[(x - N[(y / N[(y * x + -1.1283791670955126), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(y * -0.8862269254527579), $MachinePrecision] / N[Exp[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;e^{z} \leq 0:\\
\;\;\;\;x + \frac{-1}{x}\\

\mathbf{elif}\;e^{z} \leq 1:\\
\;\;\;\;x - \frac{y}{\mathsf{fma}\left(y, x, -1.1283791670955126\right)}\\

\mathbf{else}:\\
\;\;\;\;x - \frac{y \cdot -0.8862269254527579}{e^{z}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (exp.f64 z) < 0.0

    1. Initial program 88.9%

      \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 100.0%

      \[\leadsto \color{blue}{x - \frac{1}{x}} \]

    if 0.0 < (exp.f64 z) < 1

    1. Initial program 99.9%

      \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
    2. Step-by-step derivation
      1. remove-double-neg99.9%

        \[\leadsto x + \frac{\color{blue}{-\left(-y\right)}}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
      2. distribute-frac-neg99.9%

        \[\leadsto x + \color{blue}{\left(-\frac{-y}{1.1283791670955126 \cdot e^{z} - x \cdot y}\right)} \]
      3. unsub-neg99.9%

        \[\leadsto \color{blue}{x - \frac{-y}{1.1283791670955126 \cdot e^{z} - x \cdot y}} \]
      4. distribute-frac-neg99.9%

        \[\leadsto x - \color{blue}{\left(-\frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}\right)} \]
      5. distribute-neg-frac299.9%

        \[\leadsto x - \color{blue}{\frac{y}{-\left(1.1283791670955126 \cdot e^{z} - x \cdot y\right)}} \]
      6. neg-sub099.9%

        \[\leadsto x - \frac{y}{\color{blue}{0 - \left(1.1283791670955126 \cdot e^{z} - x \cdot y\right)}} \]
      7. associate--r-99.9%

        \[\leadsto x - \frac{y}{\color{blue}{\left(0 - 1.1283791670955126 \cdot e^{z}\right) + x \cdot y}} \]
      8. neg-sub099.9%

        \[\leadsto x - \frac{y}{\color{blue}{\left(-1.1283791670955126 \cdot e^{z}\right)} + x \cdot y} \]
      9. +-commutative99.9%

        \[\leadsto x - \frac{y}{\color{blue}{x \cdot y + \left(-1.1283791670955126 \cdot e^{z}\right)}} \]
      10. fma-define99.9%

        \[\leadsto x - \frac{y}{\color{blue}{\mathsf{fma}\left(x, y, -1.1283791670955126 \cdot e^{z}\right)}} \]
      11. *-commutative99.9%

        \[\leadsto x - \frac{y}{\mathsf{fma}\left(x, y, -\color{blue}{e^{z} \cdot 1.1283791670955126}\right)} \]
      12. distribute-rgt-neg-in99.9%

        \[\leadsto x - \frac{y}{\mathsf{fma}\left(x, y, \color{blue}{e^{z} \cdot \left(-1.1283791670955126\right)}\right)} \]
      13. metadata-eval99.9%

        \[\leadsto x - \frac{y}{\mathsf{fma}\left(x, y, e^{z} \cdot \color{blue}{-1.1283791670955126}\right)} \]
    3. Simplified99.9%

      \[\leadsto \color{blue}{x - \frac{y}{\mathsf{fma}\left(x, y, e^{z} \cdot -1.1283791670955126\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in z around 0 99.9%

      \[\leadsto \color{blue}{x - \frac{y}{x \cdot y - 1.1283791670955126}} \]
    6. Step-by-step derivation
      1. *-commutative99.9%

        \[\leadsto x - \frac{y}{\color{blue}{y \cdot x} - 1.1283791670955126} \]
      2. fmm-def99.9%

        \[\leadsto x - \frac{y}{\color{blue}{\mathsf{fma}\left(y, x, -1.1283791670955126\right)}} \]
      3. metadata-eval99.9%

        \[\leadsto x - \frac{y}{\mathsf{fma}\left(y, x, \color{blue}{-1.1283791670955126}\right)} \]
    7. Simplified99.9%

      \[\leadsto \color{blue}{x - \frac{y}{\mathsf{fma}\left(y, x, -1.1283791670955126\right)}} \]

    if 1 < (exp.f64 z)

    1. Initial program 91.0%

      \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
    2. Step-by-step derivation
      1. remove-double-neg91.0%

        \[\leadsto x + \frac{\color{blue}{-\left(-y\right)}}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
      2. distribute-frac-neg91.0%

        \[\leadsto x + \color{blue}{\left(-\frac{-y}{1.1283791670955126 \cdot e^{z} - x \cdot y}\right)} \]
      3. unsub-neg91.0%

        \[\leadsto \color{blue}{x - \frac{-y}{1.1283791670955126 \cdot e^{z} - x \cdot y}} \]
      4. distribute-frac-neg91.0%

        \[\leadsto x - \color{blue}{\left(-\frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}\right)} \]
      5. distribute-neg-frac291.0%

        \[\leadsto x - \color{blue}{\frac{y}{-\left(1.1283791670955126 \cdot e^{z} - x \cdot y\right)}} \]
      6. neg-sub091.0%

        \[\leadsto x - \frac{y}{\color{blue}{0 - \left(1.1283791670955126 \cdot e^{z} - x \cdot y\right)}} \]
      7. associate--r-91.0%

        \[\leadsto x - \frac{y}{\color{blue}{\left(0 - 1.1283791670955126 \cdot e^{z}\right) + x \cdot y}} \]
      8. neg-sub091.0%

        \[\leadsto x - \frac{y}{\color{blue}{\left(-1.1283791670955126 \cdot e^{z}\right)} + x \cdot y} \]
      9. +-commutative91.0%

        \[\leadsto x - \frac{y}{\color{blue}{x \cdot y + \left(-1.1283791670955126 \cdot e^{z}\right)}} \]
      10. fma-define100.0%

        \[\leadsto x - \frac{y}{\color{blue}{\mathsf{fma}\left(x, y, -1.1283791670955126 \cdot e^{z}\right)}} \]
      11. *-commutative100.0%

        \[\leadsto x - \frac{y}{\mathsf{fma}\left(x, y, -\color{blue}{e^{z} \cdot 1.1283791670955126}\right)} \]
      12. distribute-rgt-neg-in100.0%

        \[\leadsto x - \frac{y}{\mathsf{fma}\left(x, y, \color{blue}{e^{z} \cdot \left(-1.1283791670955126\right)}\right)} \]
      13. metadata-eval100.0%

        \[\leadsto x - \frac{y}{\mathsf{fma}\left(x, y, e^{z} \cdot \color{blue}{-1.1283791670955126}\right)} \]
    3. Simplified100.0%

      \[\leadsto \color{blue}{x - \frac{y}{\mathsf{fma}\left(x, y, e^{z} \cdot -1.1283791670955126\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 100.0%

      \[\leadsto x - \color{blue}{-0.8862269254527579 \cdot \frac{y}{e^{z}}} \]
    6. Step-by-step derivation
      1. associate-*r/100.0%

        \[\leadsto x - \color{blue}{\frac{-0.8862269254527579 \cdot y}{e^{z}}} \]
    7. Simplified100.0%

      \[\leadsto x - \color{blue}{\frac{-0.8862269254527579 \cdot y}{e^{z}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification99.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;e^{z} \leq 0:\\ \;\;\;\;x + \frac{-1}{x}\\ \mathbf{elif}\;e^{z} \leq 1:\\ \;\;\;\;x - \frac{y}{\mathsf{fma}\left(y, x, -1.1283791670955126\right)}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{y \cdot -0.8862269254527579}{e^{z}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 99.7% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;e^{z} \leq 0:\\ \;\;\;\;x + \frac{-1}{x}\\ \mathbf{elif}\;e^{z} \leq 2:\\ \;\;\;\;x - \frac{y}{\left(x \cdot y + z \cdot \left(z \cdot -0.5641895835477563 - 1.1283791670955126\right)\right) - 1.1283791670955126}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= (exp z) 0.0)
   (+ x (/ -1.0 x))
   (if (<= (exp z) 2.0)
     (-
      x
      (/
       y
       (-
        (+ (* x y) (* z (- (* z -0.5641895835477563) 1.1283791670955126)))
        1.1283791670955126)))
     x)))
double code(double x, double y, double z) {
	double tmp;
	if (exp(z) <= 0.0) {
		tmp = x + (-1.0 / x);
	} else if (exp(z) <= 2.0) {
		tmp = x - (y / (((x * y) + (z * ((z * -0.5641895835477563) - 1.1283791670955126))) - 1.1283791670955126));
	} else {
		tmp = x;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (exp(z) <= 0.0d0) then
        tmp = x + ((-1.0d0) / x)
    else if (exp(z) <= 2.0d0) then
        tmp = x - (y / (((x * y) + (z * ((z * (-0.5641895835477563d0)) - 1.1283791670955126d0))) - 1.1283791670955126d0))
    else
        tmp = x
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (Math.exp(z) <= 0.0) {
		tmp = x + (-1.0 / x);
	} else if (Math.exp(z) <= 2.0) {
		tmp = x - (y / (((x * y) + (z * ((z * -0.5641895835477563) - 1.1283791670955126))) - 1.1283791670955126));
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if math.exp(z) <= 0.0:
		tmp = x + (-1.0 / x)
	elif math.exp(z) <= 2.0:
		tmp = x - (y / (((x * y) + (z * ((z * -0.5641895835477563) - 1.1283791670955126))) - 1.1283791670955126))
	else:
		tmp = x
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (exp(z) <= 0.0)
		tmp = Float64(x + Float64(-1.0 / x));
	elseif (exp(z) <= 2.0)
		tmp = Float64(x - Float64(y / Float64(Float64(Float64(x * y) + Float64(z * Float64(Float64(z * -0.5641895835477563) - 1.1283791670955126))) - 1.1283791670955126)));
	else
		tmp = x;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (exp(z) <= 0.0)
		tmp = x + (-1.0 / x);
	elseif (exp(z) <= 2.0)
		tmp = x - (y / (((x * y) + (z * ((z * -0.5641895835477563) - 1.1283791670955126))) - 1.1283791670955126));
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[N[Exp[z], $MachinePrecision], 0.0], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Exp[z], $MachinePrecision], 2.0], N[(x - N[(y / N[(N[(N[(x * y), $MachinePrecision] + N[(z * N[(N[(z * -0.5641895835477563), $MachinePrecision] - 1.1283791670955126), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.1283791670955126), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;e^{z} \leq 0:\\
\;\;\;\;x + \frac{-1}{x}\\

\mathbf{elif}\;e^{z} \leq 2:\\
\;\;\;\;x - \frac{y}{\left(x \cdot y + z \cdot \left(z \cdot -0.5641895835477563 - 1.1283791670955126\right)\right) - 1.1283791670955126}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (exp.f64 z) < 0.0

    1. Initial program 88.9%

      \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 100.0%

      \[\leadsto \color{blue}{x - \frac{1}{x}} \]

    if 0.0 < (exp.f64 z) < 2

    1. Initial program 99.8%

      \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
    2. Step-by-step derivation
      1. remove-double-neg99.8%

        \[\leadsto x + \frac{\color{blue}{-\left(-y\right)}}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
      2. distribute-frac-neg99.8%

        \[\leadsto x + \color{blue}{\left(-\frac{-y}{1.1283791670955126 \cdot e^{z} - x \cdot y}\right)} \]
      3. unsub-neg99.8%

        \[\leadsto \color{blue}{x - \frac{-y}{1.1283791670955126 \cdot e^{z} - x \cdot y}} \]
      4. distribute-frac-neg99.8%

        \[\leadsto x - \color{blue}{\left(-\frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}\right)} \]
      5. distribute-neg-frac299.8%

        \[\leadsto x - \color{blue}{\frac{y}{-\left(1.1283791670955126 \cdot e^{z} - x \cdot y\right)}} \]
      6. neg-sub099.8%

        \[\leadsto x - \frac{y}{\color{blue}{0 - \left(1.1283791670955126 \cdot e^{z} - x \cdot y\right)}} \]
      7. associate--r-99.8%

        \[\leadsto x - \frac{y}{\color{blue}{\left(0 - 1.1283791670955126 \cdot e^{z}\right) + x \cdot y}} \]
      8. neg-sub099.8%

        \[\leadsto x - \frac{y}{\color{blue}{\left(-1.1283791670955126 \cdot e^{z}\right)} + x \cdot y} \]
      9. +-commutative99.8%

        \[\leadsto x - \frac{y}{\color{blue}{x \cdot y + \left(-1.1283791670955126 \cdot e^{z}\right)}} \]
      10. fma-define99.9%

        \[\leadsto x - \frac{y}{\color{blue}{\mathsf{fma}\left(x, y, -1.1283791670955126 \cdot e^{z}\right)}} \]
      11. *-commutative99.9%

        \[\leadsto x - \frac{y}{\mathsf{fma}\left(x, y, -\color{blue}{e^{z} \cdot 1.1283791670955126}\right)} \]
      12. distribute-rgt-neg-in99.9%

        \[\leadsto x - \frac{y}{\mathsf{fma}\left(x, y, \color{blue}{e^{z} \cdot \left(-1.1283791670955126\right)}\right)} \]
      13. metadata-eval99.9%

        \[\leadsto x - \frac{y}{\mathsf{fma}\left(x, y, e^{z} \cdot \color{blue}{-1.1283791670955126}\right)} \]
    3. Simplified99.9%

      \[\leadsto \color{blue}{x - \frac{y}{\mathsf{fma}\left(x, y, e^{z} \cdot -1.1283791670955126\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in z around 0 99.8%

      \[\leadsto x - \frac{y}{\color{blue}{\left(x \cdot y + z \cdot \left(-0.5641895835477563 \cdot z - 1.1283791670955126\right)\right) - 1.1283791670955126}} \]

    if 2 < (exp.f64 z)

    1. Initial program 90.5%

      \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 100.0%

      \[\leadsto \color{blue}{x} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification99.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;e^{z} \leq 0:\\ \;\;\;\;x + \frac{-1}{x}\\ \mathbf{elif}\;e^{z} \leq 2:\\ \;\;\;\;x - \frac{y}{\left(x \cdot y + z \cdot \left(z \cdot -0.5641895835477563 - 1.1283791670955126\right)\right) - 1.1283791670955126}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 97.7% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x + \frac{y}{e^{z} \cdot 1.1283791670955126 - x \cdot y}\\ \mathbf{if}\;t\_0 \leq 5 \cdot 10^{+168}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;x + \frac{-1}{x}\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (+ x (/ y (- (* (exp z) 1.1283791670955126) (* x y))))))
   (if (<= t_0 5e+168) t_0 (+ x (/ -1.0 x)))))
double code(double x, double y, double z) {
	double t_0 = x + (y / ((exp(z) * 1.1283791670955126) - (x * y)));
	double tmp;
	if (t_0 <= 5e+168) {
		tmp = t_0;
	} else {
		tmp = x + (-1.0 / x);
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: t_0
    real(8) :: tmp
    t_0 = x + (y / ((exp(z) * 1.1283791670955126d0) - (x * y)))
    if (t_0 <= 5d+168) then
        tmp = t_0
    else
        tmp = x + ((-1.0d0) / x)
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = x + (y / ((Math.exp(z) * 1.1283791670955126) - (x * y)));
	double tmp;
	if (t_0 <= 5e+168) {
		tmp = t_0;
	} else {
		tmp = x + (-1.0 / x);
	}
	return tmp;
}
def code(x, y, z):
	t_0 = x + (y / ((math.exp(z) * 1.1283791670955126) - (x * y)))
	tmp = 0
	if t_0 <= 5e+168:
		tmp = t_0
	else:
		tmp = x + (-1.0 / x)
	return tmp
function code(x, y, z)
	t_0 = Float64(x + Float64(y / Float64(Float64(exp(z) * 1.1283791670955126) - Float64(x * y))))
	tmp = 0.0
	if (t_0 <= 5e+168)
		tmp = t_0;
	else
		tmp = Float64(x + Float64(-1.0 / x));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = x + (y / ((exp(z) * 1.1283791670955126) - (x * y)));
	tmp = 0.0;
	if (t_0 <= 5e+168)
		tmp = t_0;
	else
		tmp = x + (-1.0 / x);
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[(y / N[(N[(N[Exp[z], $MachinePrecision] * 1.1283791670955126), $MachinePrecision] - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 5e+168], t$95$0, N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x + \frac{y}{e^{z} \cdot 1.1283791670955126 - x \cdot y}\\
\mathbf{if}\;t\_0 \leq 5 \cdot 10^{+168}:\\
\;\;\;\;t\_0\\

\mathbf{else}:\\
\;\;\;\;x + \frac{-1}{x}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 x (/.f64 y (-.f64 (*.f64 #s(literal 5641895835477563/5000000000000000 binary64) (exp.f64 z)) (*.f64 x y)))) < 4.99999999999999967e168

    1. Initial program 98.5%

      \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
    2. Add Preprocessing

    if 4.99999999999999967e168 < (+.f64 x (/.f64 y (-.f64 (*.f64 #s(literal 5641895835477563/5000000000000000 binary64) (exp.f64 z)) (*.f64 x y))))

    1. Initial program 78.5%

      \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 100.0%

      \[\leadsto \color{blue}{x - \frac{1}{x}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification98.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x + \frac{y}{e^{z} \cdot 1.1283791670955126 - x \cdot y} \leq 5 \cdot 10^{+168}:\\ \;\;\;\;x + \frac{y}{e^{z} \cdot 1.1283791670955126 - x \cdot y}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{-1}{x}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 99.6% accurate, 4.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -360:\\ \;\;\;\;x + \frac{-1}{x}\\ \mathbf{elif}\;z \leq 130:\\ \;\;\;\;x + \frac{y}{1.1283791670955126 \cdot \left(z + 1\right) - x \cdot y}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= z -360.0)
   (+ x (/ -1.0 x))
   (if (<= z 130.0)
     (+ x (/ y (- (* 1.1283791670955126 (+ z 1.0)) (* x y))))
     x)))
double code(double x, double y, double z) {
	double tmp;
	if (z <= -360.0) {
		tmp = x + (-1.0 / x);
	} else if (z <= 130.0) {
		tmp = x + (y / ((1.1283791670955126 * (z + 1.0)) - (x * y)));
	} else {
		tmp = x;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (z <= (-360.0d0)) then
        tmp = x + ((-1.0d0) / x)
    else if (z <= 130.0d0) then
        tmp = x + (y / ((1.1283791670955126d0 * (z + 1.0d0)) - (x * y)))
    else
        tmp = x
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (z <= -360.0) {
		tmp = x + (-1.0 / x);
	} else if (z <= 130.0) {
		tmp = x + (y / ((1.1283791670955126 * (z + 1.0)) - (x * y)));
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if z <= -360.0:
		tmp = x + (-1.0 / x)
	elif z <= 130.0:
		tmp = x + (y / ((1.1283791670955126 * (z + 1.0)) - (x * y)))
	else:
		tmp = x
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (z <= -360.0)
		tmp = Float64(x + Float64(-1.0 / x));
	elseif (z <= 130.0)
		tmp = Float64(x + Float64(y / Float64(Float64(1.1283791670955126 * Float64(z + 1.0)) - Float64(x * y))));
	else
		tmp = x;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (z <= -360.0)
		tmp = x + (-1.0 / x);
	elseif (z <= 130.0)
		tmp = x + (y / ((1.1283791670955126 * (z + 1.0)) - (x * y)));
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[z, -360.0], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 130.0], N[(x + N[(y / N[(N[(1.1283791670955126 * N[(z + 1.0), $MachinePrecision]), $MachinePrecision] - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -360:\\
\;\;\;\;x + \frac{-1}{x}\\

\mathbf{elif}\;z \leq 130:\\
\;\;\;\;x + \frac{y}{1.1283791670955126 \cdot \left(z + 1\right) - x \cdot y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -360

    1. Initial program 88.9%

      \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 100.0%

      \[\leadsto \color{blue}{x - \frac{1}{x}} \]

    if -360 < z < 130

    1. Initial program 99.8%

      \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 99.8%

      \[\leadsto x + \frac{y}{1.1283791670955126 \cdot \color{blue}{\left(1 + z\right)} - x \cdot y} \]
    4. Step-by-step derivation
      1. +-commutative99.8%

        \[\leadsto x + \frac{y}{1.1283791670955126 \cdot \color{blue}{\left(z + 1\right)} - x \cdot y} \]
    5. Simplified99.8%

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

    if 130 < z

    1. Initial program 90.5%

      \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 100.0%

      \[\leadsto \color{blue}{x} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification99.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -360:\\ \;\;\;\;x + \frac{-1}{x}\\ \mathbf{elif}\;z \leq 130:\\ \;\;\;\;x + \frac{y}{1.1283791670955126 \cdot \left(z + 1\right) - x \cdot y}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 99.5% accurate, 5.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -85:\\ \;\;\;\;x + \frac{-1}{x}\\ \mathbf{elif}\;z \leq 300:\\ \;\;\;\;x + \frac{y}{y \cdot \left(\frac{1.1283791670955126}{y} - x\right)}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= z -85.0)
   (+ x (/ -1.0 x))
   (if (<= z 300.0) (+ x (/ y (* y (- (/ 1.1283791670955126 y) x)))) x)))
double code(double x, double y, double z) {
	double tmp;
	if (z <= -85.0) {
		tmp = x + (-1.0 / x);
	} else if (z <= 300.0) {
		tmp = x + (y / (y * ((1.1283791670955126 / y) - x)));
	} else {
		tmp = x;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (z <= (-85.0d0)) then
        tmp = x + ((-1.0d0) / x)
    else if (z <= 300.0d0) then
        tmp = x + (y / (y * ((1.1283791670955126d0 / y) - x)))
    else
        tmp = x
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (z <= -85.0) {
		tmp = x + (-1.0 / x);
	} else if (z <= 300.0) {
		tmp = x + (y / (y * ((1.1283791670955126 / y) - x)));
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if z <= -85.0:
		tmp = x + (-1.0 / x)
	elif z <= 300.0:
		tmp = x + (y / (y * ((1.1283791670955126 / y) - x)))
	else:
		tmp = x
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (z <= -85.0)
		tmp = Float64(x + Float64(-1.0 / x));
	elseif (z <= 300.0)
		tmp = Float64(x + Float64(y / Float64(y * Float64(Float64(1.1283791670955126 / y) - x))));
	else
		tmp = x;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (z <= -85.0)
		tmp = x + (-1.0 / x);
	elseif (z <= 300.0)
		tmp = x + (y / (y * ((1.1283791670955126 / y) - x)));
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[z, -85.0], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 300.0], N[(x + N[(y / N[(y * N[(N[(1.1283791670955126 / y), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -85:\\
\;\;\;\;x + \frac{-1}{x}\\

\mathbf{elif}\;z \leq 300:\\
\;\;\;\;x + \frac{y}{y \cdot \left(\frac{1.1283791670955126}{y} - x\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -85

    1. Initial program 88.9%

      \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 100.0%

      \[\leadsto \color{blue}{x - \frac{1}{x}} \]

    if -85 < z < 300

    1. Initial program 99.8%

      \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
    2. Step-by-step derivation
      1. remove-double-neg99.8%

        \[\leadsto x + \frac{\color{blue}{-\left(-y\right)}}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
      2. distribute-frac-neg99.8%

        \[\leadsto x + \color{blue}{\left(-\frac{-y}{1.1283791670955126 \cdot e^{z} - x \cdot y}\right)} \]
      3. unsub-neg99.8%

        \[\leadsto \color{blue}{x - \frac{-y}{1.1283791670955126 \cdot e^{z} - x \cdot y}} \]
      4. distribute-frac-neg99.8%

        \[\leadsto x - \color{blue}{\left(-\frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}\right)} \]
      5. distribute-neg-frac299.8%

        \[\leadsto x - \color{blue}{\frac{y}{-\left(1.1283791670955126 \cdot e^{z} - x \cdot y\right)}} \]
      6. neg-sub099.8%

        \[\leadsto x - \frac{y}{\color{blue}{0 - \left(1.1283791670955126 \cdot e^{z} - x \cdot y\right)}} \]
      7. associate--r-99.8%

        \[\leadsto x - \frac{y}{\color{blue}{\left(0 - 1.1283791670955126 \cdot e^{z}\right) + x \cdot y}} \]
      8. neg-sub099.8%

        \[\leadsto x - \frac{y}{\color{blue}{\left(-1.1283791670955126 \cdot e^{z}\right)} + x \cdot y} \]
      9. +-commutative99.8%

        \[\leadsto x - \frac{y}{\color{blue}{x \cdot y + \left(-1.1283791670955126 \cdot e^{z}\right)}} \]
      10. fma-define99.9%

        \[\leadsto x - \frac{y}{\color{blue}{\mathsf{fma}\left(x, y, -1.1283791670955126 \cdot e^{z}\right)}} \]
      11. *-commutative99.9%

        \[\leadsto x - \frac{y}{\mathsf{fma}\left(x, y, -\color{blue}{e^{z} \cdot 1.1283791670955126}\right)} \]
      12. distribute-rgt-neg-in99.9%

        \[\leadsto x - \frac{y}{\mathsf{fma}\left(x, y, \color{blue}{e^{z} \cdot \left(-1.1283791670955126\right)}\right)} \]
      13. metadata-eval99.9%

        \[\leadsto x - \frac{y}{\mathsf{fma}\left(x, y, e^{z} \cdot \color{blue}{-1.1283791670955126}\right)} \]
    3. Simplified99.9%

      \[\leadsto \color{blue}{x - \frac{y}{\mathsf{fma}\left(x, y, e^{z} \cdot -1.1283791670955126\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in z around 0 99.1%

      \[\leadsto \color{blue}{x - \frac{y}{x \cdot y - 1.1283791670955126}} \]
    6. Step-by-step derivation
      1. *-commutative99.1%

        \[\leadsto x - \frac{y}{\color{blue}{y \cdot x} - 1.1283791670955126} \]
      2. fmm-def99.1%

        \[\leadsto x - \frac{y}{\color{blue}{\mathsf{fma}\left(y, x, -1.1283791670955126\right)}} \]
      3. metadata-eval99.1%

        \[\leadsto x - \frac{y}{\mathsf{fma}\left(y, x, \color{blue}{-1.1283791670955126}\right)} \]
    7. Simplified99.1%

      \[\leadsto \color{blue}{x - \frac{y}{\mathsf{fma}\left(y, x, -1.1283791670955126\right)}} \]
    8. Taylor expanded in y around inf 99.0%

      \[\leadsto x - \frac{y}{\color{blue}{y \cdot \left(x - 1.1283791670955126 \cdot \frac{1}{y}\right)}} \]
    9. Step-by-step derivation
      1. associate-*r/99.1%

        \[\leadsto x - \frac{y}{y \cdot \left(x - \color{blue}{\frac{1.1283791670955126 \cdot 1}{y}}\right)} \]
      2. metadata-eval99.1%

        \[\leadsto x - \frac{y}{y \cdot \left(x - \frac{\color{blue}{1.1283791670955126}}{y}\right)} \]
    10. Simplified99.1%

      \[\leadsto x - \frac{y}{\color{blue}{y \cdot \left(x - \frac{1.1283791670955126}{y}\right)}} \]

    if 300 < z

    1. Initial program 90.5%

      \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 100.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -85:\\ \;\;\;\;x + \frac{-1}{x}\\ \mathbf{elif}\;z \leq 300:\\ \;\;\;\;x + \frac{y}{y \cdot \left(\frac{1.1283791670955126}{y} - x\right)}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 74.2% accurate, 5.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.1 \cdot 10^{+186}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq -2.1 \cdot 10^{+31}:\\
\;\;\;\;\frac{-1}{x}\\

\mathbf{elif}\;z \leq 0.044:\\
\;\;\;\;x - y \cdot -0.8862269254527579\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -2.1e186 or 0.043999999999999997 < z

    1. Initial program 93.3%

      \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 89.1%

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

    if -2.1e186 < z < -2.09999999999999979e31

    1. Initial program 83.6%

      \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
    2. Step-by-step derivation
      1. remove-double-neg83.6%

        \[\leadsto x + \frac{\color{blue}{-\left(-y\right)}}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
      2. distribute-frac-neg83.6%

        \[\leadsto x + \color{blue}{\left(-\frac{-y}{1.1283791670955126 \cdot e^{z} - x \cdot y}\right)} \]
      3. unsub-neg83.6%

        \[\leadsto \color{blue}{x - \frac{-y}{1.1283791670955126 \cdot e^{z} - x \cdot y}} \]
      4. distribute-frac-neg83.6%

        \[\leadsto x - \color{blue}{\left(-\frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}\right)} \]
      5. distribute-neg-frac283.6%

        \[\leadsto x - \color{blue}{\frac{y}{-\left(1.1283791670955126 \cdot e^{z} - x \cdot y\right)}} \]
      6. neg-sub084.1%

        \[\leadsto x - \frac{y}{\color{blue}{0 - \left(1.1283791670955126 \cdot e^{z} - x \cdot y\right)}} \]
      7. associate--r-84.1%

        \[\leadsto x - \frac{y}{\color{blue}{\left(0 - 1.1283791670955126 \cdot e^{z}\right) + x \cdot y}} \]
      8. neg-sub084.4%

        \[\leadsto x - \frac{y}{\color{blue}{\left(-1.1283791670955126 \cdot e^{z}\right)} + x \cdot y} \]
      9. +-commutative84.4%

        \[\leadsto x - \frac{y}{\color{blue}{x \cdot y + \left(-1.1283791670955126 \cdot e^{z}\right)}} \]
      10. fma-define84.4%

        \[\leadsto x - \frac{y}{\color{blue}{\mathsf{fma}\left(x, y, -1.1283791670955126 \cdot e^{z}\right)}} \]
      11. *-commutative84.4%

        \[\leadsto x - \frac{y}{\mathsf{fma}\left(x, y, -\color{blue}{e^{z} \cdot 1.1283791670955126}\right)} \]
      12. distribute-rgt-neg-in84.4%

        \[\leadsto x - \frac{y}{\mathsf{fma}\left(x, y, \color{blue}{e^{z} \cdot \left(-1.1283791670955126\right)}\right)} \]
      13. metadata-eval84.4%

        \[\leadsto x - \frac{y}{\mathsf{fma}\left(x, y, e^{z} \cdot \color{blue}{-1.1283791670955126}\right)} \]
    3. Simplified84.4%

      \[\leadsto \color{blue}{x - \frac{y}{\mathsf{fma}\left(x, y, e^{z} \cdot -1.1283791670955126\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 84.4%

      \[\leadsto x - \frac{y}{\color{blue}{x \cdot y}} \]
    6. Step-by-step derivation
      1. *-commutative84.4%

        \[\leadsto x - \frac{y}{\color{blue}{y \cdot x}} \]
    7. Simplified84.4%

      \[\leadsto x - \frac{y}{\color{blue}{y \cdot x}} \]
    8. Taylor expanded in x around 0 64.2%

      \[\leadsto \color{blue}{\frac{-1}{x}} \]

    if -2.09999999999999979e31 < z < 0.043999999999999997

    1. Initial program 98.5%

      \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
    2. Step-by-step derivation
      1. remove-double-neg98.5%

        \[\leadsto x + \frac{\color{blue}{-\left(-y\right)}}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
      2. distribute-frac-neg98.5%

        \[\leadsto x + \color{blue}{\left(-\frac{-y}{1.1283791670955126 \cdot e^{z} - x \cdot y}\right)} \]
      3. unsub-neg98.5%

        \[\leadsto \color{blue}{x - \frac{-y}{1.1283791670955126 \cdot e^{z} - x \cdot y}} \]
      4. distribute-frac-neg98.5%

        \[\leadsto x - \color{blue}{\left(-\frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}\right)} \]
      5. distribute-neg-frac298.5%

        \[\leadsto x - \color{blue}{\frac{y}{-\left(1.1283791670955126 \cdot e^{z} - x \cdot y\right)}} \]
      6. neg-sub098.3%

        \[\leadsto x - \frac{y}{\color{blue}{0 - \left(1.1283791670955126 \cdot e^{z} - x \cdot y\right)}} \]
      7. associate--r-98.3%

        \[\leadsto x - \frac{y}{\color{blue}{\left(0 - 1.1283791670955126 \cdot e^{z}\right) + x \cdot y}} \]
      8. neg-sub098.5%

        \[\leadsto x - \frac{y}{\color{blue}{\left(-1.1283791670955126 \cdot e^{z}\right)} + x \cdot y} \]
      9. +-commutative98.5%

        \[\leadsto x - \frac{y}{\color{blue}{x \cdot y + \left(-1.1283791670955126 \cdot e^{z}\right)}} \]
      10. fma-define98.5%

        \[\leadsto x - \frac{y}{\color{blue}{\mathsf{fma}\left(x, y, -1.1283791670955126 \cdot e^{z}\right)}} \]
      11. *-commutative98.5%

        \[\leadsto x - \frac{y}{\mathsf{fma}\left(x, y, -\color{blue}{e^{z} \cdot 1.1283791670955126}\right)} \]
      12. distribute-rgt-neg-in98.5%

        \[\leadsto x - \frac{y}{\mathsf{fma}\left(x, y, \color{blue}{e^{z} \cdot \left(-1.1283791670955126\right)}\right)} \]
      13. metadata-eval98.5%

        \[\leadsto x - \frac{y}{\mathsf{fma}\left(x, y, e^{z} \cdot \color{blue}{-1.1283791670955126}\right)} \]
    3. Simplified98.5%

      \[\leadsto \color{blue}{x - \frac{y}{\mathsf{fma}\left(x, y, e^{z} \cdot -1.1283791670955126\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in z around 0 96.9%

      \[\leadsto \color{blue}{x - \frac{y}{x \cdot y - 1.1283791670955126}} \]
    6. Step-by-step derivation
      1. *-commutative96.9%

        \[\leadsto x - \frac{y}{\color{blue}{y \cdot x} - 1.1283791670955126} \]
      2. fmm-def96.9%

        \[\leadsto x - \frac{y}{\color{blue}{\mathsf{fma}\left(y, x, -1.1283791670955126\right)}} \]
      3. metadata-eval96.9%

        \[\leadsto x - \frac{y}{\mathsf{fma}\left(y, x, \color{blue}{-1.1283791670955126}\right)} \]
    7. Simplified96.9%

      \[\leadsto \color{blue}{x - \frac{y}{\mathsf{fma}\left(y, x, -1.1283791670955126\right)}} \]
    8. Taylor expanded in y around 0 75.6%

      \[\leadsto x - \color{blue}{-0.8862269254527579 \cdot y} \]
    9. Step-by-step derivation
      1. *-commutative75.6%

        \[\leadsto x - \color{blue}{y \cdot -0.8862269254527579} \]
    10. Simplified75.6%

      \[\leadsto x - \color{blue}{y \cdot -0.8862269254527579} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 8: 99.5% accurate, 5.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;z \leq -220:\\ \;\;\;\;x + \frac{-1}{x}\\ \mathbf{elif}\;z \leq 200:\\ \;\;\;\;x + \frac{y}{1.1283791670955126 - x \cdot y}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= z -220.0)
   (+ x (/ -1.0 x))
   (if (<= z 200.0) (+ x (/ y (- 1.1283791670955126 (* x y)))) x)))
double code(double x, double y, double z) {
	double tmp;
	if (z <= -220.0) {
		tmp = x + (-1.0 / x);
	} else if (z <= 200.0) {
		tmp = x + (y / (1.1283791670955126 - (x * y)));
	} else {
		tmp = x;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (z <= (-220.0d0)) then
        tmp = x + ((-1.0d0) / x)
    else if (z <= 200.0d0) then
        tmp = x + (y / (1.1283791670955126d0 - (x * y)))
    else
        tmp = x
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (z <= -220.0) {
		tmp = x + (-1.0 / x);
	} else if (z <= 200.0) {
		tmp = x + (y / (1.1283791670955126 - (x * y)));
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if z <= -220.0:
		tmp = x + (-1.0 / x)
	elif z <= 200.0:
		tmp = x + (y / (1.1283791670955126 - (x * y)))
	else:
		tmp = x
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (z <= -220.0)
		tmp = Float64(x + Float64(-1.0 / x));
	elseif (z <= 200.0)
		tmp = Float64(x + Float64(y / Float64(1.1283791670955126 - Float64(x * y))));
	else
		tmp = x;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (z <= -220.0)
		tmp = x + (-1.0 / x);
	elseif (z <= 200.0)
		tmp = x + (y / (1.1283791670955126 - (x * y)));
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[z, -220.0], N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 200.0], N[(x + N[(y / N[(1.1283791670955126 - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;z \leq -220:\\
\;\;\;\;x + \frac{-1}{x}\\

\mathbf{elif}\;z \leq 200:\\
\;\;\;\;x + \frac{y}{1.1283791670955126 - x \cdot y}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -220

    1. Initial program 88.9%

      \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 100.0%

      \[\leadsto \color{blue}{x - \frac{1}{x}} \]

    if -220 < z < 200

    1. Initial program 99.8%

      \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
    2. Step-by-step derivation
      1. remove-double-neg99.8%

        \[\leadsto x + \frac{\color{blue}{-\left(-y\right)}}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
      2. distribute-frac-neg99.8%

        \[\leadsto x + \color{blue}{\left(-\frac{-y}{1.1283791670955126 \cdot e^{z} - x \cdot y}\right)} \]
      3. unsub-neg99.8%

        \[\leadsto \color{blue}{x - \frac{-y}{1.1283791670955126 \cdot e^{z} - x \cdot y}} \]
      4. distribute-frac-neg99.8%

        \[\leadsto x - \color{blue}{\left(-\frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}\right)} \]
      5. distribute-neg-frac299.8%

        \[\leadsto x - \color{blue}{\frac{y}{-\left(1.1283791670955126 \cdot e^{z} - x \cdot y\right)}} \]
      6. neg-sub099.8%

        \[\leadsto x - \frac{y}{\color{blue}{0 - \left(1.1283791670955126 \cdot e^{z} - x \cdot y\right)}} \]
      7. associate--r-99.8%

        \[\leadsto x - \frac{y}{\color{blue}{\left(0 - 1.1283791670955126 \cdot e^{z}\right) + x \cdot y}} \]
      8. neg-sub099.8%

        \[\leadsto x - \frac{y}{\color{blue}{\left(-1.1283791670955126 \cdot e^{z}\right)} + x \cdot y} \]
      9. +-commutative99.8%

        \[\leadsto x - \frac{y}{\color{blue}{x \cdot y + \left(-1.1283791670955126 \cdot e^{z}\right)}} \]
      10. fma-define99.9%

        \[\leadsto x - \frac{y}{\color{blue}{\mathsf{fma}\left(x, y, -1.1283791670955126 \cdot e^{z}\right)}} \]
      11. *-commutative99.9%

        \[\leadsto x - \frac{y}{\mathsf{fma}\left(x, y, -\color{blue}{e^{z} \cdot 1.1283791670955126}\right)} \]
      12. distribute-rgt-neg-in99.9%

        \[\leadsto x - \frac{y}{\mathsf{fma}\left(x, y, \color{blue}{e^{z} \cdot \left(-1.1283791670955126\right)}\right)} \]
      13. metadata-eval99.9%

        \[\leadsto x - \frac{y}{\mathsf{fma}\left(x, y, e^{z} \cdot \color{blue}{-1.1283791670955126}\right)} \]
    3. Simplified99.9%

      \[\leadsto \color{blue}{x - \frac{y}{\mathsf{fma}\left(x, y, e^{z} \cdot -1.1283791670955126\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in z around 0 99.1%

      \[\leadsto \color{blue}{x - \frac{y}{x \cdot y - 1.1283791670955126}} \]

    if 200 < z

    1. Initial program 90.5%

      \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 100.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -220:\\ \;\;\;\;x + \frac{-1}{x}\\ \mathbf{elif}\;z \leq 200:\\ \;\;\;\;x + \frac{y}{1.1283791670955126 - x \cdot y}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 86.7% accurate, 5.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.15 \cdot 10^{-33}:\\
\;\;\;\;x + \frac{-1}{x}\\

\mathbf{elif}\;z \leq 0.00082:\\
\;\;\;\;x + \frac{y}{1.1283791670955126 \cdot \left(z + 1\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.14999999999999993e-33

    1. Initial program 90.2%

      \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 97.4%

      \[\leadsto \color{blue}{x - \frac{1}{x}} \]

    if -1.14999999999999993e-33 < z < 8.1999999999999998e-4

    1. Initial program 99.8%

      \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
    2. Add Preprocessing
    3. Taylor expanded in z around 0 99.7%

      \[\leadsto x + \frac{y}{1.1283791670955126 \cdot \color{blue}{\left(1 + z\right)} - x \cdot y} \]
    4. Step-by-step derivation
      1. +-commutative99.7%

        \[\leadsto x + \frac{y}{1.1283791670955126 \cdot \color{blue}{\left(z + 1\right)} - x \cdot y} \]
    5. Simplified99.7%

      \[\leadsto x + \frac{y}{1.1283791670955126 \cdot \color{blue}{\left(z + 1\right)} - x \cdot y} \]
    6. Taylor expanded in x around 0 78.3%

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

    if 8.1999999999999998e-4 < z

    1. Initial program 90.5%

      \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 100.0%

      \[\leadsto \color{blue}{x} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification89.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.15 \cdot 10^{-33}:\\ \;\;\;\;x + \frac{-1}{x}\\ \mathbf{elif}\;z \leq 0.00082:\\ \;\;\;\;x + \frac{y}{1.1283791670955126 \cdot \left(z + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 70.2% accurate, 6.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -2.3 \cdot 10^{-254}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 2 \cdot 10^{-279}:\\ \;\;\;\;\frac{y}{1.1283791670955126}\\ \mathbf{elif}\;x \leq 1.16 \cdot 10^{-6}:\\ \;\;\;\;\frac{-1}{x}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= x -2.3e-254)
   x
   (if (<= x 2e-279)
     (/ y 1.1283791670955126)
     (if (<= x 1.16e-6) (/ -1.0 x) x))))
double code(double x, double y, double z) {
	double tmp;
	if (x <= -2.3e-254) {
		tmp = x;
	} else if (x <= 2e-279) {
		tmp = y / 1.1283791670955126;
	} else if (x <= 1.16e-6) {
		tmp = -1.0 / x;
	} else {
		tmp = x;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (x <= (-2.3d-254)) then
        tmp = x
    else if (x <= 2d-279) then
        tmp = y / 1.1283791670955126d0
    else if (x <= 1.16d-6) then
        tmp = (-1.0d0) / x
    else
        tmp = x
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (x <= -2.3e-254) {
		tmp = x;
	} else if (x <= 2e-279) {
		tmp = y / 1.1283791670955126;
	} else if (x <= 1.16e-6) {
		tmp = -1.0 / x;
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if x <= -2.3e-254:
		tmp = x
	elif x <= 2e-279:
		tmp = y / 1.1283791670955126
	elif x <= 1.16e-6:
		tmp = -1.0 / x
	else:
		tmp = x
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (x <= -2.3e-254)
		tmp = x;
	elseif (x <= 2e-279)
		tmp = Float64(y / 1.1283791670955126);
	elseif (x <= 1.16e-6)
		tmp = Float64(-1.0 / x);
	else
		tmp = x;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (x <= -2.3e-254)
		tmp = x;
	elseif (x <= 2e-279)
		tmp = y / 1.1283791670955126;
	elseif (x <= 1.16e-6)
		tmp = -1.0 / x;
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[x, -2.3e-254], x, If[LessEqual[x, 2e-279], N[(y / 1.1283791670955126), $MachinePrecision], If[LessEqual[x, 1.16e-6], N[(-1.0 / x), $MachinePrecision], x]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.3 \cdot 10^{-254}:\\
\;\;\;\;x\\

\mathbf{elif}\;x \leq 2 \cdot 10^{-279}:\\
\;\;\;\;\frac{y}{1.1283791670955126}\\

\mathbf{elif}\;x \leq 1.16 \cdot 10^{-6}:\\
\;\;\;\;\frac{-1}{x}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -2.2999999999999999e-254 or 1.1599999999999999e-6 < x

    1. Initial program 95.5%

      \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 84.0%

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

    if -2.2999999999999999e-254 < x < 2.00000000000000011e-279

    1. Initial program 87.5%

      \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
    2. Step-by-step derivation
      1. remove-double-neg87.5%

        \[\leadsto x + \frac{\color{blue}{-\left(-y\right)}}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
      2. distribute-frac-neg87.5%

        \[\leadsto x + \color{blue}{\left(-\frac{-y}{1.1283791670955126 \cdot e^{z} - x \cdot y}\right)} \]
      3. unsub-neg87.5%

        \[\leadsto \color{blue}{x - \frac{-y}{1.1283791670955126 \cdot e^{z} - x \cdot y}} \]
      4. distribute-frac-neg87.5%

        \[\leadsto x - \color{blue}{\left(-\frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}\right)} \]
      5. distribute-neg-frac287.5%

        \[\leadsto x - \color{blue}{\frac{y}{-\left(1.1283791670955126 \cdot e^{z} - x \cdot y\right)}} \]
      6. neg-sub087.8%

        \[\leadsto x - \frac{y}{\color{blue}{0 - \left(1.1283791670955126 \cdot e^{z} - x \cdot y\right)}} \]
      7. associate--r-87.8%

        \[\leadsto x - \frac{y}{\color{blue}{\left(0 - 1.1283791670955126 \cdot e^{z}\right) + x \cdot y}} \]
      8. neg-sub088.2%

        \[\leadsto x - \frac{y}{\color{blue}{\left(-1.1283791670955126 \cdot e^{z}\right)} + x \cdot y} \]
      9. +-commutative88.2%

        \[\leadsto x - \frac{y}{\color{blue}{x \cdot y + \left(-1.1283791670955126 \cdot e^{z}\right)}} \]
      10. fma-define88.2%

        \[\leadsto x - \frac{y}{\color{blue}{\mathsf{fma}\left(x, y, -1.1283791670955126 \cdot e^{z}\right)}} \]
      11. *-commutative88.2%

        \[\leadsto x - \frac{y}{\mathsf{fma}\left(x, y, -\color{blue}{e^{z} \cdot 1.1283791670955126}\right)} \]
      12. distribute-rgt-neg-in88.2%

        \[\leadsto x - \frac{y}{\mathsf{fma}\left(x, y, \color{blue}{e^{z} \cdot \left(-1.1283791670955126\right)}\right)} \]
      13. metadata-eval88.2%

        \[\leadsto x - \frac{y}{\mathsf{fma}\left(x, y, e^{z} \cdot \color{blue}{-1.1283791670955126}\right)} \]
    3. Simplified88.2%

      \[\leadsto \color{blue}{x - \frac{y}{\mathsf{fma}\left(x, y, e^{z} \cdot -1.1283791670955126\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in z around 0 78.6%

      \[\leadsto \color{blue}{x - \frac{y}{x \cdot y - 1.1283791670955126}} \]
    6. Step-by-step derivation
      1. *-commutative78.6%

        \[\leadsto x - \frac{y}{\color{blue}{y \cdot x} - 1.1283791670955126} \]
      2. fmm-def78.6%

        \[\leadsto x - \frac{y}{\color{blue}{\mathsf{fma}\left(y, x, -1.1283791670955126\right)}} \]
      3. metadata-eval78.6%

        \[\leadsto x - \frac{y}{\mathsf{fma}\left(y, x, \color{blue}{-1.1283791670955126}\right)} \]
    7. Simplified78.6%

      \[\leadsto \color{blue}{x - \frac{y}{\mathsf{fma}\left(y, x, -1.1283791670955126\right)}} \]
    8. Taylor expanded in x around 0 73.6%

      \[\leadsto \color{blue}{0.8862269254527579 \cdot y} \]
    9. Step-by-step derivation
      1. *-commutative73.6%

        \[\leadsto \color{blue}{y \cdot 0.8862269254527579} \]
    10. Simplified73.6%

      \[\leadsto \color{blue}{y \cdot 0.8862269254527579} \]
    11. Step-by-step derivation
      1. metadata-eval73.5%

        \[\leadsto y \cdot \color{blue}{\frac{1}{1.1283791670955126}} \]
      2. div-inv73.9%

        \[\leadsto \color{blue}{\frac{y}{1.1283791670955126}} \]
    12. Applied egg-rr73.9%

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

    if 2.00000000000000011e-279 < x < 1.1599999999999999e-6

    1. Initial program 94.7%

      \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
    2. Step-by-step derivation
      1. remove-double-neg94.7%

        \[\leadsto x + \frac{\color{blue}{-\left(-y\right)}}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
      2. distribute-frac-neg94.7%

        \[\leadsto x + \color{blue}{\left(-\frac{-y}{1.1283791670955126 \cdot e^{z} - x \cdot y}\right)} \]
      3. unsub-neg94.7%

        \[\leadsto \color{blue}{x - \frac{-y}{1.1283791670955126 \cdot e^{z} - x \cdot y}} \]
      4. distribute-frac-neg94.7%

        \[\leadsto x - \color{blue}{\left(-\frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}\right)} \]
      5. distribute-neg-frac294.7%

        \[\leadsto x - \color{blue}{\frac{y}{-\left(1.1283791670955126 \cdot e^{z} - x \cdot y\right)}} \]
      6. neg-sub094.6%

        \[\leadsto x - \frac{y}{\color{blue}{0 - \left(1.1283791670955126 \cdot e^{z} - x \cdot y\right)}} \]
      7. associate--r-94.6%

        \[\leadsto x - \frac{y}{\color{blue}{\left(0 - 1.1283791670955126 \cdot e^{z}\right) + x \cdot y}} \]
      8. neg-sub094.8%

        \[\leadsto x - \frac{y}{\color{blue}{\left(-1.1283791670955126 \cdot e^{z}\right)} + x \cdot y} \]
      9. +-commutative94.8%

        \[\leadsto x - \frac{y}{\color{blue}{x \cdot y + \left(-1.1283791670955126 \cdot e^{z}\right)}} \]
      10. fma-define94.9%

        \[\leadsto x - \frac{y}{\color{blue}{\mathsf{fma}\left(x, y, -1.1283791670955126 \cdot e^{z}\right)}} \]
      11. *-commutative94.9%

        \[\leadsto x - \frac{y}{\mathsf{fma}\left(x, y, -\color{blue}{e^{z} \cdot 1.1283791670955126}\right)} \]
      12. distribute-rgt-neg-in94.9%

        \[\leadsto x - \frac{y}{\mathsf{fma}\left(x, y, \color{blue}{e^{z} \cdot \left(-1.1283791670955126\right)}\right)} \]
      13. metadata-eval94.9%

        \[\leadsto x - \frac{y}{\mathsf{fma}\left(x, y, e^{z} \cdot \color{blue}{-1.1283791670955126}\right)} \]
    3. Simplified94.9%

      \[\leadsto \color{blue}{x - \frac{y}{\mathsf{fma}\left(x, y, e^{z} \cdot -1.1283791670955126\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 45.5%

      \[\leadsto x - \frac{y}{\color{blue}{x \cdot y}} \]
    6. Step-by-step derivation
      1. *-commutative45.5%

        \[\leadsto x - \frac{y}{\color{blue}{y \cdot x}} \]
    7. Simplified45.5%

      \[\leadsto x - \frac{y}{\color{blue}{y \cdot x}} \]
    8. Taylor expanded in x around 0 50.6%

      \[\leadsto \color{blue}{\frac{-1}{x}} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 11: 70.2% accurate, 6.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -4.8 \cdot 10^{-254}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 8.5 \cdot 10^{-278}:\\ \;\;\;\;y \cdot 0.8862269254527579\\ \mathbf{elif}\;x \leq 1.75 \cdot 10^{-6}:\\ \;\;\;\;\frac{-1}{x}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= x -4.8e-254)
   x
   (if (<= x 8.5e-278)
     (* y 0.8862269254527579)
     (if (<= x 1.75e-6) (/ -1.0 x) x))))
double code(double x, double y, double z) {
	double tmp;
	if (x <= -4.8e-254) {
		tmp = x;
	} else if (x <= 8.5e-278) {
		tmp = y * 0.8862269254527579;
	} else if (x <= 1.75e-6) {
		tmp = -1.0 / x;
	} else {
		tmp = x;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (x <= (-4.8d-254)) then
        tmp = x
    else if (x <= 8.5d-278) then
        tmp = y * 0.8862269254527579d0
    else if (x <= 1.75d-6) then
        tmp = (-1.0d0) / x
    else
        tmp = x
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (x <= -4.8e-254) {
		tmp = x;
	} else if (x <= 8.5e-278) {
		tmp = y * 0.8862269254527579;
	} else if (x <= 1.75e-6) {
		tmp = -1.0 / x;
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if x <= -4.8e-254:
		tmp = x
	elif x <= 8.5e-278:
		tmp = y * 0.8862269254527579
	elif x <= 1.75e-6:
		tmp = -1.0 / x
	else:
		tmp = x
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (x <= -4.8e-254)
		tmp = x;
	elseif (x <= 8.5e-278)
		tmp = Float64(y * 0.8862269254527579);
	elseif (x <= 1.75e-6)
		tmp = Float64(-1.0 / x);
	else
		tmp = x;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (x <= -4.8e-254)
		tmp = x;
	elseif (x <= 8.5e-278)
		tmp = y * 0.8862269254527579;
	elseif (x <= 1.75e-6)
		tmp = -1.0 / x;
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[x, -4.8e-254], x, If[LessEqual[x, 8.5e-278], N[(y * 0.8862269254527579), $MachinePrecision], If[LessEqual[x, 1.75e-6], N[(-1.0 / x), $MachinePrecision], x]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.8 \cdot 10^{-254}:\\
\;\;\;\;x\\

\mathbf{elif}\;x \leq 8.5 \cdot 10^{-278}:\\
\;\;\;\;y \cdot 0.8862269254527579\\

\mathbf{elif}\;x \leq 1.75 \cdot 10^{-6}:\\
\;\;\;\;\frac{-1}{x}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -4.80000000000000003e-254 or 1.74999999999999997e-6 < x

    1. Initial program 95.5%

      \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 84.0%

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

    if -4.80000000000000003e-254 < x < 8.49999999999999955e-278

    1. Initial program 87.5%

      \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
    2. Step-by-step derivation
      1. remove-double-neg87.5%

        \[\leadsto x + \frac{\color{blue}{-\left(-y\right)}}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
      2. distribute-frac-neg87.5%

        \[\leadsto x + \color{blue}{\left(-\frac{-y}{1.1283791670955126 \cdot e^{z} - x \cdot y}\right)} \]
      3. unsub-neg87.5%

        \[\leadsto \color{blue}{x - \frac{-y}{1.1283791670955126 \cdot e^{z} - x \cdot y}} \]
      4. distribute-frac-neg87.5%

        \[\leadsto x - \color{blue}{\left(-\frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}\right)} \]
      5. distribute-neg-frac287.5%

        \[\leadsto x - \color{blue}{\frac{y}{-\left(1.1283791670955126 \cdot e^{z} - x \cdot y\right)}} \]
      6. neg-sub087.8%

        \[\leadsto x - \frac{y}{\color{blue}{0 - \left(1.1283791670955126 \cdot e^{z} - x \cdot y\right)}} \]
      7. associate--r-87.8%

        \[\leadsto x - \frac{y}{\color{blue}{\left(0 - 1.1283791670955126 \cdot e^{z}\right) + x \cdot y}} \]
      8. neg-sub088.2%

        \[\leadsto x - \frac{y}{\color{blue}{\left(-1.1283791670955126 \cdot e^{z}\right)} + x \cdot y} \]
      9. +-commutative88.2%

        \[\leadsto x - \frac{y}{\color{blue}{x \cdot y + \left(-1.1283791670955126 \cdot e^{z}\right)}} \]
      10. fma-define88.2%

        \[\leadsto x - \frac{y}{\color{blue}{\mathsf{fma}\left(x, y, -1.1283791670955126 \cdot e^{z}\right)}} \]
      11. *-commutative88.2%

        \[\leadsto x - \frac{y}{\mathsf{fma}\left(x, y, -\color{blue}{e^{z} \cdot 1.1283791670955126}\right)} \]
      12. distribute-rgt-neg-in88.2%

        \[\leadsto x - \frac{y}{\mathsf{fma}\left(x, y, \color{blue}{e^{z} \cdot \left(-1.1283791670955126\right)}\right)} \]
      13. metadata-eval88.2%

        \[\leadsto x - \frac{y}{\mathsf{fma}\left(x, y, e^{z} \cdot \color{blue}{-1.1283791670955126}\right)} \]
    3. Simplified88.2%

      \[\leadsto \color{blue}{x - \frac{y}{\mathsf{fma}\left(x, y, e^{z} \cdot -1.1283791670955126\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in z around 0 78.6%

      \[\leadsto \color{blue}{x - \frac{y}{x \cdot y - 1.1283791670955126}} \]
    6. Step-by-step derivation
      1. *-commutative78.6%

        \[\leadsto x - \frac{y}{\color{blue}{y \cdot x} - 1.1283791670955126} \]
      2. fmm-def78.6%

        \[\leadsto x - \frac{y}{\color{blue}{\mathsf{fma}\left(y, x, -1.1283791670955126\right)}} \]
      3. metadata-eval78.6%

        \[\leadsto x - \frac{y}{\mathsf{fma}\left(y, x, \color{blue}{-1.1283791670955126}\right)} \]
    7. Simplified78.6%

      \[\leadsto \color{blue}{x - \frac{y}{\mathsf{fma}\left(y, x, -1.1283791670955126\right)}} \]
    8. Taylor expanded in x around 0 73.6%

      \[\leadsto \color{blue}{0.8862269254527579 \cdot y} \]
    9. Step-by-step derivation
      1. *-commutative73.6%

        \[\leadsto \color{blue}{y \cdot 0.8862269254527579} \]
    10. Simplified73.6%

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

    if 8.49999999999999955e-278 < x < 1.74999999999999997e-6

    1. Initial program 94.7%

      \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
    2. Step-by-step derivation
      1. remove-double-neg94.7%

        \[\leadsto x + \frac{\color{blue}{-\left(-y\right)}}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
      2. distribute-frac-neg94.7%

        \[\leadsto x + \color{blue}{\left(-\frac{-y}{1.1283791670955126 \cdot e^{z} - x \cdot y}\right)} \]
      3. unsub-neg94.7%

        \[\leadsto \color{blue}{x - \frac{-y}{1.1283791670955126 \cdot e^{z} - x \cdot y}} \]
      4. distribute-frac-neg94.7%

        \[\leadsto x - \color{blue}{\left(-\frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}\right)} \]
      5. distribute-neg-frac294.7%

        \[\leadsto x - \color{blue}{\frac{y}{-\left(1.1283791670955126 \cdot e^{z} - x \cdot y\right)}} \]
      6. neg-sub094.6%

        \[\leadsto x - \frac{y}{\color{blue}{0 - \left(1.1283791670955126 \cdot e^{z} - x \cdot y\right)}} \]
      7. associate--r-94.6%

        \[\leadsto x - \frac{y}{\color{blue}{\left(0 - 1.1283791670955126 \cdot e^{z}\right) + x \cdot y}} \]
      8. neg-sub094.8%

        \[\leadsto x - \frac{y}{\color{blue}{\left(-1.1283791670955126 \cdot e^{z}\right)} + x \cdot y} \]
      9. +-commutative94.8%

        \[\leadsto x - \frac{y}{\color{blue}{x \cdot y + \left(-1.1283791670955126 \cdot e^{z}\right)}} \]
      10. fma-define94.9%

        \[\leadsto x - \frac{y}{\color{blue}{\mathsf{fma}\left(x, y, -1.1283791670955126 \cdot e^{z}\right)}} \]
      11. *-commutative94.9%

        \[\leadsto x - \frac{y}{\mathsf{fma}\left(x, y, -\color{blue}{e^{z} \cdot 1.1283791670955126}\right)} \]
      12. distribute-rgt-neg-in94.9%

        \[\leadsto x - \frac{y}{\mathsf{fma}\left(x, y, \color{blue}{e^{z} \cdot \left(-1.1283791670955126\right)}\right)} \]
      13. metadata-eval94.9%

        \[\leadsto x - \frac{y}{\mathsf{fma}\left(x, y, e^{z} \cdot \color{blue}{-1.1283791670955126}\right)} \]
    3. Simplified94.9%

      \[\leadsto \color{blue}{x - \frac{y}{\mathsf{fma}\left(x, y, e^{z} \cdot -1.1283791670955126\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 45.5%

      \[\leadsto x - \frac{y}{\color{blue}{x \cdot y}} \]
    6. Step-by-step derivation
      1. *-commutative45.5%

        \[\leadsto x - \frac{y}{\color{blue}{y \cdot x}} \]
    7. Simplified45.5%

      \[\leadsto x - \frac{y}{\color{blue}{y \cdot x}} \]
    8. Taylor expanded in x around 0 50.6%

      \[\leadsto \color{blue}{\frac{-1}{x}} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 12: 86.5% accurate, 7.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.6 \cdot 10^{-39}:\\
\;\;\;\;x + \frac{-1}{x}\\

\mathbf{elif}\;z \leq 3.5 \cdot 10^{-7}:\\
\;\;\;\;x - y \cdot -0.8862269254527579\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if z < -1.5999999999999999e-39

    1. Initial program 90.2%

      \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf 97.4%

      \[\leadsto \color{blue}{x - \frac{1}{x}} \]

    if -1.5999999999999999e-39 < z < 3.49999999999999984e-7

    1. Initial program 99.8%

      \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
    2. Step-by-step derivation
      1. remove-double-neg99.8%

        \[\leadsto x + \frac{\color{blue}{-\left(-y\right)}}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
      2. distribute-frac-neg99.8%

        \[\leadsto x + \color{blue}{\left(-\frac{-y}{1.1283791670955126 \cdot e^{z} - x \cdot y}\right)} \]
      3. unsub-neg99.8%

        \[\leadsto \color{blue}{x - \frac{-y}{1.1283791670955126 \cdot e^{z} - x \cdot y}} \]
      4. distribute-frac-neg99.8%

        \[\leadsto x - \color{blue}{\left(-\frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}\right)} \]
      5. distribute-neg-frac299.8%

        \[\leadsto x - \color{blue}{\frac{y}{-\left(1.1283791670955126 \cdot e^{z} - x \cdot y\right)}} \]
      6. neg-sub099.8%

        \[\leadsto x - \frac{y}{\color{blue}{0 - \left(1.1283791670955126 \cdot e^{z} - x \cdot y\right)}} \]
      7. associate--r-99.8%

        \[\leadsto x - \frac{y}{\color{blue}{\left(0 - 1.1283791670955126 \cdot e^{z}\right) + x \cdot y}} \]
      8. neg-sub099.8%

        \[\leadsto x - \frac{y}{\color{blue}{\left(-1.1283791670955126 \cdot e^{z}\right)} + x \cdot y} \]
      9. +-commutative99.8%

        \[\leadsto x - \frac{y}{\color{blue}{x \cdot y + \left(-1.1283791670955126 \cdot e^{z}\right)}} \]
      10. fma-define99.8%

        \[\leadsto x - \frac{y}{\color{blue}{\mathsf{fma}\left(x, y, -1.1283791670955126 \cdot e^{z}\right)}} \]
      11. *-commutative99.8%

        \[\leadsto x - \frac{y}{\mathsf{fma}\left(x, y, -\color{blue}{e^{z} \cdot 1.1283791670955126}\right)} \]
      12. distribute-rgt-neg-in99.8%

        \[\leadsto x - \frac{y}{\mathsf{fma}\left(x, y, \color{blue}{e^{z} \cdot \left(-1.1283791670955126\right)}\right)} \]
      13. metadata-eval99.8%

        \[\leadsto x - \frac{y}{\mathsf{fma}\left(x, y, e^{z} \cdot \color{blue}{-1.1283791670955126}\right)} \]
    3. Simplified99.8%

      \[\leadsto \color{blue}{x - \frac{y}{\mathsf{fma}\left(x, y, e^{z} \cdot -1.1283791670955126\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in z around 0 99.0%

      \[\leadsto \color{blue}{x - \frac{y}{x \cdot y - 1.1283791670955126}} \]
    6. Step-by-step derivation
      1. *-commutative99.0%

        \[\leadsto x - \frac{y}{\color{blue}{y \cdot x} - 1.1283791670955126} \]
      2. fmm-def99.0%

        \[\leadsto x - \frac{y}{\color{blue}{\mathsf{fma}\left(y, x, -1.1283791670955126\right)}} \]
      3. metadata-eval99.0%

        \[\leadsto x - \frac{y}{\mathsf{fma}\left(y, x, \color{blue}{-1.1283791670955126}\right)} \]
    7. Simplified99.0%

      \[\leadsto \color{blue}{x - \frac{y}{\mathsf{fma}\left(y, x, -1.1283791670955126\right)}} \]
    8. Taylor expanded in y around 0 77.5%

      \[\leadsto x - \color{blue}{-0.8862269254527579 \cdot y} \]
    9. Step-by-step derivation
      1. *-commutative77.5%

        \[\leadsto x - \color{blue}{y \cdot -0.8862269254527579} \]
    10. Simplified77.5%

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

    if 3.49999999999999984e-7 < z

    1. Initial program 90.5%

      \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 100.0%

      \[\leadsto \color{blue}{x} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification88.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.6 \cdot 10^{-39}:\\ \;\;\;\;x + \frac{-1}{x}\\ \mathbf{elif}\;z \leq 3.5 \cdot 10^{-7}:\\ \;\;\;\;x - y \cdot -0.8862269254527579\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 69.8% accurate, 8.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -2.35 \cdot 10^{-253}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 1.38 \cdot 10^{-129}:\\ \;\;\;\;y \cdot 0.8862269254527579\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<= x -2.35e-253) x (if (<= x 1.38e-129) (* y 0.8862269254527579) x)))
double code(double x, double y, double z) {
	double tmp;
	if (x <= -2.35e-253) {
		tmp = x;
	} else if (x <= 1.38e-129) {
		tmp = y * 0.8862269254527579;
	} else {
		tmp = x;
	}
	return tmp;
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8) :: tmp
    if (x <= (-2.35d-253)) then
        tmp = x
    else if (x <= 1.38d-129) then
        tmp = y * 0.8862269254527579d0
    else
        tmp = x
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (x <= -2.35e-253) {
		tmp = x;
	} else if (x <= 1.38e-129) {
		tmp = y * 0.8862269254527579;
	} else {
		tmp = x;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if x <= -2.35e-253:
		tmp = x
	elif x <= 1.38e-129:
		tmp = y * 0.8862269254527579
	else:
		tmp = x
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (x <= -2.35e-253)
		tmp = x;
	elseif (x <= 1.38e-129)
		tmp = Float64(y * 0.8862269254527579);
	else
		tmp = x;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (x <= -2.35e-253)
		tmp = x;
	elseif (x <= 1.38e-129)
		tmp = y * 0.8862269254527579;
	else
		tmp = x;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[x, -2.35e-253], x, If[LessEqual[x, 1.38e-129], N[(y * 0.8862269254527579), $MachinePrecision], x]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.35 \cdot 10^{-253}:\\
\;\;\;\;x\\

\mathbf{elif}\;x \leq 1.38 \cdot 10^{-129}:\\
\;\;\;\;y \cdot 0.8862269254527579\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.34999999999999991e-253 or 1.38000000000000007e-129 < x

    1. Initial program 96.0%

      \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 78.6%

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

    if -2.34999999999999991e-253 < x < 1.38000000000000007e-129

    1. Initial program 89.9%

      \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
    2. Step-by-step derivation
      1. remove-double-neg89.9%

        \[\leadsto x + \frac{\color{blue}{-\left(-y\right)}}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
      2. distribute-frac-neg89.9%

        \[\leadsto x + \color{blue}{\left(-\frac{-y}{1.1283791670955126 \cdot e^{z} - x \cdot y}\right)} \]
      3. unsub-neg89.9%

        \[\leadsto \color{blue}{x - \frac{-y}{1.1283791670955126 \cdot e^{z} - x \cdot y}} \]
      4. distribute-frac-neg89.9%

        \[\leadsto x - \color{blue}{\left(-\frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}\right)} \]
      5. distribute-neg-frac289.9%

        \[\leadsto x - \color{blue}{\frac{y}{-\left(1.1283791670955126 \cdot e^{z} - x \cdot y\right)}} \]
      6. neg-sub089.9%

        \[\leadsto x - \frac{y}{\color{blue}{0 - \left(1.1283791670955126 \cdot e^{z} - x \cdot y\right)}} \]
      7. associate--r-89.9%

        \[\leadsto x - \frac{y}{\color{blue}{\left(0 - 1.1283791670955126 \cdot e^{z}\right) + x \cdot y}} \]
      8. neg-sub090.3%

        \[\leadsto x - \frac{y}{\color{blue}{\left(-1.1283791670955126 \cdot e^{z}\right)} + x \cdot y} \]
      9. +-commutative90.3%

        \[\leadsto x - \frac{y}{\color{blue}{x \cdot y + \left(-1.1283791670955126 \cdot e^{z}\right)}} \]
      10. fma-define90.3%

        \[\leadsto x - \frac{y}{\color{blue}{\mathsf{fma}\left(x, y, -1.1283791670955126 \cdot e^{z}\right)}} \]
      11. *-commutative90.3%

        \[\leadsto x - \frac{y}{\mathsf{fma}\left(x, y, -\color{blue}{e^{z} \cdot 1.1283791670955126}\right)} \]
      12. distribute-rgt-neg-in90.3%

        \[\leadsto x - \frac{y}{\mathsf{fma}\left(x, y, \color{blue}{e^{z} \cdot \left(-1.1283791670955126\right)}\right)} \]
      13. metadata-eval90.3%

        \[\leadsto x - \frac{y}{\mathsf{fma}\left(x, y, e^{z} \cdot \color{blue}{-1.1283791670955126}\right)} \]
    3. Simplified90.3%

      \[\leadsto \color{blue}{x - \frac{y}{\mathsf{fma}\left(x, y, e^{z} \cdot -1.1283791670955126\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in z around 0 64.7%

      \[\leadsto \color{blue}{x - \frac{y}{x \cdot y - 1.1283791670955126}} \]
    6. Step-by-step derivation
      1. *-commutative64.7%

        \[\leadsto x - \frac{y}{\color{blue}{y \cdot x} - 1.1283791670955126} \]
      2. fmm-def64.7%

        \[\leadsto x - \frac{y}{\color{blue}{\mathsf{fma}\left(y, x, -1.1283791670955126\right)}} \]
      3. metadata-eval64.7%

        \[\leadsto x - \frac{y}{\mathsf{fma}\left(y, x, \color{blue}{-1.1283791670955126}\right)} \]
    7. Simplified64.7%

      \[\leadsto \color{blue}{x - \frac{y}{\mathsf{fma}\left(y, x, -1.1283791670955126\right)}} \]
    8. Taylor expanded in x around 0 45.9%

      \[\leadsto \color{blue}{0.8862269254527579 \cdot y} \]
    9. Step-by-step derivation
      1. *-commutative45.9%

        \[\leadsto \color{blue}{y \cdot 0.8862269254527579} \]
    10. Simplified45.9%

      \[\leadsto \color{blue}{y \cdot 0.8862269254527579} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 14: 68.9% accurate, 111.0× speedup?

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

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

    \[x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \]
  2. Add Preprocessing
  3. Taylor expanded in x around inf 65.9%

    \[\leadsto \color{blue}{x} \]
  4. Add Preprocessing

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

\[\begin{array}{l} \\ x + \frac{1}{\frac{1.1283791670955126}{y} \cdot e^{z} - x} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (+ x (/ 1.0 (- (* (/ 1.1283791670955126 y) (exp z)) x))))
double code(double x, double y, double z) {
	return x + (1.0 / (((1.1283791670955126 / y) * exp(z)) - x));
}
real(8) function code(x, y, z)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = x + (1.0d0 / (((1.1283791670955126d0 / y) * exp(z)) - x))
end function
public static double code(double x, double y, double z) {
	return x + (1.0 / (((1.1283791670955126 / y) * Math.exp(z)) - x));
}
def code(x, y, z):
	return x + (1.0 / (((1.1283791670955126 / y) * math.exp(z)) - x))
function code(x, y, z)
	return Float64(x + Float64(1.0 / Float64(Float64(Float64(1.1283791670955126 / y) * exp(z)) - x)))
end
function tmp = code(x, y, z)
	tmp = x + (1.0 / (((1.1283791670955126 / y) * exp(z)) - x));
end
code[x_, y_, z_] := N[(x + N[(1.0 / N[(N[(N[(1.1283791670955126 / y), $MachinePrecision] * N[Exp[z], $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
x + \frac{1}{\frac{1.1283791670955126}{y} \cdot e^{z} - x}
\end{array}

Reproduce

?
herbie shell --seed 2024181 
(FPCore (x y z)
  :name "Numeric.SpecFunctions:invErfc from math-functions-0.1.5.2, A"
  :precision binary64

  :alt
  (! :herbie-platform default (+ x (/ 1 (- (* (/ 5641895835477563/5000000000000000 y) (exp z)) x))))

  (+ x (/ y (- (* 1.1283791670955126 (exp z)) (* x y)))))