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

Percentage Accurate: 99.9% → 99.9%
Time: 8.2s
Alternatives: 8
Speedup: 1.3×

Specification

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

\\
1 - x \cdot \left(0.253 + x \cdot 0.12\right)
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 8 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: 99.9% accurate, 1.0× speedup?

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

\\
1 - x \cdot \left(0.253 + x \cdot 0.12\right)
\end{array}

Alternative 1: 99.9% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(\mathsf{fma}\left(x, -0.12, -0.253\right), x, 1\right) \end{array} \]
(FPCore (x) :precision binary64 (fma (fma x -0.12 -0.253) x 1.0))
double code(double x) {
	return fma(fma(x, -0.12, -0.253), x, 1.0);
}
function code(x)
	return fma(fma(x, -0.12, -0.253), x, 1.0)
end
code[x_] := N[(N[(x * -0.12 + -0.253), $MachinePrecision] * x + 1.0), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(\mathsf{fma}\left(x, -0.12, -0.253\right), x, 1\right)
\end{array}
Derivation
  1. Initial program 99.8%

    \[1 - x \cdot \left(0.253 + x \cdot 0.12\right) \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. sub-negN/A

      \[\leadsto \color{blue}{1 + \left(\mathsf{neg}\left(x \cdot \left(\frac{253}{1000} + x \cdot \frac{3}{25}\right)\right)\right)} \]
    2. +-commutativeN/A

      \[\leadsto \color{blue}{\left(\mathsf{neg}\left(x \cdot \left(\frac{253}{1000} + x \cdot \frac{3}{25}\right)\right)\right) + 1} \]
    3. *-commutativeN/A

      \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(\frac{253}{1000} + x \cdot \frac{3}{25}\right) \cdot x}\right)\right) + 1 \]
    4. distribute-lft-neg-inN/A

      \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(\frac{253}{1000} + x \cdot \frac{3}{25}\right)\right)\right) \cdot x} + 1 \]
    5. accelerator-lowering-fma.f64N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(\left(\frac{253}{1000} + x \cdot \frac{3}{25}\right)\right), x, 1\right)} \]
    6. +-commutativeN/A

      \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{\left(x \cdot \frac{3}{25} + \frac{253}{1000}\right)}\right), x, 1\right) \]
    7. distribute-neg-inN/A

      \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\mathsf{neg}\left(x \cdot \frac{3}{25}\right)\right) + \left(\mathsf{neg}\left(\frac{253}{1000}\right)\right)}, x, 1\right) \]
    8. distribute-rgt-neg-inN/A

      \[\leadsto \mathsf{fma}\left(\color{blue}{x \cdot \left(\mathsf{neg}\left(\frac{3}{25}\right)\right)} + \left(\mathsf{neg}\left(\frac{253}{1000}\right)\right), x, 1\right) \]
    9. accelerator-lowering-fma.f64N/A

      \[\leadsto \mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(x, \mathsf{neg}\left(\frac{3}{25}\right), \mathsf{neg}\left(\frac{253}{1000}\right)\right)}, x, 1\right) \]
    10. metadata-evalN/A

      \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(x, \color{blue}{\frac{-3}{25}}, \mathsf{neg}\left(\frac{253}{1000}\right)\right), x, 1\right) \]
    11. metadata-eval99.8

      \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(x, -0.12, \color{blue}{-0.253}\right), x, 1\right) \]
  4. Applied egg-rr99.8%

    \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(x, -0.12, -0.253\right), x, 1\right)} \]
  5. Add Preprocessing

Alternative 2: 98.4% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;1 - x \cdot \left(0.253 + x \cdot 0.12\right) \leq -5000:\\ \;\;\;\;-0.12 \cdot \left(x \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-0.253, x, 1\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= (- 1.0 (* x (+ 0.253 (* x 0.12)))) -5000.0)
   (* -0.12 (* x x))
   (fma -0.253 x 1.0)))
double code(double x) {
	double tmp;
	if ((1.0 - (x * (0.253 + (x * 0.12)))) <= -5000.0) {
		tmp = -0.12 * (x * x);
	} else {
		tmp = fma(-0.253, x, 1.0);
	}
	return tmp;
}
function code(x)
	tmp = 0.0
	if (Float64(1.0 - Float64(x * Float64(0.253 + Float64(x * 0.12)))) <= -5000.0)
		tmp = Float64(-0.12 * Float64(x * x));
	else
		tmp = fma(-0.253, x, 1.0);
	end
	return tmp
