Rosa's Benchmark

Percentage Accurate: 99.8% → 99.8%
Time: 6.8s
Alternatives: 7
Speedup: 1.4×

Specification

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

\\
0.954929658551372 \cdot x - 0.12900613773279798 \cdot \left(\left(x \cdot x\right) \cdot x\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 7 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.8% accurate, 1.0× speedup?

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

\\
0.954929658551372 \cdot x - 0.12900613773279798 \cdot \left(\left(x \cdot x\right) \cdot x\right)
\end{array}

Alternative 1: 99.8% accurate, 1.4× speedup?

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

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

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

      \[\leadsto \color{blue}{\frac{238732414637843}{250000000000000} \cdot x - \frac{6450306886639899}{50000000000000000} \cdot \left(\left(x \cdot x\right) \cdot x\right)} \]
    2. lift-*.f64N/A

      \[\leadsto \frac{238732414637843}{250000000000000} \cdot x - \color{blue}{\frac{6450306886639899}{50000000000000000} \cdot \left(\left(x \cdot x\right) \cdot x\right)} \]
    3. fp-cancel-sub-sign-invN/A

      \[\leadsto \color{blue}{\frac{238732414637843}{250000000000000} \cdot x + \left(\mathsf{neg}\left(\frac{6450306886639899}{50000000000000000}\right)\right) \cdot \left(\left(x \cdot x\right) \cdot x\right)} \]
    4. lift-*.f64N/A

      \[\leadsto \color{blue}{\frac{238732414637843}{250000000000000} \cdot x} + \left(\mathsf{neg}\left(\frac{6450306886639899}{50000000000000000}\right)\right) \cdot \left(\left(x \cdot x\right) \cdot x\right) \]
    5. rem-square-sqrtN/A

      \[\leadsto \frac{238732414637843}{250000000000000} \cdot \color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)} + \left(\mathsf{neg}\left(\frac{6450306886639899}{50000000000000000}\right)\right) \cdot \left(\left(x \cdot x\right) \cdot x\right) \]
    6. sqrt-prodN/A

      \[\leadsto \frac{238732414637843}{250000000000000} \cdot \color{blue}{\sqrt{x \cdot x}} + \left(\mathsf{neg}\left(\frac{6450306886639899}{50000000000000000}\right)\right) \cdot \left(\left(x \cdot x\right) \cdot x\right) \]
    7. sqr-neg-revN/A

      \[\leadsto \frac{238732414637843}{250000000000000} \cdot \sqrt{\color{blue}{\left(\mathsf{neg}\left(x\right)\right) \cdot \left(\mathsf{neg}\left(x\right)\right)}} + \left(\mathsf{neg}\left(\frac{6450306886639899}{50000000000000000}\right)\right) \cdot \left(\left(x \cdot x\right) \cdot x\right) \]
    8. pow2N/A

      \[\leadsto \frac{238732414637843}{250000000000000} \cdot \sqrt{\color{blue}{{\left(\mathsf{neg}\left(x\right)\right)}^{2}}} + \left(\mathsf{neg}\left(\frac{6450306886639899}{50000000000000000}\right)\right) \cdot \left(\left(x \cdot x\right) \cdot x\right) \]
    9. sqrt-pow1N/A

      \[\leadsto \frac{238732414637843}{250000000000000} \cdot \color{blue}{{\left(\mathsf{neg}\left(x\right)\right)}^{\left(\frac{2}{2}\right)}} + \left(\mathsf{neg}\left(\frac{6450306886639899}{50000000000000000}\right)\right) \cdot \left(\left(x \cdot x\right) \cdot x\right) \]
    10. metadata-evalN/A

      \[\leadsto \frac{238732414637843}{250000000000000} \cdot {\left(\mathsf{neg}\left(x\right)\right)}^{\color{blue}{1}} + \left(\mathsf{neg}\left(\frac{6450306886639899}{50000000000000000}\right)\right) \cdot \left(\left(x \cdot x\right) \cdot x\right) \]
    11. unpow1N/A

      \[\leadsto \frac{238732414637843}{250000000000000} \cdot \color{blue}{\left(\mathsf{neg}\left(x\right)\right)} + \left(\mathsf{neg}\left(\frac{6450306886639899}{50000000000000000}\right)\right) \cdot \left(\left(x \cdot x\right) \cdot x\right) \]
    12. distribute-rgt-neg-inN/A

      \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000} \cdot x\right)\right)} + \left(\mathsf{neg}\left(\frac{6450306886639899}{50000000000000000}\right)\right) \cdot \left(\left(x \cdot x\right) \cdot x\right) \]
    13. lift-*.f64N/A

      \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\frac{238732414637843}{250000000000000} \cdot x}\right)\right) + \left(\mathsf{neg}\left(\frac{6450306886639899}{50000000000000000}\right)\right) \cdot \left(\left(x \cdot x\right) \cdot x\right) \]
    14. distribute-lft-neg-inN/A

      \[\leadsto \left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000} \cdot x\right)\right) + \color{blue}{\left(\mathsf{neg}\left(\frac{6450306886639899}{50000000000000000} \cdot \left(\left(x \cdot x\right) \cdot x\right)\right)\right)} \]
    15. lift-*.f64N/A

      \[\leadsto \left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000} \cdot x\right)\right) + \left(\mathsf{neg}\left(\color{blue}{\frac{6450306886639899}{50000000000000000} \cdot \left(\left(x \cdot x\right) \cdot x\right)}\right)\right) \]
    16. distribute-neg-inN/A

      \[\leadsto \color{blue}{\mathsf{neg}\left(\left(\frac{238732414637843}{250000000000000} \cdot x + \frac{6450306886639899}{50000000000000000} \cdot \left(\left(x \cdot x\right) \cdot x\right)\right)\right)} \]
    17. lift-*.f64N/A

      \[\leadsto \mathsf{neg}\left(\left(\color{blue}{\frac{238732414637843}{250000000000000} \cdot x} + \frac{6450306886639899}{50000000000000000} \cdot \left(\left(x \cdot x\right) \cdot x\right)\right)\right) \]
    18. lift-*.f64N/A

      \[\leadsto \mathsf{neg}\left(\left(\frac{238732414637843}{250000000000000} \cdot x + \color{blue}{\frac{6450306886639899}{50000000000000000} \cdot \left(\left(x \cdot x\right) \cdot x\right)}\right)\right) \]
    19. lift-*.f64N/A

      \[\leadsto \mathsf{neg}\left(\left(\frac{238732414637843}{250000000000000} \cdot x + \frac{6450306886639899}{50000000000000000} \cdot \color{blue}{\left(\left(x \cdot x\right) \cdot x\right)}\right)\right) \]
    20. associate-*r*N/A

      \[\leadsto \mathsf{neg}\left(\left(\frac{238732414637843}{250000000000000} \cdot x + \color{blue}{\left(\frac{6450306886639899}{50000000000000000} \cdot \left(x \cdot x\right)\right) \cdot x}\right)\right) \]
    21. distribute-rgt-outN/A

      \[\leadsto \mathsf{neg}\left(\color{blue}{x \cdot \left(\frac{238732414637843}{250000000000000} + \frac{6450306886639899}{50000000000000000} \cdot \left(x \cdot x\right)\right)}\right) \]
  4. Applied rewrites99.9%

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

