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

Percentage Accurate: 95.5% → 99.5%
Time: 11.8s
Alternatives: 14
Speedup: 0.9×

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.5% accurate, 0.4× speedup?

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

\\
\begin{array}{l}
t_0 := z \cdot \mathsf{fma}\left(z, 0.18806319451591877, 0.5641895835477563\right)\\
\mathbf{if}\;e^{z} \leq 0:\\
\;\;\;\;x + \frac{-1}{x}\\

\mathbf{elif}\;e^{z} \leq 1.00000000000002:\\
\;\;\;\;x + \frac{y}{\mathsf{fma}\left(z, \frac{\mathsf{fma}\left(t\_0, t\_0, -1.2732395447351628\right)}{\mathsf{fma}\left(z, \mathsf{fma}\left(z, 0.18806319451591877, 0.5641895835477563\right), -1.1283791670955126\right)}, 1.1283791670955126\right) - x \cdot y}\\

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


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

    1. Initial program 92.3%

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

      \[\leadsto x + \color{blue}{\frac{-1}{x}} \]
    4. Step-by-step derivation
      1. lower-/.f64100.0

        \[\leadsto x + \color{blue}{\frac{-1}{x}} \]
    5. Applied rewrites100.0%

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

    if 0.0 < (exp.f64 z) < 1.00000000000002

    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

      \[\leadsto x + \frac{y}{\color{blue}{\left(\frac{5641895835477563}{5000000000000000} + z \cdot \left(\frac{5641895835477563}{5000000000000000} + z \cdot \left(\frac{5641895835477563}{10000000000000000} + \frac{5641895835477563}{30000000000000000} \cdot z\right)\right)\right)} - x \cdot y} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto x + \frac{y}{\color{blue}{\left(z \cdot \left(\frac{5641895835477563}{5000000000000000} + z \cdot \left(\frac{5641895835477563}{10000000000000000} + \frac{5641895835477563}{30000000000000000} \cdot z\right)\right) + \frac{5641895835477563}{5000000000000000}\right)} - x \cdot y} \]
      2. lower-fma.f64N/A

        \[\leadsto x + \frac{y}{\color{blue}{\mathsf{fma}\left(z, \frac{5641895835477563}{5000000000000000} + z \cdot \left(\frac{5641895835477563}{10000000000000000} + \frac{5641895835477563}{30000000000000000} \cdot z\right), \frac{5641895835477563}{5000000000000000}\right)} - x \cdot y} \]
      3. +-commutativeN/A

        \[\leadsto x + \frac{y}{\mathsf{fma}\left(z, \color{blue}{z \cdot \left(\frac{5641895835477563}{10000000000000000} + \frac{5641895835477563}{30000000000000000} \cdot z\right) + \frac{5641895835477563}{5000000000000000}}, \frac{5641895835477563}{5000000000000000}\right) - x \cdot y} \]
      4. lower-fma.f64N/A

        \[\leadsto x + \frac{y}{\mathsf{fma}\left(z, \color{blue}{\mathsf{fma}\left(z, \frac{5641895835477563}{10000000000000000} + \frac{5641895835477563}{30000000000000000} \cdot z, \frac{5641895835477563}{5000000000000000}\right)}, \frac{5641895835477563}{5000000000000000}\right) - x \cdot y} \]
      5. +-commutativeN/A

        \[\leadsto x + \frac{y}{\mathsf{fma}\left(z, \mathsf{fma}\left(z, \color{blue}{\frac{5641895835477563}{30000000000000000} \cdot z + \frac{5641895835477563}{10000000000000000}}, \frac{5641895835477563}{5000000000000000}\right), \frac{5641895835477563}{5000000000000000}\right) - x \cdot y} \]
      6. *-commutativeN/A

        \[\leadsto x + \frac{y}{\mathsf{fma}\left(z, \mathsf{fma}\left(z, \color{blue}{z \cdot \frac{5641895835477563}{30000000000000000}} + \frac{5641895835477563}{10000000000000000}, \frac{5641895835477563}{5000000000000000}\right), \frac{5641895835477563}{5000000000000000}\right) - x \cdot y} \]
      7. lower-fma.f6499.8

        \[\leadsto x + \frac{y}{\mathsf{fma}\left(z, \mathsf{fma}\left(z, \color{blue}{\mathsf{fma}\left(z, 0.18806319451591877, 0.5641895835477563\right)}, 1.1283791670955126\right), 1.1283791670955126\right) - x \cdot y} \]
    5. Applied rewrites99.8%

      \[\leadsto x + \frac{y}{\color{blue}{\mathsf{fma}\left(z, \mathsf{fma}\left(z, \mathsf{fma}\left(z, 0.18806319451591877, 0.5641895835477563\right), 1.1283791670955126\right), 1.1283791670955126\right)} - x \cdot y} \]
    6. Step-by-step derivation
      1. Applied rewrites99.8%

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

      if 1.00000000000002 < (exp.f64 z)

      1. Initial program 95.5%

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

        \[\leadsto \color{blue}{x + \frac{5000000000000000}{5641895835477563} \cdot \frac{y}{e^{z}}} \]
      4. Step-by-step derivation
        1. +-commutativeN/A

          \[\leadsto \color{blue}{\frac{5000000000000000}{5641895835477563} \cdot \frac{y}{e^{z}} + x} \]
        2. *-lft-identityN/A

          \[\leadsto \frac{5000000000000000}{5641895835477563} \cdot \frac{\color{blue}{1 \cdot y}}{e^{z}} + x \]
        3. associate-*l/N/A

          \[\leadsto \frac{5000000000000000}{5641895835477563} \cdot \color{blue}{\left(\frac{1}{e^{z}} \cdot y\right)} + x \]
        4. associate-*l*N/A

          \[\leadsto \color{blue}{\left(\frac{5000000000000000}{5641895835477563} \cdot \frac{1}{e^{z}}\right) \cdot y} + x \]
        5. *-commutativeN/A

          \[\leadsto \color{blue}{\left(\frac{1}{e^{z}} \cdot \frac{5000000000000000}{5641895835477563}\right)} \cdot y + x \]
        6. associate-*l*N/A

          \[\leadsto \color{blue}{\frac{1}{e^{z}} \cdot \left(\frac{5000000000000000}{5641895835477563} \cdot y\right)} + x \]
        7. lower-fma.f64N/A

          \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{e^{z}}, \frac{5000000000000000}{5641895835477563} \cdot y, x\right)} \]
        8. rec-expN/A

          \[\leadsto \mathsf{fma}\left(\color{blue}{e^{\mathsf{neg}\left(z\right)}}, \frac{5000000000000000}{5641895835477563} \cdot y, x\right) \]
        9. neg-mul-1N/A

          \[\leadsto \mathsf{fma}\left(e^{\color{blue}{-1 \cdot z}}, \frac{5000000000000000}{5641895835477563} \cdot y, x\right) \]
        10. lower-exp.f64N/A

          \[\leadsto \mathsf{fma}\left(\color{blue}{e^{-1 \cdot z}}, \frac{5000000000000000}{5641895835477563} \cdot y, x\right) \]
        11. neg-mul-1N/A

          \[\leadsto \mathsf{fma}\left(e^{\color{blue}{\mathsf{neg}\left(z\right)}}, \frac{5000000000000000}{5641895835477563} \cdot y, x\right) \]
        12. lower-neg.f64N/A

          \[\leadsto \mathsf{fma}\left(e^{\color{blue}{\mathsf{neg}\left(z\right)}}, \frac{5000000000000000}{5641895835477563} \cdot y, x\right) \]
        13. lower-*.f64100.0

          \[\leadsto \mathsf{fma}\left(e^{-z}, \color{blue}{0.8862269254527579 \cdot y}, x\right) \]
      5. Applied rewrites100.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(e^{-z}, 0.8862269254527579 \cdot y, x\right)} \]
    7. Recombined 3 regimes into one program.
    8. Final simplification99.9%

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

    Alternative 2: 83.1% accurate, 0.3× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := x + \frac{-1}{x}\\ t_1 := x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}\\ \mathbf{if}\;t\_1 \leq -10:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;t\_1 \leq -1 \cdot 10^{-157}:\\ \;\;\;\;x + y \cdot \mathsf{fma}\left(y, x \cdot 0.7853981633974483, 0.8862269254527579\right)\\ \mathbf{elif}\;t\_1 \leq 4 \cdot 10^{-7}:\\ \;\;\;\;x + \left(y \cdot \left(x \cdot y\right)\right) \cdot 0.7853981633974483\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
    (FPCore (x y z)
     :precision binary64
     (let* ((t_0 (+ x (/ -1.0 x)))
            (t_1 (+ x (/ y (- (* 1.1283791670955126 (exp z)) (* x y))))))
       (if (<= t_1 -10.0)
         t_0
         (if (<= t_1 -1e-157)
           (+ x (* y (fma y (* x 0.7853981633974483) 0.8862269254527579)))
           (if (<= t_1 4e-7) (+ x (* (* y (* x y)) 0.7853981633974483)) t_0)))))
    double code(double x, double y, double z) {
    	double t_0 = x + (-1.0 / x);
    	double t_1 = x + (y / ((1.1283791670955126 * exp(z)) - (x * y)));
    	double tmp;
    	if (t_1 <= -10.0) {
    		tmp = t_0;
    	} else if (t_1 <= -1e-157) {
    		tmp = x + (y * fma(y, (x * 0.7853981633974483), 0.8862269254527579));
    	} else if (t_1 <= 4e-7) {
    		tmp = x + ((y * (x * y)) * 0.7853981633974483);
    	} else {
    		tmp = t_0;
    	}
    	return tmp;
    }
    
    function code(x, y, z)
    	t_0 = Float64(x + Float64(-1.0 / x))
    	t_1 = Float64(x + Float64(y / Float64(Float64(1.1283791670955126 * exp(z)) - Float64(x * y))))
    	tmp = 0.0
    	if (t_1 <= -10.0)
    		tmp = t_0;
    	elseif (t_1 <= -1e-157)
    		tmp = Float64(x + Float64(y * fma(y, Float64(x * 0.7853981633974483), 0.8862269254527579)));
    	elseif (t_1 <= 4e-7)
    		tmp = Float64(x + Float64(Float64(y * Float64(x * y)) * 0.7853981633974483));
    	else
    		tmp = t_0;
    	end
    	return tmp
    end
    
    code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x + N[(y / N[(N[(1.1283791670955126 * N[Exp[z], $MachinePrecision]), $MachinePrecision] - N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -10.0], t$95$0, If[LessEqual[t$95$1, -1e-157], N[(x + N[(y * N[(y * N[(x * 0.7853981633974483), $MachinePrecision] + 0.8862269254527579), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 4e-7], N[(x + N[(N[(y * N[(x * y), $MachinePrecision]), $MachinePrecision] * 0.7853981633974483), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := x + \frac{-1}{x}\\
    t_1 := x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y}\\
    \mathbf{if}\;t\_1 \leq -10:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;t\_1 \leq -1 \cdot 10^{-157}:\\
    \;\;\;\;x + y \cdot \mathsf{fma}\left(y, x \cdot 0.7853981633974483, 0.8862269254527579\right)\\
    
    \mathbf{elif}\;t\_1 \leq 4 \cdot 10^{-7}:\\
    \;\;\;\;x + \left(y \cdot \left(x \cdot y\right)\right) \cdot 0.7853981633974483\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_0\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if (+.f64 x (/.f64 y (-.f64 (*.f64 #s(literal 5641895835477563/5000000000000000 binary64) (exp.f64 z)) (*.f64 x y)))) < -10 or 3.9999999999999998e-7 < (+.f64 x (/.f64 y (-.f64 (*.f64 #s(literal 5641895835477563/5000000000000000 binary64) (exp.f64 z)) (*.f64 x y))))

      1. Initial program 94.0%

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

        \[\leadsto x + \color{blue}{\frac{-1}{x}} \]
      4. Step-by-step derivation
        1. lower-/.f6491.1

          \[\leadsto x + \color{blue}{\frac{-1}{x}} \]
      5. Applied rewrites91.1%

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

      if -10 < (+.f64 x (/.f64 y (-.f64 (*.f64 #s(literal 5641895835477563/5000000000000000 binary64) (exp.f64 z)) (*.f64 x y)))) < -9.99999999999999943e-158

      1. Initial program 99.9%

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

        \[\leadsto x + \color{blue}{\left(\frac{-5641895835477563}{5000000000000000} \cdot \frac{y \cdot z}{{\left(\frac{5641895835477563}{5000000000000000} - x \cdot y\right)}^{2}} + \frac{y}{\frac{5641895835477563}{5000000000000000} - x \cdot y}\right)} \]
      4. Step-by-step derivation
        1. associate-/l*N/A

          \[\leadsto x + \left(\frac{-5641895835477563}{5000000000000000} \cdot \color{blue}{\left(y \cdot \frac{z}{{\left(\frac{5641895835477563}{5000000000000000} - x \cdot y\right)}^{2}}\right)} + \frac{y}{\frac{5641895835477563}{5000000000000000} - x \cdot y}\right) \]
        2. associate-*r*N/A

          \[\leadsto x + \left(\color{blue}{\left(\frac{-5641895835477563}{5000000000000000} \cdot y\right) \cdot \frac{z}{{\left(\frac{5641895835477563}{5000000000000000} - x \cdot y\right)}^{2}}} + \frac{y}{\frac{5641895835477563}{5000000000000000} - x \cdot y}\right) \]
        3. lower-fma.f64N/A

          \[\leadsto x + \color{blue}{\mathsf{fma}\left(\frac{-5641895835477563}{5000000000000000} \cdot y, \frac{z}{{\left(\frac{5641895835477563}{5000000000000000} - x \cdot y\right)}^{2}}, \frac{y}{\frac{5641895835477563}{5000000000000000} - x \cdot y}\right)} \]
      5. Applied rewrites67.1%

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

        \[\leadsto x + y \cdot \color{blue}{\left(\frac{5000000000000000}{5641895835477563} + \left(\frac{-5000000000000000}{5641895835477563} \cdot z + y \cdot \left(\frac{-50000000000000000000000000000000}{31830988618379068626528276418969} \cdot \left(x \cdot z\right) - \frac{-25000000000000000000000000000000}{31830988618379068626528276418969} \cdot x\right)\right)\right)} \]
      7. Step-by-step derivation
        1. Applied rewrites66.3%

          \[\leadsto x + y \cdot \color{blue}{\mathsf{fma}\left(y, \mathsf{fma}\left(x, 0.7853981633974483, -1.5707963267948966 \cdot \left(z \cdot x\right)\right), \mathsf{fma}\left(z, -0.8862269254527579, 0.8862269254527579\right)\right)} \]
        2. Taylor expanded in z around 0

          \[\leadsto x + y \cdot \left(\frac{5000000000000000}{5641895835477563} + \frac{25000000000000000000000000000000}{31830988618379068626528276418969} \cdot \color{blue}{\left(x \cdot y\right)}\right) \]
        3. Step-by-step derivation
          1. Applied rewrites75.8%

            \[\leadsto x + y \cdot \mathsf{fma}\left(y, x \cdot \color{blue}{0.7853981633974483}, 0.8862269254527579\right) \]

          if -9.99999999999999943e-158 < (+.f64 x (/.f64 y (-.f64 (*.f64 #s(literal 5641895835477563/5000000000000000 binary64) (exp.f64 z)) (*.f64 x y)))) < 3.9999999999999998e-7

          1. Initial program 99.9%

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

            \[\leadsto x + \color{blue}{\left(\frac{-5641895835477563}{5000000000000000} \cdot \frac{y \cdot z}{{\left(\frac{5641895835477563}{5000000000000000} - x \cdot y\right)}^{2}} + \frac{y}{\frac{5641895835477563}{5000000000000000} - x \cdot y}\right)} \]
          4. Step-by-step derivation
            1. associate-/l*N/A

              \[\leadsto x + \left(\frac{-5641895835477563}{5000000000000000} \cdot \color{blue}{\left(y \cdot \frac{z}{{\left(\frac{5641895835477563}{5000000000000000} - x \cdot y\right)}^{2}}\right)} + \frac{y}{\frac{5641895835477563}{5000000000000000} - x \cdot y}\right) \]
            2. associate-*r*N/A

              \[\leadsto x + \left(\color{blue}{\left(\frac{-5641895835477563}{5000000000000000} \cdot y\right) \cdot \frac{z}{{\left(\frac{5641895835477563}{5000000000000000} - x \cdot y\right)}^{2}}} + \frac{y}{\frac{5641895835477563}{5000000000000000} - x \cdot y}\right) \]
            3. lower-fma.f64N/A

              \[\leadsto x + \color{blue}{\mathsf{fma}\left(\frac{-5641895835477563}{5000000000000000} \cdot y, \frac{z}{{\left(\frac{5641895835477563}{5000000000000000} - x \cdot y\right)}^{2}}, \frac{y}{\frac{5641895835477563}{5000000000000000} - x \cdot y}\right)} \]
          5. Applied rewrites47.9%

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

            \[\leadsto x + y \cdot \color{blue}{\left(\frac{5000000000000000}{5641895835477563} + \left(\frac{-5000000000000000}{5641895835477563} \cdot z + y \cdot \left(\frac{-50000000000000000000000000000000}{31830988618379068626528276418969} \cdot \left(x \cdot z\right) - \frac{-25000000000000000000000000000000}{31830988618379068626528276418969} \cdot x\right)\right)\right)} \]
          7. Step-by-step derivation
            1. Applied rewrites47.8%

              \[\leadsto x + y \cdot \color{blue}{\mathsf{fma}\left(y, \mathsf{fma}\left(x, 0.7853981633974483, -1.5707963267948966 \cdot \left(z \cdot x\right)\right), \mathsf{fma}\left(z, -0.8862269254527579, 0.8862269254527579\right)\right)} \]
            2. Taylor expanded in x around -inf

              \[\leadsto x + -1 \cdot \left(x \cdot \color{blue}{\left({y}^{2} \cdot \left(\frac{50000000000000000000000000000000}{31830988618379068626528276418969} \cdot z - \frac{25000000000000000000000000000000}{31830988618379068626528276418969}\right)\right)}\right) \]
            3. Step-by-step derivation
              1. Applied rewrites46.7%

                \[\leadsto x + \left(y \cdot \left(y \cdot x\right)\right) \cdot \left(-\mathsf{fma}\left(z, 1.5707963267948966, -0.7853981633974483\right)\right) \]
              2. Taylor expanded in z around 0

                \[\leadsto x + \left(y \cdot \left(y \cdot x\right)\right) \cdot \frac{25000000000000000000000000000000}{31830988618379068626528276418969} \]
              3. Step-by-step derivation
                1. Applied rewrites51.1%

                  \[\leadsto x + \left(y \cdot \left(y \cdot x\right)\right) \cdot 0.7853981633974483 \]
              4. Recombined 3 regimes into one program.
              5. Final simplification83.1%

                \[\leadsto \begin{array}{l} \mathbf{if}\;x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \leq -10:\\ \;\;\;\;x + \frac{-1}{x}\\ \mathbf{elif}\;x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \leq -1 \cdot 10^{-157}:\\ \;\;\;\;x + y \cdot \mathsf{fma}\left(y, x \cdot 0.7853981633974483, 0.8862269254527579\right)\\ \mathbf{elif}\;x + \frac{y}{1.1283791670955126 \cdot e^{z} - x \cdot y} \leq 4 \cdot 10^{-7}:\\ \;\;\;\;x + \left(y \cdot \left(x \cdot y\right)\right) \cdot 0.7853981633974483\\ \mathbf{else}:\\ \;\;\;\;x + \frac{-1}{x}\\ \end{array} \]
              6. 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 2024228 
              (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)))))