end
code[x_] := If[LessEqual[N[(1.0 - N[(x * N[(0.253 + N[(x * 0.12), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -5000.0], N[(-0.12 * N[(x * x), $MachinePrecision]), $MachinePrecision], N[(-0.253 * x + 1.0), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;1 - x \cdot \left(0.253 + x \cdot 0.12\right) \leq -5000:\\
\;\;\;\;-0.12 \cdot \left(x \cdot x\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.253, x, 1\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 #s(literal 1 binary64) (*.f64 x (+.f64 #s(literal 253/1000 binary64) (*.f64 x #s(literal 3/25 binary64))))) < -5e3

    1. Initial program 99.7%

      \[1 - x \cdot \left(0.253 + x \cdot 0.12\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \color{blue}{1 + \left(\mathsf{neg}\left(x \cdot \left(\frac{253}{1000} + x \cdot \frac{3}{25}\right)\right)\right)} \]
      2. +-commutativeN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(x \cdot \left(\frac{253}{1000} + x \cdot \frac{3}{25}\right)\right)\right) + 1} \]
      3. +-commutativeN/A

        \[\leadsto \left(\mathsf{neg}\left(x \cdot \color{blue}{\left(x \cdot \frac{3}{25} + \frac{253}{1000}\right)}\right)\right) + 1 \]
      4. distribute-rgt-inN/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(\left(x \cdot \frac{3}{25}\right) \cdot x + \frac{253}{1000} \cdot x\right)}\right)\right) + 1 \]
      5. *-commutativeN/A

        \[\leadsto \left(\mathsf{neg}\left(\left(\left(x \cdot \frac{3}{25}\right) \cdot x + \color{blue}{x \cdot \frac{253}{1000}}\right)\right)\right) + 1 \]
      6. distribute-neg-inN/A

        \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(\left(x \cdot \frac{3}{25}\right) \cdot x\right)\right) + \left(\mathsf{neg}\left(x \cdot \frac{253}{1000}\right)\right)\right)} + 1 \]
      7. associate-+l+N/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(x \cdot \frac{3}{25}\right) \cdot x\right)\right) + \left(\left(\mathsf{neg}\left(x \cdot \frac{253}{1000}\right)\right) + 1\right)} \]
      8. *-commutativeN/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{x \cdot \left(x \cdot \frac{3}{25}\right)}\right)\right) + \left(\left(\mathsf{neg}\left(x \cdot \frac{253}{1000}\right)\right) + 1\right) \]
      9. associate-*r*N/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(x \cdot x\right) \cdot \frac{3}{25}}\right)\right) + \left(\left(\mathsf{neg}\left(x \cdot \frac{253}{1000}\right)\right) + 1\right) \]
      10. distribute-rgt-neg-inN/A

        \[\leadsto \color{blue}{\left(x \cdot x\right) \cdot \left(\mathsf{neg}\left(\frac{3}{25}\right)\right)} + \left(\left(\mathsf{neg}\left(x \cdot \frac{253}{1000}\right)\right) + 1\right) \]
      11. accelerator-lowering-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(x \cdot x, \mathsf{neg}\left(\frac{3}{25}\right), \left(\mathsf{neg}\left(x \cdot \frac{253}{1000}\right)\right) + 1\right)} \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{x \cdot x}, \mathsf{neg}\left(\frac{3}{25}\right), \left(\mathsf{neg}\left(x \cdot \frac{253}{1000}\right)\right) + 1\right) \]
      13. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(x \cdot x, \color{blue}{\frac{-3}{25}}, \left(\mathsf{neg}\left(x \cdot \frac{253}{1000}\right)\right) + 1\right) \]
      14. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{fma}\left(x \cdot x, \frac{-3}{25}, \color{blue}{x \cdot \left(\mathsf{neg}\left(\frac{253}{1000}\right)\right)} + 1\right) \]
      15. accelerator-lowering-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(x \cdot x, \frac{-3}{25}, \color{blue}{\mathsf{fma}\left(x, \mathsf{neg}\left(\frac{253}{1000}\right), 1\right)}\right) \]
      16. metadata-eval99.7

        \[\leadsto \mathsf{fma}\left(x \cdot x, -0.12, \mathsf{fma}\left(x, \color{blue}{-0.253}, 1\right)\right) \]
    4. Applied egg-rr99.7%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x \cdot x, -0.12, \mathsf{fma}\left(x, -0.253, 1\right)\right)} \]
    5. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \color{blue}{x \cdot \left(x \cdot \frac{-3}{25}\right)} + \left(x \cdot \frac{-253}{1000} + 1\right) \]
      2. +-commutativeN/A

        \[\leadsto \color{blue}{\left(x \cdot \frac{-253}{1000} + 1\right) + x \cdot \left(x \cdot \frac{-3}{25}\right)} \]
      3. associate-+r+N/A

        \[\leadsto \color{blue}{x \cdot \frac{-253}{1000} + \left(1 + x \cdot \left(x \cdot \frac{-3}{25}\right)\right)} \]
      4. +-commutativeN/A

        \[\leadsto x \cdot \frac{-253}{1000} + \color{blue}{\left(x \cdot \left(x \cdot \frac{-3}{25}\right) + 1\right)} \]
      5. flip-+N/A

        \[\leadsto \color{blue}{\frac{\left(x \cdot \frac{-253}{1000}\right) \cdot \left(x \cdot \frac{-253}{1000}\right) - \left(x \cdot \left(x \cdot \frac{-3}{25}\right) + 1\right) \cdot \left(x \cdot \left(x \cdot \frac{-3}{25}\right) + 1\right)}{x \cdot \frac{-253}{1000} - \left(x \cdot \left(x \cdot \frac{-3}{25}\right) + 1\right)}} \]
      6. clear-numN/A

        \[\leadsto \color{blue}{\frac{1}{\frac{x \cdot \frac{-253}{1000} - \left(x \cdot \left(x \cdot \frac{-3}{25}\right) + 1\right)}{\left(x \cdot \frac{-253}{1000}\right) \cdot \left(x \cdot \frac{-253}{1000}\right) - \left(x \cdot \left(x \cdot \frac{-3}{25}\right) + 1\right) \cdot \left(x \cdot \left(x \cdot \frac{-3}{25}\right) + 1\right)}}} \]
      7. /-lowering-/.f64N/A

        \[\leadsto \color{blue}{\frac{1}{\frac{x \cdot \frac{-253}{1000} - \left(x \cdot \left(x \cdot \frac{-3}{25}\right) + 1\right)}{\left(x \cdot \frac{-253}{1000}\right) \cdot \left(x \cdot \frac{-253}{1000}\right) - \left(x \cdot \left(x \cdot \frac{-3}{25}\right) + 1\right) \cdot \left(x \cdot \left(x \cdot \frac{-3}{25}\right) + 1\right)}}} \]
      8. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{1}{\frac{\left(x \cdot \frac{-253}{1000}\right) \cdot \left(x \cdot \frac{-253}{1000}\right) - \left(x \cdot \left(x \cdot \frac{-3}{25}\right) + 1\right) \cdot \left(x \cdot \left(x \cdot \frac{-3}{25}\right) + 1\right)}{x \cdot \frac{-253}{1000} - \left(x \cdot \left(x \cdot \frac{-3}{25}\right) + 1\right)}}}} \]
      9. flip-+N/A

        \[\leadsto \frac{1}{\frac{1}{\color{blue}{x \cdot \frac{-253}{1000} + \left(x \cdot \left(x \cdot \frac{-3}{25}\right) + 1\right)}}} \]
      10. /-lowering-/.f64N/A

        \[\leadsto \frac{1}{\color{blue}{\frac{1}{x \cdot \frac{-253}{1000} + \left(x \cdot \left(x \cdot \frac{-3}{25}\right) + 1\right)}}} \]
      11. associate-+r+N/A

        \[\leadsto \frac{1}{\frac{1}{\color{blue}{\left(x \cdot \frac{-253}{1000} + x \cdot \left(x \cdot \frac{-3}{25}\right)\right) + 1}}} \]
      12. distribute-lft-inN/A

        \[\leadsto \frac{1}{\frac{1}{\color{blue}{x \cdot \left(\frac{-253}{1000} + x \cdot \frac{-3}{25}\right)} + 1}} \]
      13. +-commutativeN/A

        \[\leadsto \frac{1}{\frac{1}{x \cdot \color{blue}{\left(x \cdot \frac{-3}{25} + \frac{-253}{1000}\right)} + 1}} \]
    6. Applied egg-rr99.7%

      \[\leadsto \color{blue}{\frac{1}{\frac{1}{\mathsf{fma}\left(x, \mathsf{fma}\left(x, -0.12, -0.253\right), 1\right)}}} \]
    7. Taylor expanded in x around inf

      \[\leadsto \frac{1}{\color{blue}{\frac{\frac{-25}{3}}{{x}^{2}}}} \]
    8. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \frac{1}{\color{blue}{\frac{\frac{-25}{3}}{{x}^{2}}}} \]
      2. unpow2N/A

        \[\leadsto \frac{1}{\frac{\frac{-25}{3}}{\color{blue}{x \cdot x}}} \]
      3. *-lowering-*.f6495.8

        \[\leadsto \frac{1}{\frac{-8.333333333333334}{\color{blue}{x \cdot x}}} \]
    9. Simplified95.8%

      \[\leadsto \frac{1}{\color{blue}{\frac{-8.333333333333334}{x \cdot x}}} \]
    10. Step-by-step derivation
      1. clear-numN/A

        \[\leadsto \color{blue}{\frac{x \cdot x}{\frac{-25}{3}}} \]
      2. div-invN/A

        \[\leadsto \color{blue}{\left(x \cdot x\right) \cdot \frac{1}{\frac{-25}{3}}} \]
      3. metadata-evalN/A

        \[\leadsto \left(x \cdot x\right) \cdot \color{blue}{\frac{-3}{25}} \]
      4. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\left(x \cdot x\right) \cdot \frac{-3}{25}} \]
      5. *-lowering-*.f6495.8

        \[\leadsto \color{blue}{\left(x \cdot x\right)} \cdot -0.12 \]
    11. Applied egg-rr95.8%

      \[\leadsto \color{blue}{\left(x \cdot x\right) \cdot -0.12} \]

    if -5e3 < (-.f64 #s(literal 1 binary64) (*.f64 x (+.f64 #s(literal 253/1000 binary64) (*.f64 x #s(literal 3/25 binary64)))))

    1. Initial program 100.0%

      \[1 - x \cdot \left(0.253 + x \cdot 0.12\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{1 + \frac{-253}{1000} \cdot x} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{-253}{1000} \cdot x + 1} \]
      2. accelerator-lowering-fma.f6499.0

        \[\leadsto \color{blue}{\mathsf{fma}\left(-0.253, x, 1\right)} \]
    5. Simplified99.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(-0.253, x, 1\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification97.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;1 - x \cdot \left(0.253 + x \cdot 0.12\right) \leq -5000:\\ \;\;\;\;-0.12 \cdot \left(x \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-0.253, x, 1\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 98.4% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;1 - x \cdot \left(0.253 + x \cdot 0.12\right) \leq -5000:\\ \;\;\;\;x \cdot \left(x \cdot -0.12\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-0.253, x, 1\right)\\ \end{array} \end{array} \]
(FPCore (x)
 :precision binary64
 (if (<= (- 1.0 (* x (+ 0.253 (* x 0.12)))) -5000.0)
   (* x (* x -0.12))
   (fma -0.253 x 1.0)))
double code(double x) {
	double tmp;
	if ((1.0 - (x * (0.253 + (x * 0.12)))) <= -5000.0) {
		tmp = x * (x * -0.12);
	} else {
		tmp = fma(-0.253, x, 1.0);
	}
	return tmp;
}
function code(x)
	tmp = 0.0
	if (Float64(1.0 - Float64(x * Float64(0.253 + Float64(x * 0.12)))) <= -5000.0)
		tmp = Float64(x * Float64(x * -0.12));
	else
		tmp = fma(-0.253, x, 1.0);
	end
	return tmp
end
code[x_] := If[LessEqual[N[(1.0 - N[(x * N[(0.253 + N[(x * 0.12), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -5000.0], N[(x * N[(x * -0.12), $MachinePrecision]), $MachinePrecision], N[(-0.253 * x + 1.0), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;1 - x \cdot \left(0.253 + x \cdot 0.12\right) \leq -5000:\\
\;\;\;\;x \cdot \left(x \cdot -0.12\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.253, x, 1\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 #s(literal 1 binary64) (*.f64 x (+.f64 #s(literal 253/1000 binary64) (*.f64 x #s(literal 3/25 binary64))))) < -5e3

    1. Initial program 99.7%

      \[1 - x \cdot \left(0.253 + x \cdot 0.12\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \color{blue}{1 + \left(\mathsf{neg}\left(x \cdot \left(\frac{253}{1000} + x \cdot \frac{3}{25}\right)\right)\right)} \]
      2. +-commutativeN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(x \cdot \left(\frac{253}{1000} + x \cdot \frac{3}{25}\right)\right)\right) + 1} \]
      3. +-commutativeN/A

        \[\leadsto \left(\mathsf{neg}\left(x \cdot \color{blue}{\left(x \cdot \frac{3}{25} + \frac{253}{1000}\right)}\right)\right) + 1 \]
      4. distribute-rgt-inN/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(\left(x \cdot \frac{3}{25}\right) \cdot x + \frac{253}{1000} \cdot x\right)}\right)\right) + 1 \]
      5. *-commutativeN/A

        \[\leadsto \left(\mathsf{neg}\left(\left(\left(x \cdot \frac{3}{25}\right) \cdot x + \color{blue}{x \cdot \frac{253}{1000}}\right)\right)\right) + 1 \]
      6. distribute-neg-inN/A

        \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(\left(x \cdot \frac{3}{25}\right) \cdot x\right)\right) + \left(\mathsf{neg}\left(x \cdot \frac{253}{1000}\right)\right)\right)} + 1 \]
      7. associate-+l+N/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(x \cdot \frac{3}{25}\right) \cdot x\right)\right) + \left(\left(\mathsf{neg}\left(x \cdot \frac{253}{1000}\right)\right) + 1\right)} \]
      8. *-commutativeN/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{x \cdot \left(x \cdot \frac{3}{25}\right)}\right)\right) + \left(\left(\mathsf{neg}\left(x \cdot \frac{253}{1000}\right)\right) + 1\right) \]
      9. associate-*r*N/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(x \cdot x\right) \cdot \frac{3}{25}}\right)\right) + \left(\left(\mathsf{neg}\left(x \cdot \frac{253}{1000}\right)\right) + 1\right) \]
      10. distribute-rgt-neg-inN/A

        \[\leadsto \color{blue}{\left(x \cdot x\right) \cdot \left(\mathsf{neg}\left(\frac{3}{25}\right)\right)} + \left(\left(\mathsf{neg}\left(x \cdot \frac{253}{1000}\right)\right) + 1\right) \]
      11. accelerator-lowering-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(x \cdot x, \mathsf{neg}\left(\frac{3}{25}\right), \left(\mathsf{neg}\left(x \cdot \frac{253}{1000}\right)\right) + 1\right)} \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{x \cdot x}, \mathsf{neg}\left(\frac{3}{25}\right), \left(\mathsf{neg}\left(x \cdot \frac{253}{1000}\right)\right) + 1\right) \]
      13. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(x \cdot x, \color{blue}{\frac{-3}{25}}, \left(\mathsf{neg}\left(x \cdot \frac{253}{1000}\right)\right) + 1\right) \]
      14. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{fma}\left(x \cdot x, \frac{-3}{25}, \color{blue}{x \cdot \left(\mathsf{neg}\left(\frac{253}{1000}\right)\right)} + 1\right) \]
      15. accelerator-lowering-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(x \cdot x, \frac{-3}{25}, \color{blue}{\mathsf{fma}\left(x, \mathsf{neg}\left(\frac{253}{1000}\right), 1\right)}\right) \]
      16. metadata-eval99.7

        \[\leadsto \mathsf{fma}\left(x \cdot x, -0.12, \mathsf{fma}\left(x, \color{blue}{-0.253}, 1\right)\right) \]
    4. Applied egg-rr99.7%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x \cdot x, -0.12, \mathsf{fma}\left(x, -0.253, 1\right)\right)} \]
    5. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \color{blue}{x \cdot \left(x \cdot \frac{-3}{25}\right)} + \left(x \cdot \frac{-253}{1000} + 1\right) \]
      2. +-commutativeN/A

        \[\leadsto \color{blue}{\left(x \cdot \frac{-253}{1000} + 1\right) + x \cdot \left(x \cdot \frac{-3}{25}\right)} \]
      3. associate-+r+N/A

        \[\leadsto \color{blue}{x \cdot \frac{-253}{1000} + \left(1 + x \cdot \left(x \cdot \frac{-3}{25}\right)\right)} \]
      4. +-commutativeN/A

        \[\leadsto x \cdot \frac{-253}{1000} + \color{blue}{\left(x \cdot \left(x \cdot \frac{-3}{25}\right) + 1\right)} \]
      5. flip-+N/A

        \[\leadsto \color{blue}{\frac{\left(x \cdot \frac{-253}{1000}\right) \cdot \left(x \cdot \frac{-253}{1000}\right) - \left(x \cdot \left(x \cdot \frac{-3}{25}\right) + 1\right) \cdot \left(x \cdot \left(x \cdot \frac{-3}{25}\right) + 1\right)}{x \cdot \frac{-253}{1000} - \left(x \cdot \left(x \cdot \frac{-3}{25}\right) + 1\right)}} \]
      6. clear-numN/A

        \[\leadsto \color{blue}{\frac{1}{\frac{x \cdot \frac{-253}{1000} - \left(x \cdot \left(x \cdot \frac{-3}{25}\right) + 1\right)}{\left(x \cdot \frac{-253}{1000}\right) \cdot \left(x \cdot \frac{-253}{1000}\right) - \left(x \cdot \left(x \cdot \frac{-3}{25}\right) + 1\right) \cdot \left(x \cdot \left(x \cdot \frac{-3}{25}\right) + 1\right)}}} \]
      7. /-lowering-/.f64N/A

        \[\leadsto \color{blue}{\frac{1}{\frac{x \cdot \frac{-253}{1000} - \left(x \cdot \left(x \cdot \frac{-3}{25}\right) + 1\right)}{\left(x \cdot \frac{-253}{1000}\right) \cdot \left(x \cdot \frac{-253}{1000}\right) - \left(x \cdot \left(x \cdot \frac{-3}{25}\right) + 1\right) \cdot \left(x \cdot \left(x \cdot \frac{-3}{25}\right) + 1\right)}}} \]
      8. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{1}{\frac{\left(x \cdot \frac{-253}{1000}\right) \cdot \left(x \cdot \frac{-253}{1000}\right) - \left(x \cdot \left(x \cdot \frac{-3}{25}\right) + 1\right) \cdot \left(x \cdot \left(x \cdot \frac{-3}{25}\right) + 1\right)}{x \cdot \frac{-253}{1000} - \left(x \cdot \left(x \cdot \frac{-3}{25}\right) + 1\right)}}}} \]
      9. flip-+N/A

        \[\leadsto \frac{1}{\frac{1}{\color{blue}{x \cdot \frac{-253}{1000} + \left(x \cdot \left(x \cdot \frac{-3}{25}\right) + 1\right)}}} \]
      10. /-lowering-/.f64N/A

        \[\leadsto \frac{1}{\color{blue}{\frac{1}{x \cdot \frac{-253}{1000} + \left(x \cdot \left(x \cdot \frac{-3}{25}\right) + 1\right)}}} \]
      11. associate-+r+N/A

        \[\leadsto \frac{1}{\frac{1}{\color{blue}{\left(x \cdot \frac{-253}{1000} + x \cdot \left(x \cdot \frac{-3}{25}\right)\right) + 1}}} \]
      12. distribute-lft-inN/A

        \[\leadsto \frac{1}{\frac{1}{\color{blue}{x \cdot \left(\frac{-253}{1000} + x \cdot \frac{-3}{25}\right)} + 1}} \]
      13. +-commutativeN/A

        \[\leadsto \frac{1}{\frac{1}{x \cdot \color{blue}{\left(x \cdot \frac{-3}{25} + \frac{-253}{1000}\right)} + 1}} \]
    6. Applied egg-rr99.7%

      \[\leadsto \color{blue}{\frac{1}{\frac{1}{\mathsf{fma}\left(x, \mathsf{fma}\left(x, -0.12, -0.253\right), 1\right)}}} \]
    7. Taylor expanded in x around inf

      \[\leadsto \frac{1}{\color{blue}{\frac{\frac{-25}{3}}{{x}^{2}}}} \]
    8. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto \frac{1}{\color{blue}{\frac{\frac{-25}{3}}{{x}^{2}}}} \]
      2. unpow2N/A

        \[\leadsto \frac{1}{\frac{\frac{-25}{3}}{\color{blue}{x \cdot x}}} \]
      3. *-lowering-*.f6495.8

        \[\leadsto \frac{1}{\frac{-8.333333333333334}{\color{blue}{x \cdot x}}} \]
    9. Simplified95.8%

      \[\leadsto \frac{1}{\color{blue}{\frac{-8.333333333333334}{x \cdot x}}} \]
    10. Step-by-step derivation
      1. associate-/r/N/A

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

        \[\leadsto \color{blue}{\frac{-3}{25}} \cdot \left(x \cdot x\right) \]
      3. associate-*r*N/A

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

        \[\leadsto \color{blue}{\left(x \cdot \frac{-3}{25}\right)} \cdot x \]
      5. *-lowering-*.f64N/A

        \[\leadsto \color{blue}{\left(x \cdot \frac{-3}{25}\right) \cdot x} \]
      6. *-lowering-*.f6495.8

        \[\leadsto \color{blue}{\left(x \cdot -0.12\right)} \cdot x \]
    11. Applied egg-rr95.8%

      \[\leadsto \color{blue}{\left(x \cdot -0.12\right) \cdot x} \]

    if -5e3 < (-.f64 #s(literal 1 binary64) (*.f64 x (+.f64 #s(literal 253/1000 binary64) (*.f64 x #s(literal 3/25 binary64)))))

    1. Initial program 100.0%

      \[1 - x \cdot \left(0.253 + x \cdot 0.12\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{1 + \frac{-253}{1000} \cdot x} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{-253}{1000} \cdot x + 1} \]
      2. accelerator-lowering-fma.f6499.0

        \[\leadsto \color{blue}{\mathsf{fma}\left(-0.253, x, 1\right)} \]
    5. Simplified99.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(-0.253, x, 1\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification97.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;1 - x \cdot \left(0.253 + x \cdot 0.12\right) \leq -5000:\\ \;\;\;\;x \cdot \left(x \cdot -0.12\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-0.253, x, 1\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 50.5% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq 2:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;x \cdot -0.253\\ \end{array} \end{array} \]
(FPCore (x) :precision binary64 (if (<= x 2.0) 1.0 (* x -0.253)))
double code(double x) {
	double tmp;
	if (x <= 2.0) {
		tmp = 1.0;
	} else {
		tmp = x * -0.253;
	}
	return tmp;
}
real(8) function code(x)
    real(8), intent (in) :: x
    real(8) :: tmp
    if (x <= 2.0d0) then
        tmp = 1.0d0
    else
        tmp = x * (-0.253d0)
    end if
    code = tmp
end function
public static double code(double x) {
	double tmp;
	if (x <= 2.0) {
		tmp = 1.0;
	} else {
		tmp = x * -0.253;
	}
	return tmp;
}
def code(x):
	tmp = 0
	if x <= 2.0:
		tmp = 1.0
	else:
		tmp = x * -0.253
	return tmp
function code(x)
	tmp = 0.0
	if (x <= 2.0)
		tmp = 1.0;
	else
		tmp = Float64(x * -0.253);
	end
	return tmp
end
function tmp_2 = code(x)
	tmp = 0.0;
	if (x <= 2.0)
		tmp = 1.0;
	else
		tmp = x * -0.253;
	end
	tmp_2 = tmp;
end
code[x_] := If[LessEqual[x, 2.0], 1.0, N[(x * -0.253), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq 2:\\
\;\;\;\;1\\

\mathbf{else}:\\
\;\;\;\;x \cdot -0.253\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 2

    1. Initial program 99.9%

      \[1 - x \cdot \left(0.253 + x \cdot 0.12\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{1} \]
    4. Step-by-step derivation
      1. Simplified58.9%

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

      if 2 < x

      1. Initial program 99.7%

        \[1 - x \cdot \left(0.253 + x \cdot 0.12\right) \]
      2. Add Preprocessing
      3. Taylor expanded in x around 0

        \[\leadsto \color{blue}{1 + \frac{-253}{1000} \cdot x} \]
      4. Step-by-step derivation
        1. +-commutativeN/A

          \[\leadsto \color{blue}{\frac{-253}{1000} \cdot x + 1} \]
        2. accelerator-lowering-fma.f647.3

          \[\leadsto \color{blue}{\mathsf{fma}\left(-0.253, x, 1\right)} \]
      5. Simplified7.3%

        \[\leadsto \color{blue}{\mathsf{fma}\left(-0.253, x, 1\right)} \]
      6. Taylor expanded in x around inf

        \[\leadsto \color{blue}{\frac{-253}{1000} \cdot x} \]
      7. Step-by-step derivation
        1. +-rgt-identityN/A

          \[\leadsto \color{blue}{\frac{-253}{1000} \cdot x + 0} \]
        2. accelerator-lowering-fma.f647.3

          \[\leadsto \color{blue}{\mathsf{fma}\left(-0.253, x, 0\right)} \]
      8. Simplified7.3%

        \[\leadsto \color{blue}{\mathsf{fma}\left(-0.253, x, 0\right)} \]
      9. Step-by-step derivation
        1. +-rgt-identityN/A

          \[\leadsto \color{blue}{\frac{-253}{1000} \cdot x} \]
        2. *-commutativeN/A

          \[\leadsto \color{blue}{x \cdot \frac{-253}{1000}} \]
        3. *-lowering-*.f647.3

          \[\leadsto \color{blue}{x \cdot -0.253} \]
      10. Applied egg-rr7.3%

        \[\leadsto \color{blue}{x \cdot -0.253} \]
    5. Recombined 2 regimes into one program.
    6. Add Preprocessing

    Alternative 5: 97.9% accurate, 1.4× speedup?

    \[\begin{array}{l} \\ \mathsf{fma}\left(x \cdot x, -0.12, 1\right) \end{array} \]
    (FPCore (x) :precision binary64 (fma (* x x) -0.12 1.0))
    double code(double x) {
    	return fma((x * x), -0.12, 1.0);
    }
    
    function code(x)
    	return fma(Float64(x * x), -0.12, 1.0)
    end
    
    code[x_] := N[(N[(x * x), $MachinePrecision] * -0.12 + 1.0), $MachinePrecision]
    
    \begin{array}{l}
    
    \\
    \mathsf{fma}\left(x \cdot x, -0.12, 1\right)
    \end{array}
    
    Derivation
    1. Initial program 99.8%

      \[1 - x \cdot \left(0.253 + x \cdot 0.12\right) \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \color{blue}{1 + \left(\mathsf{neg}\left(x \cdot \left(\frac{253}{1000} + x \cdot \frac{3}{25}\right)\right)\right)} \]
      2. +-commutativeN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(x \cdot \left(\frac{253}{1000} + x \cdot \frac{3}{25}\right)\right)\right) + 1} \]
      3. +-commutativeN/A

        \[\leadsto \left(\mathsf{neg}\left(x \cdot \color{blue}{\left(x \cdot \frac{3}{25} + \frac{253}{1000}\right)}\right)\right) + 1 \]
      4. distribute-rgt-inN/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(\left(x \cdot \frac{3}{25}\right) \cdot x + \frac{253}{1000} \cdot x\right)}\right)\right) + 1 \]
      5. *-commutativeN/A

        \[\leadsto \left(\mathsf{neg}\left(\left(\left(x \cdot \frac{3}{25}\right) \cdot x + \color{blue}{x \cdot \frac{253}{1000}}\right)\right)\right) + 1 \]
      6. distribute-neg-inN/A

        \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(\left(x \cdot \frac{3}{25}\right) \cdot x\right)\right) + \left(\mathsf{neg}\left(x \cdot \frac{253}{1000}\right)\right)\right)} + 1 \]
      7. associate-+l+N/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(x \cdot \frac{3}{25}\right) \cdot x\right)\right) + \left(\left(\mathsf{neg}\left(x \cdot \frac{253}{1000}\right)\right) + 1\right)} \]
      8. *-commutativeN/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{x \cdot \left(x \cdot \frac{3}{25}\right)}\right)\right) + \left(\left(\mathsf{neg}\left(x \cdot \frac{253}{1000}\right)\right) + 1\right) \]
      9. associate-*r*N/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(x \cdot x\right) \cdot \frac{3}{25}}\right)\right) + \left(\left(\mathsf{neg}\left(x \cdot \frac{253}{1000}\right)\right) + 1\right) \]
      10. distribute-rgt-neg-inN/A

        \[\leadsto \color{blue}{\left(x \cdot x\right) \cdot \left(\mathsf{neg}\left(\frac{3}{25}\right)\right)} + \left(\left(\mathsf{neg}\left(x \cdot \frac{253}{1000}\right)\right) + 1\right) \]
      11. accelerator-lowering-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(x \cdot x, \mathsf{neg}\left(\frac{3}{25}\right), \left(\mathsf{neg}\left(x \cdot \frac{253}{1000}\right)\right) + 1\right)} \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{x \cdot x}, \mathsf{neg}\left(\frac{3}{25}\right), \left(\mathsf{neg}\left(x \cdot \frac{253}{1000}\right)\right) + 1\right) \]
      13. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(x \cdot x, \color{blue}{\frac{-3}{25}}, \left(\mathsf{neg}\left(x \cdot \frac{253}{1000}\right)\right) + 1\right) \]
      14. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{fma}\left(x \cdot x, \frac{-3}{25}, \color{blue}{x \cdot \left(\mathsf{neg}\left(\frac{253}{1000}\right)\right)} + 1\right) \]
      15. accelerator-lowering-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(x \cdot x, \frac{-3}{25}, \color{blue}{\mathsf{fma}\left(x, \mathsf{neg}\left(\frac{253}{1000}\right), 1\right)}\right) \]
      16. metadata-eval99.8

        \[\leadsto \mathsf{fma}\left(x \cdot x, -0.12, \mathsf{fma}\left(x, \color{blue}{-0.253}, 1\right)\right) \]
    4. Applied egg-rr99.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(x \cdot x, -0.12, \mathsf{fma}\left(x, -0.253, 1\right)\right)} \]
    5. Taylor expanded in x around 0

      \[\leadsto \mathsf{fma}\left(x \cdot x, \frac{-3}{25}, \color{blue}{1}\right) \]
    6. Step-by-step derivation
      1. Simplified96.7%

        \[\leadsto \mathsf{fma}\left(x \cdot x, -0.12, \color{blue}{1}\right) \]
      2. Add Preprocessing

      Alternative 6: 97.9% accurate, 1.4× speedup?

      \[\begin{array}{l} \\ \mathsf{fma}\left(x \cdot -0.12, x, 1\right) \end{array} \]
      (FPCore (x) :precision binary64 (fma (* x -0.12) x 1.0))
      double code(double x) {
      	return fma((x * -0.12), x, 1.0);
      }
      
      function code(x)
      	return fma(Float64(x * -0.12), x, 1.0)
      end
      
      code[x_] := N[(N[(x * -0.12), $MachinePrecision] * x + 1.0), $MachinePrecision]
      
      \begin{array}{l}
      
      \\
      \mathsf{fma}\left(x \cdot -0.12, x, 1\right)
      \end{array}
      
      Derivation
      1. Initial program 99.8%

        \[1 - x \cdot \left(0.253 + x \cdot 0.12\right) \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. sub-negN/A

          \[\leadsto \color{blue}{1 + \left(\mathsf{neg}\left(x \cdot \left(\frac{253}{1000} + x \cdot \frac{3}{25}\right)\right)\right)} \]
        2. +-commutativeN/A

          \[\leadsto \color{blue}{\left(\mathsf{neg}\left(x \cdot \left(\frac{253}{1000} + x \cdot \frac{3}{25}\right)\right)\right) + 1} \]
        3. +-commutativeN/A

          \[\leadsto \left(\mathsf{neg}\left(x \cdot \color{blue}{\left(x \cdot \frac{3}{25} + \frac{253}{1000}\right)}\right)\right) + 1 \]
        4. distribute-rgt-inN/A

          \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(\left(x \cdot \frac{3}{25}\right) \cdot x + \frac{253}{1000} \cdot x\right)}\right)\right) + 1 \]
        5. *-commutativeN/A

          \[\leadsto \left(\mathsf{neg}\left(\left(\left(x \cdot \frac{3}{25}\right) \cdot x + \color{blue}{x \cdot \frac{253}{1000}}\right)\right)\right) + 1 \]
        6. distribute-neg-inN/A

          \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(\left(x \cdot \frac{3}{25}\right) \cdot x\right)\right) + \left(\mathsf{neg}\left(x \cdot \frac{253}{1000}\right)\right)\right)} + 1 \]
        7. associate-+l+N/A

          \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(x \cdot \frac{3}{25}\right) \cdot x\right)\right) + \left(\left(\mathsf{neg}\left(x \cdot \frac{253}{1000}\right)\right) + 1\right)} \]
        8. *-commutativeN/A

          \[\leadsto \left(\mathsf{neg}\left(\color{blue}{x \cdot \left(x \cdot \frac{3}{25}\right)}\right)\right) + \left(\left(\mathsf{neg}\left(x \cdot \frac{253}{1000}\right)\right) + 1\right) \]
        9. associate-*r*N/A

          \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(x \cdot x\right) \cdot \frac{3}{25}}\right)\right) + \left(\left(\mathsf{neg}\left(x \cdot \frac{253}{1000}\right)\right) + 1\right) \]
        10. distribute-rgt-neg-inN/A

          \[\leadsto \color{blue}{\left(x \cdot x\right) \cdot \left(\mathsf{neg}\left(\frac{3}{25}\right)\right)} + \left(\left(\mathsf{neg}\left(x \cdot \frac{253}{1000}\right)\right) + 1\right) \]
        11. accelerator-lowering-fma.f64N/A

          \[\leadsto \color{blue}{\mathsf{fma}\left(x \cdot x, \mathsf{neg}\left(\frac{3}{25}\right), \left(\mathsf{neg}\left(x \cdot \frac{253}{1000}\right)\right) + 1\right)} \]
        12. *-lowering-*.f64N/A

          \[\leadsto \mathsf{fma}\left(\color{blue}{x \cdot x}, \mathsf{neg}\left(\frac{3}{25}\right), \left(\mathsf{neg}\left(x \cdot \frac{253}{1000}\right)\right) + 1\right) \]
        13. metadata-evalN/A

          \[\leadsto \mathsf{fma}\left(x \cdot x, \color{blue}{\frac{-3}{25}}, \left(\mathsf{neg}\left(x \cdot \frac{253}{1000}\right)\right) + 1\right) \]
        14. distribute-rgt-neg-inN/A

          \[\leadsto \mathsf{fma}\left(x \cdot x, \frac{-3}{25}, \color{blue}{x \cdot \left(\mathsf{neg}\left(\frac{253}{1000}\right)\right)} + 1\right) \]
        15. accelerator-lowering-fma.f64N/A

          \[\leadsto \mathsf{fma}\left(x \cdot x, \frac{-3}{25}, \color{blue}{\mathsf{fma}\left(x, \mathsf{neg}\left(\frac{253}{1000}\right), 1\right)}\right) \]
        16. metadata-eval99.8

          \[\leadsto \mathsf{fma}\left(x \cdot x, -0.12, \mathsf{fma}\left(x, \color{blue}{-0.253}, 1\right)\right) \]
      4. Applied egg-rr99.8%

        \[\leadsto \color{blue}{\mathsf{fma}\left(x \cdot x, -0.12, \mathsf{fma}\left(x, -0.253, 1\right)\right)} \]
      5. Taylor expanded in x around 0

        \[\leadsto \mathsf{fma}\left(x \cdot x, \frac{-3}{25}, \color{blue}{1}\right) \]
      6. Step-by-step derivation
        1. Simplified96.7%

          \[\leadsto \mathsf{fma}\left(x \cdot x, -0.12, \color{blue}{1}\right) \]
        2. Step-by-step derivation
          1. associate-*l*N/A

            \[\leadsto \color{blue}{x \cdot \left(x \cdot \frac{-3}{25}\right)} + 1 \]
          2. *-commutativeN/A

            \[\leadsto \color{blue}{\left(x \cdot \frac{-3}{25}\right) \cdot x} + 1 \]
          3. accelerator-lowering-fma.f64N/A

            \[\leadsto \color{blue}{\mathsf{fma}\left(x \cdot \frac{-3}{25}, x, 1\right)} \]
          4. *-lowering-*.f6496.7

            \[\leadsto \mathsf{fma}\left(\color{blue}{x \cdot -0.12}, x, 1\right) \]
        3. Applied egg-rr96.7%

          \[\leadsto \color{blue}{\mathsf{fma}\left(x \cdot -0.12, x, 1\right)} \]
        4. Add Preprocessing

        Alternative 7: 51.0% accurate, 2.4× speedup?

        \[\begin{array}{l} \\ \mathsf{fma}\left(-0.253, x, 1\right) \end{array} \]
        (FPCore (x) :precision binary64 (fma -0.253 x 1.0))
        double code(double x) {
        	return fma(-0.253, x, 1.0);
        }
        
        function code(x)
        	return fma(-0.253, x, 1.0)
        end
        
        code[x_] := N[(-0.253 * x + 1.0), $MachinePrecision]
        
        \begin{array}{l}
        
        \\
        \mathsf{fma}\left(-0.253, x, 1\right)
        \end{array}
        
        Derivation
        1. Initial program 99.8%

          \[1 - x \cdot \left(0.253 + x \cdot 0.12\right) \]
        2. Add Preprocessing
        3. Taylor expanded in x around 0

          \[\leadsto \color{blue}{1 + \frac{-253}{1000} \cdot x} \]
        4. Step-by-step derivation
          1. +-commutativeN/A

            \[\leadsto \color{blue}{\frac{-253}{1000} \cdot x + 1} \]
          2. accelerator-lowering-fma.f6444.8

            \[\leadsto \color{blue}{\mathsf{fma}\left(-0.253, x, 1\right)} \]
        5. Simplified44.8%

          \[\leadsto \color{blue}{\mathsf{fma}\left(-0.253, x, 1\right)} \]
        6. Add Preprocessing

        Alternative 8: 49.0% accurate, 17.0× speedup?

        \[\begin{array}{l} \\ 1 \end{array} \]
        (FPCore (x) :precision binary64 1.0)
        double code(double x) {
        	return 1.0;
        }
        
        real(8) function code(x)
            real(8), intent (in) :: x
            code = 1.0d0
        end function
        
        public static double code(double x) {
        	return 1.0;
        }
        
        def code(x):
        	return 1.0
        
        function code(x)
        	return 1.0
        end
        
        function tmp = code(x)
        	tmp = 1.0;
        end
        
        code[x_] := 1.0
        
        \begin{array}{l}
        
        \\
        1
        \end{array}
        
        Derivation
        1. Initial program 99.8%

          \[1 - x \cdot \left(0.253 + x \cdot 0.12\right) \]
        2. Add Preprocessing
        3. Taylor expanded in x around 0

          \[\leadsto \color{blue}{1} \]
        4. Step-by-step derivation
          1. Simplified42.6%

            \[\leadsto \color{blue}{1} \]
          2. Add Preprocessing

          Reproduce

          ?
          herbie shell --seed 2024195 
          (FPCore (x)
            :name "Numeric.SpecFunctions:invIncompleteGamma from math-functions-0.1.5.2, A"
            :precision binary64
            (- 1.0 (* x (+ 0.253 (* x 0.12)))))