Alternative 2: 75.3% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;0.954929658551372 \cdot x - 0.12900613773279798 \cdot \left(\left(x \cdot x\right) \cdot x\right) \leq -0.2:\\
\;\;\;\;\left(\left(x \cdot x\right) \cdot -0.12900613773279798\right) \cdot x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (*.f64 #s(literal 238732414637843/250000000000000 binary64) x) (*.f64 #s(literal 6450306886639899/50000000000000000 binary64) (*.f64 (*.f64 x x) x))) < -0.20000000000000001

    1. Initial program 99.7%

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

        \[\leadsto \color{blue}{\frac{238732414637843}{250000000000000} \cdot x - \frac{6450306886639899}{50000000000000000} \cdot \left(\left(x \cdot x\right) \cdot x\right)} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{238732414637843}{250000000000000} \cdot x - \color{blue}{\frac{6450306886639899}{50000000000000000} \cdot \left(\left(x \cdot x\right) \cdot x\right)} \]
      3. fp-cancel-sub-sign-invN/A

        \[\leadsto \color{blue}{\frac{238732414637843}{250000000000000} \cdot x + \left(\mathsf{neg}\left(\frac{6450306886639899}{50000000000000000}\right)\right) \cdot \left(\left(x \cdot x\right) \cdot x\right)} \]
      4. lift-*.f64N/A

        \[\leadsto \color{blue}{\frac{238732414637843}{250000000000000} \cdot x} + \left(\mathsf{neg}\left(\frac{6450306886639899}{50000000000000000}\right)\right) \cdot \left(\left(x \cdot x\right) \cdot x\right) \]
      5. rem-square-sqrtN/A

        \[\leadsto \frac{238732414637843}{250000000000000} \cdot \color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)} + \left(\mathsf{neg}\left(\frac{6450306886639899}{50000000000000000}\right)\right) \cdot \left(\left(x \cdot x\right) \cdot x\right) \]
      6. sqrt-prodN/A

        \[\leadsto \frac{238732414637843}{250000000000000} \cdot \color{blue}{\sqrt{x \cdot x}} + \left(\mathsf{neg}\left(\frac{6450306886639899}{50000000000000000}\right)\right) \cdot \left(\left(x \cdot x\right) \cdot x\right) \]
      7. sqr-neg-revN/A

        \[\leadsto \frac{238732414637843}{250000000000000} \cdot \sqrt{\color{blue}{\left(\mathsf{neg}\left(x\right)\right) \cdot \left(\mathsf{neg}\left(x\right)\right)}} + \left(\mathsf{neg}\left(\frac{6450306886639899}{50000000000000000}\right)\right) \cdot \left(\left(x \cdot x\right) \cdot x\right) \]
      8. pow2N/A

        \[\leadsto \frac{238732414637843}{250000000000000} \cdot \sqrt{\color{blue}{{\left(\mathsf{neg}\left(x\right)\right)}^{2}}} + \left(\mathsf{neg}\left(\frac{6450306886639899}{50000000000000000}\right)\right) \cdot \left(\left(x \cdot x\right) \cdot x\right) \]
      9. sqrt-pow1N/A

        \[\leadsto \frac{238732414637843}{250000000000000} \cdot \color{blue}{{\left(\mathsf{neg}\left(x\right)\right)}^{\left(\frac{2}{2}\right)}} + \left(\mathsf{neg}\left(\frac{6450306886639899}{50000000000000000}\right)\right) \cdot \left(\left(x \cdot x\right) \cdot x\right) \]
      10. metadata-evalN/A

        \[\leadsto \frac{238732414637843}{250000000000000} \cdot {\left(\mathsf{neg}\left(x\right)\right)}^{\color{blue}{1}} + \left(\mathsf{neg}\left(\frac{6450306886639899}{50000000000000000}\right)\right) \cdot \left(\left(x \cdot x\right) \cdot x\right) \]
      11. unpow1N/A

        \[\leadsto \frac{238732414637843}{250000000000000} \cdot \color{blue}{\left(\mathsf{neg}\left(x\right)\right)} + \left(\mathsf{neg}\left(\frac{6450306886639899}{50000000000000000}\right)\right) \cdot \left(\left(x \cdot x\right) \cdot x\right) \]
      12. distribute-rgt-neg-inN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000} \cdot x\right)\right)} + \left(\mathsf{neg}\left(\frac{6450306886639899}{50000000000000000}\right)\right) \cdot \left(\left(x \cdot x\right) \cdot x\right) \]
      13. lift-*.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\frac{238732414637843}{250000000000000} \cdot x}\right)\right) + \left(\mathsf{neg}\left(\frac{6450306886639899}{50000000000000000}\right)\right) \cdot \left(\left(x \cdot x\right) \cdot x\right) \]
      14. distribute-lft-neg-inN/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000} \cdot x\right)\right) + \color{blue}{\left(\mathsf{neg}\left(\frac{6450306886639899}{50000000000000000} \cdot \left(\left(x \cdot x\right) \cdot x\right)\right)\right)} \]
      15. lift-*.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000} \cdot x\right)\right) + \left(\mathsf{neg}\left(\color{blue}{\frac{6450306886639899}{50000000000000000} \cdot \left(\left(x \cdot x\right) \cdot x\right)}\right)\right) \]
      16. distribute-neg-inN/A

        \[\leadsto \color{blue}{\mathsf{neg}\left(\left(\frac{238732414637843}{250000000000000} \cdot x + \frac{6450306886639899}{50000000000000000} \cdot \left(\left(x \cdot x\right) \cdot x\right)\right)\right)} \]
      17. lift-*.f64N/A

        \[\leadsto \mathsf{neg}\left(\left(\color{blue}{\frac{238732414637843}{250000000000000} \cdot x} + \frac{6450306886639899}{50000000000000000} \cdot \left(\left(x \cdot x\right) \cdot x\right)\right)\right) \]
      18. lift-*.f64N/A

        \[\leadsto \mathsf{neg}\left(\left(\frac{238732414637843}{250000000000000} \cdot x + \color{blue}{\frac{6450306886639899}{50000000000000000} \cdot \left(\left(x \cdot x\right) \cdot x\right)}\right)\right) \]
      19. lift-*.f64N/A

        \[\leadsto \mathsf{neg}\left(\left(\frac{238732414637843}{250000000000000} \cdot x + \frac{6450306886639899}{50000000000000000} \cdot \color{blue}{\left(\left(x \cdot x\right) \cdot x\right)}\right)\right) \]
      20. associate-*r*N/A

        \[\leadsto \mathsf{neg}\left(\left(\frac{238732414637843}{250000000000000} \cdot x + \color{blue}{\left(\frac{6450306886639899}{50000000000000000} \cdot \left(x \cdot x\right)\right) \cdot x}\right)\right) \]
      21. distribute-rgt-outN/A

        \[\leadsto \mathsf{neg}\left(\color{blue}{x \cdot \left(\frac{238732414637843}{250000000000000} + \frac{6450306886639899}{50000000000000000} \cdot \left(x \cdot x\right)\right)}\right) \]
    4. Applied rewrites99.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(-0.12900613773279798, x \cdot x, 0.954929658551372\right) \cdot x} \]
    5. Taylor expanded in x around inf

      \[\leadsto \color{blue}{\left(\frac{-6450306886639899}{50000000000000000} \cdot {x}^{2}\right)} \cdot x \]
    6. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{\left({x}^{2} \cdot \frac{-6450306886639899}{50000000000000000}\right)} \cdot x \]
      2. lower-*.f64N/A

        \[\leadsto \color{blue}{\left({x}^{2} \cdot \frac{-6450306886639899}{50000000000000000}\right)} \cdot x \]
      3. unpow2N/A

        \[\leadsto \left(\color{blue}{\left(x \cdot x\right)} \cdot \frac{-6450306886639899}{50000000000000000}\right) \cdot x \]
      4. lower-*.f6496.2

        \[\leadsto \left(\color{blue}{\left(x \cdot x\right)} \cdot -0.12900613773279798\right) \cdot x \]
    7. Applied rewrites96.2%

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

    if -0.20000000000000001 < (-.f64 (*.f64 #s(literal 238732414637843/250000000000000 binary64) x) (*.f64 #s(literal 6450306886639899/50000000000000000 binary64) (*.f64 (*.f64 x x) x)))

    1. Initial program 99.8%

      \[0.954929658551372 \cdot x - 0.12900613773279798 \cdot \left(\left(x \cdot x\right) \cdot x\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\frac{238732414637843}{250000000000000} \cdot x} \]
    4. Step-by-step derivation
      1. remove-double-negN/A

        \[\leadsto \frac{238732414637843}{250000000000000} \cdot \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right)} \]
      2. distribute-rgt-neg-outN/A

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

        \[\leadsto \mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(x\right)\right) \cdot \frac{238732414637843}{250000000000000}}\right) \]
      4. distribute-lft-neg-outN/A

        \[\leadsto \mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(x \cdot \frac{238732414637843}{250000000000000}\right)\right)}\right) \]
      5. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{neg}\left(\color{blue}{x \cdot \left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right)}\right) \]
      6. *-commutativeN/A

        \[\leadsto \mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right) \cdot x}\right) \]
      7. distribute-rgt-neg-outN/A

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right) \cdot \left(\mathsf{neg}\left(x\right)\right)} \]
      8. metadata-evalN/A

        \[\leadsto \color{blue}{\frac{-238732414637843}{250000000000000}} \cdot \left(\mathsf{neg}\left(x\right)\right) \]
      9. metadata-evalN/A

        \[\leadsto \color{blue}{\left(\frac{-238732414637843}{250000000000000} \cdot 1\right)} \cdot \left(\mathsf{neg}\left(x\right)\right) \]
      10. metadata-evalN/A

        \[\leadsto \left(\color{blue}{\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right)} \cdot 1\right) \cdot \left(\mathsf{neg}\left(x\right)\right) \]
      11. lft-mult-inverseN/A

        \[\leadsto \left(\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right) \cdot \color{blue}{\left(\frac{1}{{x}^{2}} \cdot {x}^{2}\right)}\right) \cdot \left(\mathsf{neg}\left(x\right)\right) \]
      12. associate-*l*N/A

        \[\leadsto \color{blue}{\left(\left(\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right) \cdot \frac{1}{{x}^{2}}\right) \cdot {x}^{2}\right)} \cdot \left(\mathsf{neg}\left(x\right)\right) \]
      13. *-commutativeN/A

        \[\leadsto \left(\color{blue}{\left(\frac{1}{{x}^{2}} \cdot \left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right)\right)} \cdot {x}^{2}\right) \cdot \left(\mathsf{neg}\left(x\right)\right) \]
      14. associate-*l*N/A

        \[\leadsto \color{blue}{\left(\frac{1}{{x}^{2}} \cdot \left(\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right) \cdot {x}^{2}\right)\right)} \cdot \left(\mathsf{neg}\left(x\right)\right) \]
      15. associate-*l/N/A

        \[\leadsto \color{blue}{\frac{1 \cdot \left(\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right) \cdot {x}^{2}\right)}{{x}^{2}}} \cdot \left(\mathsf{neg}\left(x\right)\right) \]
      16. *-lft-identityN/A

        \[\leadsto \frac{\color{blue}{\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right) \cdot {x}^{2}}}{{x}^{2}} \cdot \left(\mathsf{neg}\left(x\right)\right) \]
      17. *-lft-identityN/A

        \[\leadsto \frac{\color{blue}{1 \cdot \left(\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right) \cdot {x}^{2}\right)}}{{x}^{2}} \cdot \left(\mathsf{neg}\left(x\right)\right) \]
      18. associate-*l/N/A

        \[\leadsto \color{blue}{\left(\frac{1}{{x}^{2}} \cdot \left(\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right) \cdot {x}^{2}\right)\right)} \cdot \left(\mathsf{neg}\left(x\right)\right) \]
      19. associate-*l*N/A

        \[\leadsto \color{blue}{\left(\left(\frac{1}{{x}^{2}} \cdot \left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right)\right) \cdot {x}^{2}\right)} \cdot \left(\mathsf{neg}\left(x\right)\right) \]
      20. *-commutativeN/A

        \[\leadsto \left(\color{blue}{\left(\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right) \cdot \frac{1}{{x}^{2}}\right)} \cdot {x}^{2}\right) \cdot \left(\mathsf{neg}\left(x\right)\right) \]
      21. distribute-rgt-neg-inN/A

        \[\leadsto \color{blue}{\mathsf{neg}\left(\left(\left(\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right) \cdot \frac{1}{{x}^{2}}\right) \cdot {x}^{2}\right) \cdot x\right)} \]
    5. Applied rewrites66.8%

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

