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

Percentage Accurate: 99.9% → 99.8%
Time: 7.6s
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.8% accurate, 0.9× speedup?

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

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

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

      \[\leadsto \color{blue}{1 - x \cdot \left(\frac{253}{1000} + x \cdot \frac{3}{25}\right)} \]
    2. 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)} \]
    3. +-commutativeN/A

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

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

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

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

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

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

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

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

      \[\leadsto \left(\mathsf{neg}\left(x \cdot \color{blue}{\left(x \cdot \frac{3}{25}\right)}\right)\right) + \left(\left(\mathsf{neg}\left(\frac{253}{1000} \cdot x\right)\right) + 1\right) \]
    12. 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(\frac{253}{1000} \cdot x\right)\right) + 1\right) \]
    13. 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(\frac{253}{1000} \cdot x\right)\right) + 1\right) \]
    14. lower-fma.f64N/A

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

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

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

      \[\leadsto \mathsf{fma}\left(x \cdot x, \frac{-3}{25}, \left(\mathsf{neg}\left(\color{blue}{x \cdot \frac{253}{1000}}\right)\right) + 1\right) \]
    18. 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) \]
    19. lower-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) \]
    20. metadata-eval99.9

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

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

Alternative 2: 98.8% accurate, 0.5× speedup?

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

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

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


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

    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. lower-fma.f6498.7

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

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

    if 0.5 < (*.f64 x (+.f64 #s(literal 253/1000 binary64) (*.f64 x #s(literal 3/25 binary64))))

    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 inf

      \[\leadsto \color{blue}{-1 \cdot \left({x}^{2} \cdot \left(\frac{3}{25} + \frac{253}{1000} \cdot \frac{1}{x}\right)\right)} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \left(\color{blue}{x \cdot \frac{-3}{25}} + \frac{-253}{1000}\right) \]
      18. lower-fma.f6498.6

        \[\leadsto x \cdot \color{blue}{\mathsf{fma}\left(x, -0.12, -0.253\right)} \]
    5. Applied rewrites98.6%

      \[\leadsto \color{blue}{x \cdot \mathsf{fma}\left(x, -0.12, -0.253\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 3: 98.1% accurate, 0.6× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\left(x \cdot x\right) \cdot -0.12\\


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

    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. lower-fma.f6498.7

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

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

    if 0.5 < (*.f64 x (+.f64 #s(literal 253/1000 binary64) (*.f64 x #s(literal 3/25 binary64))))

    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. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 1 - x \cdot \frac{\mathsf{fma}\left(x, x \cdot \frac{9}{625}, \color{blue}{\frac{-64009}{1000000}}\right)}{x \cdot \frac{3}{25} - \frac{253}{1000}} \]
      17. sub-negN/A

        \[\leadsto 1 - x \cdot \frac{\mathsf{fma}\left(x, x \cdot \frac{9}{625}, \frac{-64009}{1000000}\right)}{\color{blue}{x \cdot \frac{3}{25} + \left(\mathsf{neg}\left(\frac{253}{1000}\right)\right)}} \]
      18. lift-*.f64N/A

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

        \[\leadsto 1 - x \cdot \frac{\mathsf{fma}\left(x, x \cdot \frac{9}{625}, \frac{-64009}{1000000}\right)}{\color{blue}{\mathsf{fma}\left(x, \frac{3}{25}, \mathsf{neg}\left(\frac{253}{1000}\right)\right)}} \]
      20. metadata-eval99.6

        \[\leadsto 1 - x \cdot \frac{\mathsf{fma}\left(x, x \cdot 0.0144, -0.064009\right)}{\mathsf{fma}\left(x, 0.12, \color{blue}{-0.253}\right)} \]
    4. Applied rewrites99.6%

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

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

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

        \[\leadsto \frac{-3}{25} \cdot \color{blue}{\left(x \cdot x\right)} \]
      3. lower-*.f6497.9

        \[\leadsto -0.12 \cdot \color{blue}{\left(x \cdot x\right)} \]
    7. Applied rewrites97.9%

      \[\leadsto \color{blue}{-0.12 \cdot \left(x \cdot x\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification98.3%

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

Alternative 4: 98.2% accurate, 0.6× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;x \cdot \left(x \cdot -0.12\right)\\


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

    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. lower-fma.f6498.7

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

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

    if 0.5 < (*.f64 x (+.f64 #s(literal 253/1000 binary64) (*.f64 x #s(literal 3/25 binary64))))

    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 inf

      \[\leadsto \color{blue}{\frac{-3}{25} \cdot {x}^{2}} \]
    4. Step-by-step derivation
      1. unpow2N/A

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

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

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

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

        \[\leadsto x \cdot \color{blue}{\left(x \cdot \frac{-3}{25}\right)} \]
      6. lower-*.f6497.9

        \[\leadsto x \cdot \color{blue}{\left(x \cdot -0.12\right)} \]
    5. Applied rewrites97.9%

      \[\leadsto \color{blue}{x \cdot \left(x \cdot -0.12\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 5: 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.9%

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

      \[\leadsto \color{blue}{1 - x \cdot \left(\frac{253}{1000} + x \cdot \frac{3}{25}\right)} \]
    2. 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)} \]
    3. +-commutativeN/A

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

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

      \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\left(\frac{253}{1000} + x \cdot \frac{3}{25}\right) \cdot x}\right)\right) + 1 \]
    6. 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 \]
    7. lower-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)} \]
    8. lift-+.f64N/A

      \[\leadsto \mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{\left(\frac{253}{1000} + x \cdot \frac{3}{25}\right)}\right), x, 1\right) \]
    9. +-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) \]
    10. 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) \]
    11. lift-*.f64N/A

      \[\leadsto \mathsf{fma}\left(\left(\mathsf{neg}\left(\color{blue}{x \cdot \frac{3}{25}}\right)\right) + \left(\mathsf{neg}\left(\frac{253}{1000}\right)\right), x, 1\right) \]
    12. 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) \]
    13. lower-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) \]
    14. 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) \]
    15. metadata-eval99.9

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

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

Alternative 6: 50.6% 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. Applied rewrites62.7%

        \[\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. Step-by-step derivation
        1. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto 1 - x \cdot \frac{\mathsf{fma}\left(x, x \cdot \frac{9}{625}, \color{blue}{\frac{-64009}{1000000}}\right)}{x \cdot \frac{3}{25} - \frac{253}{1000}} \]
        17. sub-negN/A

          \[\leadsto 1 - x \cdot \frac{\mathsf{fma}\left(x, x \cdot \frac{9}{625}, \frac{-64009}{1000000}\right)}{\color{blue}{x \cdot \frac{3}{25} + \left(\mathsf{neg}\left(\frac{253}{1000}\right)\right)}} \]
        18. lift-*.f64N/A

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

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

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

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

        \[\leadsto \color{blue}{-1 \cdot \left({x}^{2} \cdot \left(\frac{3}{25} + \frac{253}{1000} \cdot \frac{1}{x}\right)\right)} \]
      6. Step-by-step derivation
        1. mul-1-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto x \cdot \frac{-253}{1000} \]
      9. Step-by-step derivation
        1. Applied rewrites6.8%

          \[\leadsto x \cdot -0.253 \]
      10. Recombined 2 regimes into one program.
      11. 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.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 + \frac{-253}{1000} \cdot x} \]
      4. Step-by-step derivation
        1. +-commutativeN/A

          \[\leadsto \color{blue}{\frac{-253}{1000} \cdot x + 1} \]
        2. lower-fma.f6447.9

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

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

      Alternative 8: 49.1% 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.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. Applied rewrites45.3%

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

        Reproduce

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