Alternative 3: 75.3% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;0.954929658551372 \cdot x - 0.12900613773279798 \cdot \left(\left(x \cdot x\right) \cdot x\right) \leq -0.2:\\
\;\;\;\;\left(x \cdot x\right) \cdot \left(-0.12900613773279798 \cdot x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (*.f64 #s(literal 238732414637843/250000000000000 binary64) x) (*.f64 #s(literal 6450306886639899/50000000000000000 binary64) (*.f64 (*.f64 x x) x))) < -0.20000000000000001

    1. Initial program 99.7%

      \[0.954929658551372 \cdot x - 0.12900613773279798 \cdot \left(\left(x \cdot x\right) \cdot x\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf

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

        \[\leadsto \color{blue}{\frac{-6450306886639899}{50000000000000000} \cdot {x}^{3}} \]
      2. lower-pow.f6496.2

        \[\leadsto -0.12900613773279798 \cdot \color{blue}{{x}^{3}} \]
    5. Applied rewrites96.2%

      \[\leadsto \color{blue}{-0.12900613773279798 \cdot {x}^{3}} \]
    6. Step-by-step derivation
      1. Applied rewrites96.2%

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

      if -0.20000000000000001 < (-.f64 (*.f64 #s(literal 238732414637843/250000000000000 binary64) x) (*.f64 #s(literal 6450306886639899/50000000000000000 binary64) (*.f64 (*.f64 x x) x)))

      1. Initial program 99.8%

        \[0.954929658551372 \cdot x - 0.12900613773279798 \cdot \left(\left(x \cdot x\right) \cdot x\right) \]
      2. Add Preprocessing
      3. Taylor expanded in x around 0

        \[\leadsto \color{blue}{\frac{238732414637843}{250000000000000} \cdot x} \]
      4. Step-by-step derivation
        1. remove-double-negN/A

          \[\leadsto \frac{238732414637843}{250000000000000} \cdot \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right)} \]
        2. distribute-rgt-neg-outN/A

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

          \[\leadsto \mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(x\right)\right) \cdot \frac{238732414637843}{250000000000000}}\right) \]
        4. distribute-lft-neg-outN/A

          \[\leadsto \mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(x \cdot \frac{238732414637843}{250000000000000}\right)\right)}\right) \]
        5. distribute-rgt-neg-inN/A

          \[\leadsto \mathsf{neg}\left(\color{blue}{x \cdot \left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right)}\right) \]
        6. *-commutativeN/A

          \[\leadsto \mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right) \cdot x}\right) \]
        7. distribute-rgt-neg-outN/A

          \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right) \cdot \left(\mathsf{neg}\left(x\right)\right)} \]
        8. metadata-evalN/A

          \[\leadsto \color{blue}{\frac{-238732414637843}{250000000000000}} \cdot \left(\mathsf{neg}\left(x\right)\right) \]
        9. metadata-evalN/A

          \[\leadsto \color{blue}{\left(\frac{-238732414637843}{250000000000000} \cdot 1\right)} \cdot \left(\mathsf{neg}\left(x\right)\right) \]
        10. metadata-evalN/A

          \[\leadsto \left(\color{blue}{\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right)} \cdot 1\right) \cdot \left(\mathsf{neg}\left(x\right)\right) \]
        11. lft-mult-inverseN/A

          \[\leadsto \left(\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right) \cdot \color{blue}{\left(\frac{1}{{x}^{2}} \cdot {x}^{2}\right)}\right) \cdot \left(\mathsf{neg}\left(x\right)\right) \]
        12. associate-*l*N/A

          \[\leadsto \color{blue}{\left(\left(\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right) \cdot \frac{1}{{x}^{2}}\right) \cdot {x}^{2}\right)} \cdot \left(\mathsf{neg}\left(x\right)\right) \]
        13. *-commutativeN/A

          \[\leadsto \left(\color{blue}{\left(\frac{1}{{x}^{2}} \cdot \left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right)\right)} \cdot {x}^{2}\right) \cdot \left(\mathsf{neg}\left(x\right)\right) \]
        14. associate-*l*N/A

          \[\leadsto \color{blue}{\left(\frac{1}{{x}^{2}} \cdot \left(\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right) \cdot {x}^{2}\right)\right)} \cdot \left(\mathsf{neg}\left(x\right)\right) \]
        15. associate-*l/N/A

          \[\leadsto \color{blue}{\frac{1 \cdot \left(\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right) \cdot {x}^{2}\right)}{{x}^{2}}} \cdot \left(\mathsf{neg}\left(x\right)\right) \]
        16. *-lft-identityN/A

          \[\leadsto \frac{\color{blue}{\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right) \cdot {x}^{2}}}{{x}^{2}} \cdot \left(\mathsf{neg}\left(x\right)\right) \]
        17. *-lft-identityN/A

          \[\leadsto \frac{\color{blue}{1 \cdot \left(\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right) \cdot {x}^{2}\right)}}{{x}^{2}} \cdot \left(\mathsf{neg}\left(x\right)\right) \]
        18. associate-*l/N/A

          \[\leadsto \color{blue}{\left(\frac{1}{{x}^{2}} \cdot \left(\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right) \cdot {x}^{2}\right)\right)} \cdot \left(\mathsf{neg}\left(x\right)\right) \]
        19. associate-*l*N/A

          \[\leadsto \color{blue}{\left(\left(\frac{1}{{x}^{2}} \cdot \left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right)\right) \cdot {x}^{2}\right)} \cdot \left(\mathsf{neg}\left(x\right)\right) \]
        20. *-commutativeN/A

          \[\leadsto \left(\color{blue}{\left(\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right) \cdot \frac{1}{{x}^{2}}\right)} \cdot {x}^{2}\right) \cdot \left(\mathsf{neg}\left(x\right)\right) \]
        21. distribute-rgt-neg-inN/A

          \[\leadsto \color{blue}{\mathsf{neg}\left(\left(\left(\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right) \cdot \frac{1}{{x}^{2}}\right) \cdot {x}^{2}\right) \cdot x\right)} \]
      5. Applied rewrites66.8%

        \[\leadsto \color{blue}{0.954929658551372 \cdot x} \]
    7. Recombined 2 regimes into one program.
    8. Add Preprocessing

    Alternative 4: 75.3% accurate, 0.5× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(x \cdot x\right) \cdot x\\ \mathbf{if}\;0.954929658551372 \cdot x - 0.12900613773279798 \cdot t\_0 \leq -0.2:\\ \;\;\;\;-0.12900613773279798 \cdot t\_0\\ \mathbf{else}:\\ \;\;\;\;0.954929658551372 \cdot x\\ \end{array} \end{array} \]
    (FPCore (x)
     :precision binary64
     (let* ((t_0 (* (* x x) x)))
       (if (<= (- (* 0.954929658551372 x) (* 0.12900613773279798 t_0)) -0.2)
         (* -0.12900613773279798 t_0)
         (* 0.954929658551372 x))))
    double code(double x) {
    	double t_0 = (x * x) * x;
    	double tmp;
    	if (((0.954929658551372 * x) - (0.12900613773279798 * t_0)) <= -0.2) {
    		tmp = -0.12900613773279798 * t_0;
    	} else {
    		tmp = 0.954929658551372 * x;
    	}
    	return tmp;
    }
    
    real(8) function code(x)
        real(8), intent (in) :: x
        real(8) :: t_0
        real(8) :: tmp
        t_0 = (x * x) * x
        if (((0.954929658551372d0 * x) - (0.12900613773279798d0 * t_0)) <= (-0.2d0)) then
            tmp = (-0.12900613773279798d0) * t_0
        else
            tmp = 0.954929658551372d0 * x
        end if
        code = tmp
    end function
    
    public static double code(double x) {
    	double t_0 = (x * x) * x;
    	double tmp;
    	if (((0.954929658551372 * x) - (0.12900613773279798 * t_0)) <= -0.2) {
    		tmp = -0.12900613773279798 * t_0;
    	} else {
    		tmp = 0.954929658551372 * x;
    	}
    	return tmp;
    }
    
    def code(x):
    	t_0 = (x * x) * x
    	tmp = 0
    	if ((0.954929658551372 * x) - (0.12900613773279798 * t_0)) <= -0.2:
    		tmp = -0.12900613773279798 * t_0
    	else:
    		tmp = 0.954929658551372 * x
    	return tmp
    
    function code(x)
    	t_0 = Float64(Float64(x * x) * x)
    	tmp = 0.0
    	if (Float64(Float64(0.954929658551372 * x) - Float64(0.12900613773279798 * t_0)) <= -0.2)
    		tmp = Float64(-0.12900613773279798 * t_0);
    	else
    		tmp = Float64(0.954929658551372 * x);
    	end
    	return tmp
    end
    
    function tmp_2 = code(x)
    	t_0 = (x * x) * x;
    	tmp = 0.0;
    	if (((0.954929658551372 * x) - (0.12900613773279798 * t_0)) <= -0.2)
    		tmp = -0.12900613773279798 * t_0;
    	else
    		tmp = 0.954929658551372 * x;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_] := Block[{t$95$0 = N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[N[(N[(0.954929658551372 * x), $MachinePrecision] - N[(0.12900613773279798 * t$95$0), $MachinePrecision]), $MachinePrecision], -0.2], N[(-0.12900613773279798 * t$95$0), $MachinePrecision], N[(0.954929658551372 * x), $MachinePrecision]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \left(x \cdot x\right) \cdot x\\
    \mathbf{if}\;0.954929658551372 \cdot x - 0.12900613773279798 \cdot t\_0 \leq -0.2:\\
    \;\;\;\;-0.12900613773279798 \cdot t\_0\\
    
    \mathbf{else}:\\
    \;\;\;\;0.954929658551372 \cdot x\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if (-.f64 (*.f64 #s(literal 238732414637843/250000000000000 binary64) x) (*.f64 #s(literal 6450306886639899/50000000000000000 binary64) (*.f64 (*.f64 x x) x))) < -0.20000000000000001

      1. Initial program 99.7%

        \[0.954929658551372 \cdot x - 0.12900613773279798 \cdot \left(\left(x \cdot x\right) \cdot x\right) \]
      2. Add Preprocessing
      3. Taylor expanded in x around inf

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

          \[\leadsto \color{blue}{\frac{-6450306886639899}{50000000000000000} \cdot {x}^{3}} \]
        2. lower-pow.f6496.2

          \[\leadsto -0.12900613773279798 \cdot \color{blue}{{x}^{3}} \]
      5. Applied rewrites96.2%

        \[\leadsto \color{blue}{-0.12900613773279798 \cdot {x}^{3}} \]
      6. Step-by-step derivation
        1. Applied rewrites96.2%

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

        if -0.20000000000000001 < (-.f64 (*.f64 #s(literal 238732414637843/250000000000000 binary64) x) (*.f64 #s(literal 6450306886639899/50000000000000000 binary64) (*.f64 (*.f64 x x) x)))

        1. Initial program 99.8%

          \[0.954929658551372 \cdot x - 0.12900613773279798 \cdot \left(\left(x \cdot x\right) \cdot x\right) \]
        2. Add Preprocessing
        3. Taylor expanded in x around 0

          \[\leadsto \color{blue}{\frac{238732414637843}{250000000000000} \cdot x} \]
        4. Step-by-step derivation
          1. remove-double-negN/A

            \[\leadsto \frac{238732414637843}{250000000000000} \cdot \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right)} \]
          2. distribute-rgt-neg-outN/A

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

            \[\leadsto \mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(x\right)\right) \cdot \frac{238732414637843}{250000000000000}}\right) \]
          4. distribute-lft-neg-outN/A

            \[\leadsto \mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(x \cdot \frac{238732414637843}{250000000000000}\right)\right)}\right) \]
          5. distribute-rgt-neg-inN/A

            \[\leadsto \mathsf{neg}\left(\color{blue}{x \cdot \left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right)}\right) \]
          6. *-commutativeN/A

            \[\leadsto \mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right) \cdot x}\right) \]
          7. distribute-rgt-neg-outN/A

            \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right) \cdot \left(\mathsf{neg}\left(x\right)\right)} \]
          8. metadata-evalN/A

            \[\leadsto \color{blue}{\frac{-238732414637843}{250000000000000}} \cdot \left(\mathsf{neg}\left(x\right)\right) \]
          9. metadata-evalN/A

            \[\leadsto \color{blue}{\left(\frac{-238732414637843}{250000000000000} \cdot 1\right)} \cdot \left(\mathsf{neg}\left(x\right)\right) \]
          10. metadata-evalN/A

            \[\leadsto \left(\color{blue}{\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right)} \cdot 1\right) \cdot \left(\mathsf{neg}\left(x\right)\right) \]
          11. lft-mult-inverseN/A

            \[\leadsto \left(\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right) \cdot \color{blue}{\left(\frac{1}{{x}^{2}} \cdot {x}^{2}\right)}\right) \cdot \left(\mathsf{neg}\left(x\right)\right) \]
          12. associate-*l*N/A

            \[\leadsto \color{blue}{\left(\left(\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right) \cdot \frac{1}{{x}^{2}}\right) \cdot {x}^{2}\right)} \cdot \left(\mathsf{neg}\left(x\right)\right) \]
          13. *-commutativeN/A

            \[\leadsto \left(\color{blue}{\left(\frac{1}{{x}^{2}} \cdot \left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right)\right)} \cdot {x}^{2}\right) \cdot \left(\mathsf{neg}\left(x\right)\right) \]
          14. associate-*l*N/A

            \[\leadsto \color{blue}{\left(\frac{1}{{x}^{2}} \cdot \left(\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right) \cdot {x}^{2}\right)\right)} \cdot \left(\mathsf{neg}\left(x\right)\right) \]
          15. associate-*l/N/A

            \[\leadsto \color{blue}{\frac{1 \cdot \left(\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right) \cdot {x}^{2}\right)}{{x}^{2}}} \cdot \left(\mathsf{neg}\left(x\right)\right) \]
          16. *-lft-identityN/A

            \[\leadsto \frac{\color{blue}{\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right) \cdot {x}^{2}}}{{x}^{2}} \cdot \left(\mathsf{neg}\left(x\right)\right) \]
          17. *-lft-identityN/A

            \[\leadsto \frac{\color{blue}{1 \cdot \left(\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right) \cdot {x}^{2}\right)}}{{x}^{2}} \cdot \left(\mathsf{neg}\left(x\right)\right) \]
          18. associate-*l/N/A

            \[\leadsto \color{blue}{\left(\frac{1}{{x}^{2}} \cdot \left(\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right) \cdot {x}^{2}\right)\right)} \cdot \left(\mathsf{neg}\left(x\right)\right) \]
          19. associate-*l*N/A

            \[\leadsto \color{blue}{\left(\left(\frac{1}{{x}^{2}} \cdot \left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right)\right) \cdot {x}^{2}\right)} \cdot \left(\mathsf{neg}\left(x\right)\right) \]
          20. *-commutativeN/A

            \[\leadsto \left(\color{blue}{\left(\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right) \cdot \frac{1}{{x}^{2}}\right)} \cdot {x}^{2}\right) \cdot \left(\mathsf{neg}\left(x\right)\right) \]
          21. distribute-rgt-neg-inN/A

            \[\leadsto \color{blue}{\mathsf{neg}\left(\left(\left(\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right) \cdot \frac{1}{{x}^{2}}\right) \cdot {x}^{2}\right) \cdot x\right)} \]
        5. Applied rewrites66.8%

          \[\leadsto \color{blue}{0.954929658551372 \cdot x} \]
      7. Recombined 2 regimes into one program.
      8. Add Preprocessing

      Alternative 5: 51.0% accurate, 0.7× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;0.954929658551372 \cdot x - 0.12900613773279798 \cdot \left(\left(x \cdot x\right) \cdot x\right) \leq -0.2:\\ \;\;\;\;-0.954929658551372 \cdot x\\ \mathbf{else}:\\ \;\;\;\;0.954929658551372 \cdot x\\ \end{array} \end{array} \]
      (FPCore (x)
       :precision binary64
       (if (<=
            (- (* 0.954929658551372 x) (* 0.12900613773279798 (* (* x x) x)))
            -0.2)
         (* -0.954929658551372 x)
         (* 0.954929658551372 x)))
      double code(double x) {
      	double tmp;
      	if (((0.954929658551372 * x) - (0.12900613773279798 * ((x * x) * x))) <= -0.2) {
      		tmp = -0.954929658551372 * x;
      	} else {
      		tmp = 0.954929658551372 * x;
      	}
      	return tmp;
      }
      
      real(8) function code(x)
          real(8), intent (in) :: x
          real(8) :: tmp
          if (((0.954929658551372d0 * x) - (0.12900613773279798d0 * ((x * x) * x))) <= (-0.2d0)) then
              tmp = (-0.954929658551372d0) * x
          else
              tmp = 0.954929658551372d0 * x
          end if
          code = tmp
      end function
      
      public static double code(double x) {
      	double tmp;
      	if (((0.954929658551372 * x) - (0.12900613773279798 * ((x * x) * x))) <= -0.2) {
      		tmp = -0.954929658551372 * x;
      	} else {
      		tmp = 0.954929658551372 * x;
      	}
      	return tmp;
      }
      
      def code(x):
      	tmp = 0
      	if ((0.954929658551372 * x) - (0.12900613773279798 * ((x * x) * x))) <= -0.2:
      		tmp = -0.954929658551372 * x
      	else:
      		tmp = 0.954929658551372 * x
      	return tmp
      
      function code(x)
      	tmp = 0.0
      	if (Float64(Float64(0.954929658551372 * x) - Float64(0.12900613773279798 * Float64(Float64(x * x) * x))) <= -0.2)
      		tmp = Float64(-0.954929658551372 * x);
      	else
      		tmp = Float64(0.954929658551372 * x);
      	end
      	return tmp
      end
      
      function tmp_2 = code(x)
      	tmp = 0.0;
      	if (((0.954929658551372 * x) - (0.12900613773279798 * ((x * x) * x))) <= -0.2)
      		tmp = -0.954929658551372 * x;
      	else
      		tmp = 0.954929658551372 * x;
      	end
      	tmp_2 = tmp;
      end
      
      code[x_] := If[LessEqual[N[(N[(0.954929658551372 * x), $MachinePrecision] - N[(0.12900613773279798 * N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -0.2], N[(-0.954929658551372 * x), $MachinePrecision], N[(0.954929658551372 * x), $MachinePrecision]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;0.954929658551372 \cdot x - 0.12900613773279798 \cdot \left(\left(x \cdot x\right) \cdot x\right) \leq -0.2:\\
      \;\;\;\;-0.954929658551372 \cdot x\\
      
      \mathbf{else}:\\
      \;\;\;\;0.954929658551372 \cdot x\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if (-.f64 (*.f64 #s(literal 238732414637843/250000000000000 binary64) x) (*.f64 #s(literal 6450306886639899/50000000000000000 binary64) (*.f64 (*.f64 x x) x))) < -0.20000000000000001

        1. Initial program 99.7%

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

            \[\leadsto \color{blue}{\frac{238732414637843}{250000000000000} \cdot x - \frac{6450306886639899}{50000000000000000} \cdot \left(\left(x \cdot x\right) \cdot x\right)} \]
          2. lift-*.f64N/A

            \[\leadsto \frac{238732414637843}{250000000000000} \cdot x - \color{blue}{\frac{6450306886639899}{50000000000000000} \cdot \left(\left(x \cdot x\right) \cdot x\right)} \]
          3. fp-cancel-sub-sign-invN/A

            \[\leadsto \color{blue}{\frac{238732414637843}{250000000000000} \cdot x + \left(\mathsf{neg}\left(\frac{6450306886639899}{50000000000000000}\right)\right) \cdot \left(\left(x \cdot x\right) \cdot x\right)} \]
          4. +-commutativeN/A

            \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{6450306886639899}{50000000000000000}\right)\right) \cdot \left(\left(x \cdot x\right) \cdot x\right) + \frac{238732414637843}{250000000000000} \cdot x} \]
          5. lift-*.f64N/A

            \[\leadsto \left(\mathsf{neg}\left(\frac{6450306886639899}{50000000000000000}\right)\right) \cdot \color{blue}{\left(\left(x \cdot x\right) \cdot x\right)} + \frac{238732414637843}{250000000000000} \cdot x \]
          6. *-commutativeN/A

            \[\leadsto \left(\mathsf{neg}\left(\frac{6450306886639899}{50000000000000000}\right)\right) \cdot \color{blue}{\left(x \cdot \left(x \cdot x\right)\right)} + \frac{238732414637843}{250000000000000} \cdot x \]
          7. associate-*r*N/A

            \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(\frac{6450306886639899}{50000000000000000}\right)\right) \cdot x\right) \cdot \left(x \cdot x\right)} + \frac{238732414637843}{250000000000000} \cdot x \]
          8. *-commutativeN/A

            \[\leadsto \color{blue}{\left(x \cdot x\right) \cdot \left(\left(\mathsf{neg}\left(\frac{6450306886639899}{50000000000000000}\right)\right) \cdot x\right)} + \frac{238732414637843}{250000000000000} \cdot x \]
          9. lower-fma.f64N/A

            \[\leadsto \color{blue}{\mathsf{fma}\left(x \cdot x, \left(\mathsf{neg}\left(\frac{6450306886639899}{50000000000000000}\right)\right) \cdot x, \frac{238732414637843}{250000000000000} \cdot x\right)} \]
          10. lower-*.f64N/A

            \[\leadsto \mathsf{fma}\left(x \cdot x, \color{blue}{\left(\mathsf{neg}\left(\frac{6450306886639899}{50000000000000000}\right)\right) \cdot x}, \frac{238732414637843}{250000000000000} \cdot x\right) \]
          11. metadata-eval99.8

            \[\leadsto \mathsf{fma}\left(x \cdot x, \color{blue}{-0.12900613773279798} \cdot x, 0.954929658551372 \cdot x\right) \]
          12. lift-*.f64N/A

            \[\leadsto \mathsf{fma}\left(x \cdot x, \frac{-6450306886639899}{50000000000000000} \cdot x, \color{blue}{\frac{238732414637843}{250000000000000} \cdot x}\right) \]
          13. rem-square-sqrtN/A

            \[\leadsto \mathsf{fma}\left(x \cdot x, \frac{-6450306886639899}{50000000000000000} \cdot x, \frac{238732414637843}{250000000000000} \cdot \color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)}\right) \]
          14. sqrt-prodN/A

            \[\leadsto \mathsf{fma}\left(x \cdot x, \frac{-6450306886639899}{50000000000000000} \cdot x, \frac{238732414637843}{250000000000000} \cdot \color{blue}{\sqrt{x \cdot x}}\right) \]
          15. sqr-neg-revN/A

            \[\leadsto \mathsf{fma}\left(x \cdot x, \frac{-6450306886639899}{50000000000000000} \cdot x, \frac{238732414637843}{250000000000000} \cdot \sqrt{\color{blue}{\left(\mathsf{neg}\left(x\right)\right) \cdot \left(\mathsf{neg}\left(x\right)\right)}}\right) \]
          16. pow2N/A

            \[\leadsto \mathsf{fma}\left(x \cdot x, \frac{-6450306886639899}{50000000000000000} \cdot x, \frac{238732414637843}{250000000000000} \cdot \sqrt{\color{blue}{{\left(\mathsf{neg}\left(x\right)\right)}^{2}}}\right) \]
          17. sqrt-pow1N/A

            \[\leadsto \mathsf{fma}\left(x \cdot x, \frac{-6450306886639899}{50000000000000000} \cdot x, \frac{238732414637843}{250000000000000} \cdot \color{blue}{{\left(\mathsf{neg}\left(x\right)\right)}^{\left(\frac{2}{2}\right)}}\right) \]
          18. metadata-evalN/A

            \[\leadsto \mathsf{fma}\left(x \cdot x, \frac{-6450306886639899}{50000000000000000} \cdot x, \frac{238732414637843}{250000000000000} \cdot {\left(\mathsf{neg}\left(x\right)\right)}^{\color{blue}{1}}\right) \]
          19. unpow1N/A

            \[\leadsto \mathsf{fma}\left(x \cdot x, \frac{-6450306886639899}{50000000000000000} \cdot x, \frac{238732414637843}{250000000000000} \cdot \color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right) \]
          20. distribute-rgt-neg-inN/A

            \[\leadsto \mathsf{fma}\left(x \cdot x, \frac{-6450306886639899}{50000000000000000} \cdot x, \color{blue}{\mathsf{neg}\left(\frac{238732414637843}{250000000000000} \cdot x\right)}\right) \]
          21. distribute-lft-neg-inN/A

            \[\leadsto \mathsf{fma}\left(x \cdot x, \frac{-6450306886639899}{50000000000000000} \cdot x, \color{blue}{\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right) \cdot x}\right) \]
          22. lower-*.f64N/A

            \[\leadsto \mathsf{fma}\left(x \cdot x, \frac{-6450306886639899}{50000000000000000} \cdot x, \color{blue}{\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right) \cdot x}\right) \]
          23. metadata-eval96.1

            \[\leadsto \mathsf{fma}\left(x \cdot x, -0.12900613773279798 \cdot x, \color{blue}{-0.954929658551372} \cdot x\right) \]
        4. Applied rewrites96.1%

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

          \[\leadsto \color{blue}{\frac{-238732414637843}{250000000000000} \cdot x} \]
        6. Step-by-step derivation
          1. remove-double-negN/A

            \[\leadsto \frac{-238732414637843}{250000000000000} \cdot \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right)} \]
          2. mul-1-negN/A

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

            \[\leadsto \frac{-238732414637843}{250000000000000} \cdot \left(\mathsf{neg}\left(\color{blue}{x \cdot -1}\right)\right) \]
          4. distribute-rgt-neg-inN/A

            \[\leadsto \frac{-238732414637843}{250000000000000} \cdot \color{blue}{\left(x \cdot \left(\mathsf{neg}\left(-1\right)\right)\right)} \]
          5. metadata-evalN/A

            \[\leadsto \frac{-238732414637843}{250000000000000} \cdot \left(x \cdot \color{blue}{1}\right) \]
          6. lft-mult-inverseN/A

            \[\leadsto \frac{-238732414637843}{250000000000000} \cdot \left(x \cdot \color{blue}{\left(\frac{1}{{x}^{2}} \cdot {x}^{2}\right)}\right) \]
          7. associate-*l/N/A

            \[\leadsto \frac{-238732414637843}{250000000000000} \cdot \left(x \cdot \color{blue}{\frac{1 \cdot {x}^{2}}{{x}^{2}}}\right) \]
          8. metadata-evalN/A

            \[\leadsto \frac{-238732414637843}{250000000000000} \cdot \left(x \cdot \frac{\color{blue}{\left(\mathsf{neg}\left(-1\right)\right)} \cdot {x}^{2}}{{x}^{2}}\right) \]
          9. distribute-lft-neg-inN/A

            \[\leadsto \frac{-238732414637843}{250000000000000} \cdot \left(x \cdot \frac{\color{blue}{\mathsf{neg}\left(-1 \cdot {x}^{2}\right)}}{{x}^{2}}\right) \]
          10. mul-1-negN/A

            \[\leadsto \frac{-238732414637843}{250000000000000} \cdot \left(x \cdot \frac{\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left({x}^{2}\right)\right)}\right)}{{x}^{2}}\right) \]
          11. remove-double-negN/A

            \[\leadsto \frac{-238732414637843}{250000000000000} \cdot \left(x \cdot \frac{\color{blue}{{x}^{2}}}{{x}^{2}}\right) \]
          12. associate-/l*N/A

            \[\leadsto \frac{-238732414637843}{250000000000000} \cdot \color{blue}{\frac{x \cdot {x}^{2}}{{x}^{2}}} \]
          13. unpow2N/A

            \[\leadsto \frac{-238732414637843}{250000000000000} \cdot \frac{x \cdot \color{blue}{\left(x \cdot x\right)}}{{x}^{2}} \]
          14. cube-multN/A

            \[\leadsto \frac{-238732414637843}{250000000000000} \cdot \frac{\color{blue}{{x}^{3}}}{{x}^{2}} \]
          15. associate-*r/N/A

            \[\leadsto \color{blue}{\frac{\frac{-238732414637843}{250000000000000} \cdot {x}^{3}}{{x}^{2}}} \]
          16. associate-*l/N/A

            \[\leadsto \color{blue}{\frac{\frac{-238732414637843}{250000000000000}}{{x}^{2}} \cdot {x}^{3}} \]
          17. metadata-evalN/A

            \[\leadsto \frac{\color{blue}{\frac{-238732414637843}{250000000000000} \cdot 1}}{{x}^{2}} \cdot {x}^{3} \]
          18. associate-*r/N/A

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

            \[\leadsto \left(\color{blue}{\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right)} \cdot \frac{1}{{x}^{2}}\right) \cdot {x}^{3} \]
          20. unpow3N/A

            \[\leadsto \left(\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right) \cdot \frac{1}{{x}^{2}}\right) \cdot \color{blue}{\left(\left(x \cdot x\right) \cdot x\right)} \]
          21. unpow2N/A

            \[\leadsto \left(\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right) \cdot \frac{1}{{x}^{2}}\right) \cdot \left(\color{blue}{{x}^{2}} \cdot x\right) \]
          22. associate-*r*N/A

            \[\leadsto \color{blue}{\left(\left(\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right) \cdot \frac{1}{{x}^{2}}\right) \cdot {x}^{2}\right) \cdot x} \]
          23. lower-*.f64N/A

            \[\leadsto \color{blue}{\left(\left(\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right) \cdot \frac{1}{{x}^{2}}\right) \cdot {x}^{2}\right) \cdot x} \]
        7. Applied rewrites6.3%

          \[\leadsto \color{blue}{-0.954929658551372 \cdot x} \]

        if -0.20000000000000001 < (-.f64 (*.f64 #s(literal 238732414637843/250000000000000 binary64) x) (*.f64 #s(literal 6450306886639899/50000000000000000 binary64) (*.f64 (*.f64 x x) x)))

        1. Initial program 99.8%

          \[0.954929658551372 \cdot x - 0.12900613773279798 \cdot \left(\left(x \cdot x\right) \cdot x\right) \]
        2. Add Preprocessing
        3. Taylor expanded in x around 0

          \[\leadsto \color{blue}{\frac{238732414637843}{250000000000000} \cdot x} \]
        4. Step-by-step derivation
          1. remove-double-negN/A

            \[\leadsto \frac{238732414637843}{250000000000000} \cdot \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right)} \]
          2. distribute-rgt-neg-outN/A

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

            \[\leadsto \mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(x\right)\right) \cdot \frac{238732414637843}{250000000000000}}\right) \]
          4. distribute-lft-neg-outN/A

            \[\leadsto \mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(x \cdot \frac{238732414637843}{250000000000000}\right)\right)}\right) \]
          5. distribute-rgt-neg-inN/A

            \[\leadsto \mathsf{neg}\left(\color{blue}{x \cdot \left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right)}\right) \]
          6. *-commutativeN/A

            \[\leadsto \mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right) \cdot x}\right) \]
          7. distribute-rgt-neg-outN/A

            \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right) \cdot \left(\mathsf{neg}\left(x\right)\right)} \]
          8. metadata-evalN/A

            \[\leadsto \color{blue}{\frac{-238732414637843}{250000000000000}} \cdot \left(\mathsf{neg}\left(x\right)\right) \]
          9. metadata-evalN/A

            \[\leadsto \color{blue}{\left(\frac{-238732414637843}{250000000000000} \cdot 1\right)} \cdot \left(\mathsf{neg}\left(x\right)\right) \]
          10. metadata-evalN/A

            \[\leadsto \left(\color{blue}{\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right)} \cdot 1\right) \cdot \left(\mathsf{neg}\left(x\right)\right) \]
          11. lft-mult-inverseN/A

            \[\leadsto \left(\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right) \cdot \color{blue}{\left(\frac{1}{{x}^{2}} \cdot {x}^{2}\right)}\right) \cdot \left(\mathsf{neg}\left(x\right)\right) \]
          12. associate-*l*N/A

            \[\leadsto \color{blue}{\left(\left(\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right) \cdot \frac{1}{{x}^{2}}\right) \cdot {x}^{2}\right)} \cdot \left(\mathsf{neg}\left(x\right)\right) \]
          13. *-commutativeN/A

            \[\leadsto \left(\color{blue}{\left(\frac{1}{{x}^{2}} \cdot \left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right)\right)} \cdot {x}^{2}\right) \cdot \left(\mathsf{neg}\left(x\right)\right) \]
          14. associate-*l*N/A

            \[\leadsto \color{blue}{\left(\frac{1}{{x}^{2}} \cdot \left(\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right) \cdot {x}^{2}\right)\right)} \cdot \left(\mathsf{neg}\left(x\right)\right) \]
          15. associate-*l/N/A

            \[\leadsto \color{blue}{\frac{1 \cdot \left(\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right) \cdot {x}^{2}\right)}{{x}^{2}}} \cdot \left(\mathsf{neg}\left(x\right)\right) \]
          16. *-lft-identityN/A

            \[\leadsto \frac{\color{blue}{\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right) \cdot {x}^{2}}}{{x}^{2}} \cdot \left(\mathsf{neg}\left(x\right)\right) \]
          17. *-lft-identityN/A

            \[\leadsto \frac{\color{blue}{1 \cdot \left(\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right) \cdot {x}^{2}\right)}}{{x}^{2}} \cdot \left(\mathsf{neg}\left(x\right)\right) \]
          18. associate-*l/N/A

            \[\leadsto \color{blue}{\left(\frac{1}{{x}^{2}} \cdot \left(\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right) \cdot {x}^{2}\right)\right)} \cdot \left(\mathsf{neg}\left(x\right)\right) \]
          19. associate-*l*N/A

            \[\leadsto \color{blue}{\left(\left(\frac{1}{{x}^{2}} \cdot \left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right)\right) \cdot {x}^{2}\right)} \cdot \left(\mathsf{neg}\left(x\right)\right) \]
          20. *-commutativeN/A

            \[\leadsto \left(\color{blue}{\left(\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right) \cdot \frac{1}{{x}^{2}}\right)} \cdot {x}^{2}\right) \cdot \left(\mathsf{neg}\left(x\right)\right) \]
          21. distribute-rgt-neg-inN/A

            \[\leadsto \color{blue}{\mathsf{neg}\left(\left(\left(\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right) \cdot \frac{1}{{x}^{2}}\right) \cdot {x}^{2}\right) \cdot x\right)} \]
        5. Applied rewrites66.8%

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

      Alternative 6: 99.8% accurate, 1.4× speedup?

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

        \[0.954929658551372 \cdot x - 0.12900613773279798 \cdot \left(\left(x \cdot x\right) \cdot x\right) \]
      2. Add Preprocessing
      3. Taylor expanded in x around 0

        \[\leadsto \color{blue}{x \cdot \left(\frac{238732414637843}{250000000000000} + \frac{-6450306886639899}{50000000000000000} \cdot {x}^{2}\right)} \]
      4. Applied rewrites99.8%

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

      Alternative 7: 5.0% accurate, 4.0× speedup?

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

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

          \[\leadsto \color{blue}{\frac{238732414637843}{250000000000000} \cdot x - \frac{6450306886639899}{50000000000000000} \cdot \left(\left(x \cdot x\right) \cdot x\right)} \]
        2. lift-*.f64N/A

          \[\leadsto \frac{238732414637843}{250000000000000} \cdot x - \color{blue}{\frac{6450306886639899}{50000000000000000} \cdot \left(\left(x \cdot x\right) \cdot x\right)} \]
        3. fp-cancel-sub-sign-invN/A

          \[\leadsto \color{blue}{\frac{238732414637843}{250000000000000} \cdot x + \left(\mathsf{neg}\left(\frac{6450306886639899}{50000000000000000}\right)\right) \cdot \left(\left(x \cdot x\right) \cdot x\right)} \]
        4. +-commutativeN/A

          \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\frac{6450306886639899}{50000000000000000}\right)\right) \cdot \left(\left(x \cdot x\right) \cdot x\right) + \frac{238732414637843}{250000000000000} \cdot x} \]
        5. lift-*.f64N/A

          \[\leadsto \left(\mathsf{neg}\left(\frac{6450306886639899}{50000000000000000}\right)\right) \cdot \color{blue}{\left(\left(x \cdot x\right) \cdot x\right)} + \frac{238732414637843}{250000000000000} \cdot x \]
        6. *-commutativeN/A

          \[\leadsto \left(\mathsf{neg}\left(\frac{6450306886639899}{50000000000000000}\right)\right) \cdot \color{blue}{\left(x \cdot \left(x \cdot x\right)\right)} + \frac{238732414637843}{250000000000000} \cdot x \]
        7. associate-*r*N/A

          \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(\frac{6450306886639899}{50000000000000000}\right)\right) \cdot x\right) \cdot \left(x \cdot x\right)} + \frac{238732414637843}{250000000000000} \cdot x \]
        8. *-commutativeN/A

          \[\leadsto \color{blue}{\left(x \cdot x\right) \cdot \left(\left(\mathsf{neg}\left(\frac{6450306886639899}{50000000000000000}\right)\right) \cdot x\right)} + \frac{238732414637843}{250000000000000} \cdot x \]
        9. lower-fma.f64N/A

          \[\leadsto \color{blue}{\mathsf{fma}\left(x \cdot x, \left(\mathsf{neg}\left(\frac{6450306886639899}{50000000000000000}\right)\right) \cdot x, \frac{238732414637843}{250000000000000} \cdot x\right)} \]
        10. lower-*.f64N/A

          \[\leadsto \mathsf{fma}\left(x \cdot x, \color{blue}{\left(\mathsf{neg}\left(\frac{6450306886639899}{50000000000000000}\right)\right) \cdot x}, \frac{238732414637843}{250000000000000} \cdot x\right) \]
        11. metadata-eval99.8

          \[\leadsto \mathsf{fma}\left(x \cdot x, \color{blue}{-0.12900613773279798} \cdot x, 0.954929658551372 \cdot x\right) \]
        12. lift-*.f64N/A

          \[\leadsto \mathsf{fma}\left(x \cdot x, \frac{-6450306886639899}{50000000000000000} \cdot x, \color{blue}{\frac{238732414637843}{250000000000000} \cdot x}\right) \]
        13. rem-square-sqrtN/A

          \[\leadsto \mathsf{fma}\left(x \cdot x, \frac{-6450306886639899}{50000000000000000} \cdot x, \frac{238732414637843}{250000000000000} \cdot \color{blue}{\left(\sqrt{x} \cdot \sqrt{x}\right)}\right) \]
        14. sqrt-prodN/A

          \[\leadsto \mathsf{fma}\left(x \cdot x, \frac{-6450306886639899}{50000000000000000} \cdot x, \frac{238732414637843}{250000000000000} \cdot \color{blue}{\sqrt{x \cdot x}}\right) \]
        15. sqr-neg-revN/A

          \[\leadsto \mathsf{fma}\left(x \cdot x, \frac{-6450306886639899}{50000000000000000} \cdot x, \frac{238732414637843}{250000000000000} \cdot \sqrt{\color{blue}{\left(\mathsf{neg}\left(x\right)\right) \cdot \left(\mathsf{neg}\left(x\right)\right)}}\right) \]
        16. pow2N/A

          \[\leadsto \mathsf{fma}\left(x \cdot x, \frac{-6450306886639899}{50000000000000000} \cdot x, \frac{238732414637843}{250000000000000} \cdot \sqrt{\color{blue}{{\left(\mathsf{neg}\left(x\right)\right)}^{2}}}\right) \]
        17. sqrt-pow1N/A

          \[\leadsto \mathsf{fma}\left(x \cdot x, \frac{-6450306886639899}{50000000000000000} \cdot x, \frac{238732414637843}{250000000000000} \cdot \color{blue}{{\left(\mathsf{neg}\left(x\right)\right)}^{\left(\frac{2}{2}\right)}}\right) \]
        18. metadata-evalN/A

          \[\leadsto \mathsf{fma}\left(x \cdot x, \frac{-6450306886639899}{50000000000000000} \cdot x, \frac{238732414637843}{250000000000000} \cdot {\left(\mathsf{neg}\left(x\right)\right)}^{\color{blue}{1}}\right) \]
        19. unpow1N/A

          \[\leadsto \mathsf{fma}\left(x \cdot x, \frac{-6450306886639899}{50000000000000000} \cdot x, \frac{238732414637843}{250000000000000} \cdot \color{blue}{\left(\mathsf{neg}\left(x\right)\right)}\right) \]
        20. distribute-rgt-neg-inN/A

          \[\leadsto \mathsf{fma}\left(x \cdot x, \frac{-6450306886639899}{50000000000000000} \cdot x, \color{blue}{\mathsf{neg}\left(\frac{238732414637843}{250000000000000} \cdot x\right)}\right) \]
        21. distribute-lft-neg-inN/A

          \[\leadsto \mathsf{fma}\left(x \cdot x, \frac{-6450306886639899}{50000000000000000} \cdot x, \color{blue}{\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right) \cdot x}\right) \]
        22. lower-*.f64N/A

          \[\leadsto \mathsf{fma}\left(x \cdot x, \frac{-6450306886639899}{50000000000000000} \cdot x, \color{blue}{\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right) \cdot x}\right) \]
        23. metadata-eval48.4

          \[\leadsto \mathsf{fma}\left(x \cdot x, -0.12900613773279798 \cdot x, \color{blue}{-0.954929658551372} \cdot x\right) \]
      4. Applied rewrites48.4%

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

        \[\leadsto \color{blue}{\frac{-238732414637843}{250000000000000} \cdot x} \]
      6. Step-by-step derivation
        1. remove-double-negN/A

          \[\leadsto \frac{-238732414637843}{250000000000000} \cdot \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right)} \]
        2. mul-1-negN/A

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

          \[\leadsto \frac{-238732414637843}{250000000000000} \cdot \left(\mathsf{neg}\left(\color{blue}{x \cdot -1}\right)\right) \]
        4. distribute-rgt-neg-inN/A

          \[\leadsto \frac{-238732414637843}{250000000000000} \cdot \color{blue}{\left(x \cdot \left(\mathsf{neg}\left(-1\right)\right)\right)} \]
        5. metadata-evalN/A

          \[\leadsto \frac{-238732414637843}{250000000000000} \cdot \left(x \cdot \color{blue}{1}\right) \]
        6. lft-mult-inverseN/A

          \[\leadsto \frac{-238732414637843}{250000000000000} \cdot \left(x \cdot \color{blue}{\left(\frac{1}{{x}^{2}} \cdot {x}^{2}\right)}\right) \]
        7. associate-*l/N/A

          \[\leadsto \frac{-238732414637843}{250000000000000} \cdot \left(x \cdot \color{blue}{\frac{1 \cdot {x}^{2}}{{x}^{2}}}\right) \]
        8. metadata-evalN/A

          \[\leadsto \frac{-238732414637843}{250000000000000} \cdot \left(x \cdot \frac{\color{blue}{\left(\mathsf{neg}\left(-1\right)\right)} \cdot {x}^{2}}{{x}^{2}}\right) \]
        9. distribute-lft-neg-inN/A

          \[\leadsto \frac{-238732414637843}{250000000000000} \cdot \left(x \cdot \frac{\color{blue}{\mathsf{neg}\left(-1 \cdot {x}^{2}\right)}}{{x}^{2}}\right) \]
        10. mul-1-negN/A

          \[\leadsto \frac{-238732414637843}{250000000000000} \cdot \left(x \cdot \frac{\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left({x}^{2}\right)\right)}\right)}{{x}^{2}}\right) \]
        11. remove-double-negN/A

          \[\leadsto \frac{-238732414637843}{250000000000000} \cdot \left(x \cdot \frac{\color{blue}{{x}^{2}}}{{x}^{2}}\right) \]
        12. associate-/l*N/A

          \[\leadsto \frac{-238732414637843}{250000000000000} \cdot \color{blue}{\frac{x \cdot {x}^{2}}{{x}^{2}}} \]
        13. unpow2N/A

          \[\leadsto \frac{-238732414637843}{250000000000000} \cdot \frac{x \cdot \color{blue}{\left(x \cdot x\right)}}{{x}^{2}} \]
        14. cube-multN/A

          \[\leadsto \frac{-238732414637843}{250000000000000} \cdot \frac{\color{blue}{{x}^{3}}}{{x}^{2}} \]
        15. associate-*r/N/A

          \[\leadsto \color{blue}{\frac{\frac{-238732414637843}{250000000000000} \cdot {x}^{3}}{{x}^{2}}} \]
        16. associate-*l/N/A

          \[\leadsto \color{blue}{\frac{\frac{-238732414637843}{250000000000000}}{{x}^{2}} \cdot {x}^{3}} \]
        17. metadata-evalN/A

          \[\leadsto \frac{\color{blue}{\frac{-238732414637843}{250000000000000} \cdot 1}}{{x}^{2}} \cdot {x}^{3} \]
        18. associate-*r/N/A

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

          \[\leadsto \left(\color{blue}{\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right)} \cdot \frac{1}{{x}^{2}}\right) \cdot {x}^{3} \]
        20. unpow3N/A

          \[\leadsto \left(\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right) \cdot \frac{1}{{x}^{2}}\right) \cdot \color{blue}{\left(\left(x \cdot x\right) \cdot x\right)} \]
        21. unpow2N/A

          \[\leadsto \left(\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right) \cdot \frac{1}{{x}^{2}}\right) \cdot \left(\color{blue}{{x}^{2}} \cdot x\right) \]
        22. associate-*r*N/A

          \[\leadsto \color{blue}{\left(\left(\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right) \cdot \frac{1}{{x}^{2}}\right) \cdot {x}^{2}\right) \cdot x} \]
        23. lower-*.f64N/A

          \[\leadsto \color{blue}{\left(\left(\left(\mathsf{neg}\left(\frac{238732414637843}{250000000000000}\right)\right) \cdot \frac{1}{{x}^{2}}\right) \cdot {x}^{2}\right) \cdot x} \]
      7. Applied rewrites5.0%

        \[\leadsto \color{blue}{-0.954929658551372 \cdot x} \]
      8. Add Preprocessing

      Reproduce

      ?
      herbie shell --seed 2024326 
      (FPCore (x)
        :name "Rosa's Benchmark"
        :precision binary64
        (- (* 0.954929658551372 x) (* 0.12900613773279798 (* (* x x) x))))