Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, E

Percentage Accurate: 99.9% → 99.9%
Time: 9.2s
Alternatives: 9
Speedup: 1.0×

Specification

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

\\
\left(1 - x\right) + y \cdot \sqrt{x}
\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 9 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} \\ \left(1 - x\right) + y \cdot \sqrt{x} \end{array} \]
(FPCore (x y) :precision binary64 (+ (- 1.0 x) (* y (sqrt x))))
double code(double x, double y) {
	return (1.0 - x) + (y * sqrt(x));
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = (1.0d0 - x) + (y * sqrt(x))
end function
public static double code(double x, double y) {
	return (1.0 - x) + (y * Math.sqrt(x));
}
def code(x, y):
	return (1.0 - x) + (y * math.sqrt(x))
function code(x, y)
	return Float64(Float64(1.0 - x) + Float64(y * sqrt(x)))
end
function tmp = code(x, y)
	tmp = (1.0 - x) + (y * sqrt(x));
end
code[x_, y_] := N[(N[(1.0 - x), $MachinePrecision] + N[(y * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(1 - x\right) + y \cdot \sqrt{x}
\end{array}

Alternative 1: 99.9% accurate, 1.0× speedup?

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

\\
\left(1 - x\right) + y \cdot \sqrt{x}
\end{array}
Derivation
  1. Initial program 99.9%

    \[\left(1 - x\right) + y \cdot \sqrt{x} \]
  2. Add Preprocessing
  3. Add Preprocessing

Alternative 2: 95.1% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
t_0 := 1 + y \cdot \sqrt{x}\\
\mathbf{if}\;y \leq -6.8 \cdot 10^{+46}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y \leq 2.3 \cdot 10^{+49}:\\
\;\;\;\;1 - x\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -6.7999999999999996e46 or 2.30000000000000002e49 < y

    1. Initial program 99.8%

      \[\left(1 - x\right) + y \cdot \sqrt{x} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{1 + \sqrt{x} \cdot y} \]
    4. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(1, \color{blue}{\left(\sqrt{x} \cdot y\right)}\right) \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left(\sqrt{x}\right), \color{blue}{y}\right)\right) \]
      3. sqrt-lowering-sqrt.f6494.0%

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(x\right), y\right)\right) \]
    5. Simplified94.0%

      \[\leadsto \color{blue}{1 + \sqrt{x} \cdot y} \]

    if -6.7999999999999996e46 < y < 2.30000000000000002e49

    1. Initial program 100.0%

      \[\left(1 - x\right) + y \cdot \sqrt{x} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0

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

        \[\leadsto \mathsf{\_.f64}\left(1, \color{blue}{x}\right) \]
    5. Simplified98.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -6.8 \cdot 10^{+46}:\\ \;\;\;\;1 + y \cdot \sqrt{x}\\ \mathbf{elif}\;y \leq 2.3 \cdot 10^{+49}:\\ \;\;\;\;1 - x\\ \mathbf{else}:\\ \;\;\;\;1 + y \cdot \sqrt{x}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 92.3% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
t_0 := y \cdot \sqrt{x}\\
\mathbf{if}\;y \leq -2.8 \cdot 10^{+48}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y \leq 5.4 \cdot 10^{+76}:\\
\;\;\;\;1 - x\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -2.80000000000000012e48 or 5.3999999999999998e76 < y

    1. Initial program 99.7%

      \[\left(1 - x\right) + y \cdot \sqrt{x} \]
    2. Add Preprocessing
    3. Taylor expanded in y around inf

      \[\leadsto \color{blue}{\sqrt{x} \cdot y} \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\sqrt{x}\right), \color{blue}{y}\right) \]
      2. sqrt-lowering-sqrt.f6490.3%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(x\right), y\right) \]
    5. Simplified90.3%

      \[\leadsto \color{blue}{\sqrt{x} \cdot y} \]

    if -2.80000000000000012e48 < y < 5.3999999999999998e76

    1. Initial program 100.0%

      \[\left(1 - x\right) + y \cdot \sqrt{x} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0

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

        \[\leadsto \mathsf{\_.f64}\left(1, \color{blue}{x}\right) \]
    5. Simplified96.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.8 \cdot 10^{+48}:\\ \;\;\;\;y \cdot \sqrt{x}\\ \mathbf{elif}\;y \leq 5.4 \cdot 10^{+76}:\\ \;\;\;\;1 - x\\ \mathbf{else}:\\ \;\;\;\;y \cdot \sqrt{x}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 98.8% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
t_0 := y \cdot \sqrt{x}\\
\mathbf{if}\;x \leq 0.0042:\\
\;\;\;\;1 + t\_0\\

\mathbf{else}:\\
\;\;\;\;t\_0 - x\\


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

    1. Initial program 99.9%

      \[\left(1 - x\right) + y \cdot \sqrt{x} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{1 + \sqrt{x} \cdot y} \]
    4. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(1, \color{blue}{\left(\sqrt{x} \cdot y\right)}\right) \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left(\sqrt{x}\right), \color{blue}{y}\right)\right) \]
      3. sqrt-lowering-sqrt.f6498.9%

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(x\right), y\right)\right) \]
    5. Simplified98.9%

      \[\leadsto \color{blue}{1 + \sqrt{x} \cdot y} \]

    if 0.00419999999999999974 < x

    1. Initial program 99.9%

      \[\left(1 - x\right) + y \cdot \sqrt{x} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{\_.f64}\left(1, x\right), \left(\sqrt{x} \cdot \color{blue}{y}\right)\right) \]
      2. pow1/2N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{\_.f64}\left(1, x\right), \left({x}^{\frac{1}{2}} \cdot y\right)\right) \]
      3. sqr-powN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{\_.f64}\left(1, x\right), \left(\left({x}^{\left(\frac{\frac{1}{2}}{2}\right)} \cdot {x}^{\left(\frac{\frac{1}{2}}{2}\right)}\right) \cdot y\right)\right) \]
      4. associate-*l*N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{\_.f64}\left(1, x\right), \left({x}^{\left(\frac{\frac{1}{2}}{2}\right)} \cdot \color{blue}{\left({x}^{\left(\frac{\frac{1}{2}}{2}\right)} \cdot y\right)}\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{\_.f64}\left(1, x\right), \mathsf{*.f64}\left(\left({x}^{\left(\frac{\frac{1}{2}}{2}\right)}\right), \color{blue}{\left({x}^{\left(\frac{\frac{1}{2}}{2}\right)} \cdot y\right)}\right)\right) \]
      6. pow-lowering-pow.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{\_.f64}\left(1, x\right), \mathsf{*.f64}\left(\mathsf{pow.f64}\left(x, \left(\frac{\frac{1}{2}}{2}\right)\right), \left(\color{blue}{{x}^{\left(\frac{\frac{1}{2}}{2}\right)}} \cdot y\right)\right)\right) \]
      7. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{\_.f64}\left(1, x\right), \mathsf{*.f64}\left(\mathsf{pow.f64}\left(x, \frac{1}{4}\right), \left({x}^{\color{blue}{\left(\frac{\frac{1}{2}}{2}\right)}} \cdot y\right)\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{\_.f64}\left(1, x\right), \mathsf{*.f64}\left(\mathsf{pow.f64}\left(x, \frac{1}{4}\right), \mathsf{*.f64}\left(\left({x}^{\left(\frac{\frac{1}{2}}{2}\right)}\right), \color{blue}{y}\right)\right)\right) \]
      9. pow-lowering-pow.f64N/A

        \[\leadsto \mathsf{+.f64}\left(\mathsf{\_.f64}\left(1, x\right), \mathsf{*.f64}\left(\mathsf{pow.f64}\left(x, \frac{1}{4}\right), \mathsf{*.f64}\left(\mathsf{pow.f64}\left(x, \left(\frac{\frac{1}{2}}{2}\right)\right), y\right)\right)\right) \]
      10. metadata-eval99.7%

        \[\leadsto \mathsf{+.f64}\left(\mathsf{\_.f64}\left(1, x\right), \mathsf{*.f64}\left(\mathsf{pow.f64}\left(x, \frac{1}{4}\right), \mathsf{*.f64}\left(\mathsf{pow.f64}\left(x, \frac{1}{4}\right), y\right)\right)\right) \]
    4. Applied egg-rr99.7%

      \[\leadsto \left(1 - x\right) + \color{blue}{{x}^{0.25} \cdot \left({x}^{0.25} \cdot y\right)} \]
    5. Taylor expanded in x around inf

      \[\leadsto \color{blue}{x \cdot \left(\sqrt{\frac{1}{x}} \cdot y - 1\right)} \]
    6. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{\left(\sqrt{\frac{1}{x}} \cdot y - 1\right)}\right) \]
      2. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(\sqrt{\frac{1}{x}} \cdot y + \color{blue}{\left(\mathsf{neg}\left(1\right)\right)}\right)\right) \]
      3. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(\sqrt{\frac{1}{x}} \cdot y + -1\right)\right) \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\left(\sqrt{\frac{1}{x}} \cdot y\right), \color{blue}{-1}\right)\right) \]
      5. *-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\left(y \cdot \sqrt{\frac{1}{x}}\right), -1\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, \left(\sqrt{\frac{1}{x}}\right)\right), -1\right)\right) \]
      7. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, \mathsf{sqrt.f64}\left(\left(\frac{1}{x}\right)\right)\right), -1\right)\right) \]
      8. /-lowering-/.f6499.3%

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, \mathsf{sqrt.f64}\left(\mathsf{/.f64}\left(1, x\right)\right)\right), -1\right)\right) \]
    7. Simplified99.3%

      \[\leadsto \color{blue}{x \cdot \left(y \cdot \sqrt{\frac{1}{x}} + -1\right)} \]
    8. Taylor expanded in x around 0

      \[\leadsto \color{blue}{-1 \cdot x + \sqrt{x} \cdot y} \]
    9. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \sqrt{x} \cdot y + \color{blue}{-1 \cdot x} \]
      2. mul-1-negN/A

        \[\leadsto \sqrt{x} \cdot y + \left(\mathsf{neg}\left(x\right)\right) \]
      3. sub-negN/A

        \[\leadsto \sqrt{x} \cdot y - \color{blue}{x} \]
      4. --lowering--.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\left(\sqrt{x} \cdot y\right), \color{blue}{x}\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\left(\sqrt{x}\right), y\right), x\right) \]
      6. sqrt-lowering-sqrt.f6499.5%

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sqrt.f64}\left(x\right), y\right), x\right) \]
    10. Simplified99.5%

      \[\leadsto \color{blue}{\sqrt{x} \cdot y - x} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 0.0042:\\ \;\;\;\;1 + y \cdot \sqrt{x}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \sqrt{x} - x\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 68.1% accurate, 6.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.15 \cdot 10^{+91}:\\
\;\;\;\;1 + x \cdot \left(-1 - y \cdot y\right)\\

\mathbf{elif}\;y \leq 1.8 \cdot 10^{+93}:\\
\;\;\;\;1 - x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -3.15e91

    1. Initial program 99.7%

      \[\left(1 - x\right) + y \cdot \sqrt{x} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto y \cdot \sqrt{x} + \color{blue}{\left(1 - x\right)} \]
      2. flip-+N/A

        \[\leadsto \frac{\left(y \cdot \sqrt{x}\right) \cdot \left(y \cdot \sqrt{x}\right) - \left(1 - x\right) \cdot \left(1 - x\right)}{\color{blue}{y \cdot \sqrt{x} - \left(1 - x\right)}} \]
      3. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{y \cdot \sqrt{x} - \left(1 - x\right)}{\left(y \cdot \sqrt{x}\right) \cdot \left(y \cdot \sqrt{x}\right) - \left(1 - x\right) \cdot \left(1 - x\right)}}} \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(\frac{y \cdot \sqrt{x} - \left(1 - x\right)}{\left(y \cdot \sqrt{x}\right) \cdot \left(y \cdot \sqrt{x}\right) - \left(1 - x\right) \cdot \left(1 - x\right)}\right)}\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(y \cdot \sqrt{x} - \left(1 - x\right)\right), \color{blue}{\left(\left(y \cdot \sqrt{x}\right) \cdot \left(y \cdot \sqrt{x}\right) - \left(1 - x\right) \cdot \left(1 - x\right)\right)}\right)\right) \]
      6. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\left(y \cdot \sqrt{x}\right), \left(1 - x\right)\right), \left(\color{blue}{\left(y \cdot \sqrt{x}\right) \cdot \left(y \cdot \sqrt{x}\right)} - \left(1 - x\right) \cdot \left(1 - x\right)\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(y, \left(\sqrt{x}\right)\right), \left(1 - x\right)\right), \left(\color{blue}{\left(y \cdot \sqrt{x}\right)} \cdot \left(y \cdot \sqrt{x}\right) - \left(1 - x\right) \cdot \left(1 - x\right)\right)\right)\right) \]
      8. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(y, \mathsf{sqrt.f64}\left(x\right)\right), \left(1 - x\right)\right), \left(\left(y \cdot \color{blue}{\sqrt{x}}\right) \cdot \left(y \cdot \sqrt{x}\right) - \left(1 - x\right) \cdot \left(1 - x\right)\right)\right)\right) \]
      9. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(y, \mathsf{sqrt.f64}\left(x\right)\right), \mathsf{\_.f64}\left(1, x\right)\right), \left(\left(y \cdot \sqrt{x}\right) \cdot \color{blue}{\left(y \cdot \sqrt{x}\right)} - \left(1 - x\right) \cdot \left(1 - x\right)\right)\right)\right) \]
      10. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(y, \mathsf{sqrt.f64}\left(x\right)\right), \mathsf{\_.f64}\left(1, x\right)\right), \mathsf{\_.f64}\left(\left(\left(y \cdot \sqrt{x}\right) \cdot \left(y \cdot \sqrt{x}\right)\right), \color{blue}{\left(\left(1 - x\right) \cdot \left(1 - x\right)\right)}\right)\right)\right) \]
      11. swap-sqrN/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(y, \mathsf{sqrt.f64}\left(x\right)\right), \mathsf{\_.f64}\left(1, x\right)\right), \mathsf{\_.f64}\left(\left(\left(y \cdot y\right) \cdot \left(\sqrt{x} \cdot \sqrt{x}\right)\right), \left(\color{blue}{\left(1 - x\right)} \cdot \left(1 - x\right)\right)\right)\right)\right) \]
      12. rem-square-sqrtN/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(y, \mathsf{sqrt.f64}\left(x\right)\right), \mathsf{\_.f64}\left(1, x\right)\right), \mathsf{\_.f64}\left(\left(\left(y \cdot y\right) \cdot x\right), \left(\left(1 - \color{blue}{x}\right) \cdot \left(1 - x\right)\right)\right)\right)\right) \]
      13. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(y, \mathsf{sqrt.f64}\left(x\right)\right), \mathsf{\_.f64}\left(1, x\right)\right), \mathsf{\_.f64}\left(\left(x \cdot \left(y \cdot y\right)\right), \left(\color{blue}{\left(1 - x\right)} \cdot \left(1 - x\right)\right)\right)\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(y, \mathsf{sqrt.f64}\left(x\right)\right), \mathsf{\_.f64}\left(1, x\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, \left(y \cdot y\right)\right), \left(\color{blue}{\left(1 - x\right)} \cdot \left(1 - x\right)\right)\right)\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(y, \mathsf{sqrt.f64}\left(x\right)\right), \mathsf{\_.f64}\left(1, x\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(y, y\right)\right), \left(\left(1 - \color{blue}{x}\right) \cdot \left(1 - x\right)\right)\right)\right)\right) \]
      16. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(y, \mathsf{sqrt.f64}\left(x\right)\right), \mathsf{\_.f64}\left(1, x\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(y, y\right)\right), \mathsf{*.f64}\left(\left(1 - x\right), \color{blue}{\left(1 - x\right)}\right)\right)\right)\right) \]
      17. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(y, \mathsf{sqrt.f64}\left(x\right)\right), \mathsf{\_.f64}\left(1, x\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(y, y\right)\right), \mathsf{*.f64}\left(\mathsf{\_.f64}\left(1, x\right), \left(\color{blue}{1} - x\right)\right)\right)\right)\right) \]
      18. --lowering--.f6435.5%

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(y, \mathsf{sqrt.f64}\left(x\right)\right), \mathsf{\_.f64}\left(1, x\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(y, y\right)\right), \mathsf{*.f64}\left(\mathsf{\_.f64}\left(1, x\right), \mathsf{\_.f64}\left(1, \color{blue}{x}\right)\right)\right)\right)\right) \]
    4. Applied egg-rr35.5%

      \[\leadsto \color{blue}{\frac{1}{\frac{y \cdot \sqrt{x} - \left(1 - x\right)}{x \cdot \left(y \cdot y\right) - \left(1 - x\right) \cdot \left(1 - x\right)}}} \]
    5. Taylor expanded in y around 0

      \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\color{blue}{\left(x - 1\right)}, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(y, y\right)\right), \mathsf{*.f64}\left(\mathsf{\_.f64}\left(1, x\right), \mathsf{\_.f64}\left(1, x\right)\right)\right)\right)\right) \]
    6. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(x + \left(\mathsf{neg}\left(1\right)\right)\right), \mathsf{\_.f64}\left(\color{blue}{\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(y, y\right)\right)}, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(1, x\right), \mathsf{\_.f64}\left(1, x\right)\right)\right)\right)\right) \]
      2. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(x + -1\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, \color{blue}{\mathsf{*.f64}\left(y, y\right)}\right), \mathsf{*.f64}\left(\mathsf{\_.f64}\left(1, x\right), \mathsf{\_.f64}\left(1, x\right)\right)\right)\right)\right) \]
      3. +-lowering-+.f645.2%

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(x, -1\right), \mathsf{\_.f64}\left(\color{blue}{\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(y, y\right)\right)}, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(1, x\right), \mathsf{\_.f64}\left(1, x\right)\right)\right)\right)\right) \]
    7. Simplified5.2%

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

      \[\leadsto \color{blue}{1 + x \cdot \left(1 + -1 \cdot \left(2 + {y}^{2}\right)\right)} \]
    9. Step-by-step derivation
      1. +-lowering-+.f64N/A

        \[\leadsto \mathsf{+.f64}\left(1, \color{blue}{\left(x \cdot \left(1 + -1 \cdot \left(2 + {y}^{2}\right)\right)\right)}\right) \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \color{blue}{\left(1 + -1 \cdot \left(2 + {y}^{2}\right)\right)}\right)\right) \]
      3. distribute-lft-inN/A

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \left(1 + \left(-1 \cdot 2 + \color{blue}{-1 \cdot {y}^{2}}\right)\right)\right)\right) \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \left(1 + \left(-2 + \color{blue}{-1} \cdot {y}^{2}\right)\right)\right)\right) \]
      5. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \left(1 + \left(\left(\mathsf{neg}\left(2\right)\right) + \color{blue}{-1} \cdot {y}^{2}\right)\right)\right)\right) \]
      6. associate-+r+N/A

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \left(\left(1 + \left(\mathsf{neg}\left(2\right)\right)\right) + \color{blue}{-1 \cdot {y}^{2}}\right)\right)\right) \]
      7. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \left(\left(1 + -2\right) + -1 \cdot {y}^{2}\right)\right)\right) \]
      8. metadata-evalN/A

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \left(-1 + \color{blue}{-1} \cdot {y}^{2}\right)\right)\right) \]
      9. mul-1-negN/A

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \left(-1 + \left(\mathsf{neg}\left({y}^{2}\right)\right)\right)\right)\right) \]
      10. unsub-negN/A

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \left(-1 - \color{blue}{{y}^{2}}\right)\right)\right) \]
      11. --lowering--.f64N/A

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{\_.f64}\left(-1, \color{blue}{\left({y}^{2}\right)}\right)\right)\right) \]
      12. unpow2N/A

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{\_.f64}\left(-1, \left(y \cdot \color{blue}{y}\right)\right)\right)\right) \]
      13. *-lowering-*.f6414.5%

        \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(x, \mathsf{\_.f64}\left(-1, \mathsf{*.f64}\left(y, \color{blue}{y}\right)\right)\right)\right) \]
    10. Simplified14.5%

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

    if -3.15e91 < y < 1.8e93

    1. Initial program 100.0%

      \[\left(1 - x\right) + y \cdot \sqrt{x} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0

      \[\leadsto \color{blue}{1 - x} \]
    4. Step-by-step derivation
      1. --lowering--.f6491.8%

        \[\leadsto \mathsf{\_.f64}\left(1, \color{blue}{x}\right) \]
    5. Simplified91.8%

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

    if 1.8e93 < y

    1. Initial program 99.7%

      \[\left(1 - x\right) + y \cdot \sqrt{x} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto y \cdot \sqrt{x} + \color{blue}{\left(1 - x\right)} \]
      2. flip-+N/A

        \[\leadsto \frac{\left(y \cdot \sqrt{x}\right) \cdot \left(y \cdot \sqrt{x}\right) - \left(1 - x\right) \cdot \left(1 - x\right)}{\color{blue}{y \cdot \sqrt{x} - \left(1 - x\right)}} \]
      3. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{y \cdot \sqrt{x} - \left(1 - x\right)}{\left(y \cdot \sqrt{x}\right) \cdot \left(y \cdot \sqrt{x}\right) - \left(1 - x\right) \cdot \left(1 - x\right)}}} \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(\frac{y \cdot \sqrt{x} - \left(1 - x\right)}{\left(y \cdot \sqrt{x}\right) \cdot \left(y \cdot \sqrt{x}\right) - \left(1 - x\right) \cdot \left(1 - x\right)}\right)}\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(y \cdot \sqrt{x} - \left(1 - x\right)\right), \color{blue}{\left(\left(y \cdot \sqrt{x}\right) \cdot \left(y \cdot \sqrt{x}\right) - \left(1 - x\right) \cdot \left(1 - x\right)\right)}\right)\right) \]
      6. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\left(y \cdot \sqrt{x}\right), \left(1 - x\right)\right), \left(\color{blue}{\left(y \cdot \sqrt{x}\right) \cdot \left(y \cdot \sqrt{x}\right)} - \left(1 - x\right) \cdot \left(1 - x\right)\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(y, \left(\sqrt{x}\right)\right), \left(1 - x\right)\right), \left(\color{blue}{\left(y \cdot \sqrt{x}\right)} \cdot \left(y \cdot \sqrt{x}\right) - \left(1 - x\right) \cdot \left(1 - x\right)\right)\right)\right) \]
      8. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(y, \mathsf{sqrt.f64}\left(x\right)\right), \left(1 - x\right)\right), \left(\left(y \cdot \color{blue}{\sqrt{x}}\right) \cdot \left(y \cdot \sqrt{x}\right) - \left(1 - x\right) \cdot \left(1 - x\right)\right)\right)\right) \]
      9. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(y, \mathsf{sqrt.f64}\left(x\right)\right), \mathsf{\_.f64}\left(1, x\right)\right), \left(\left(y \cdot \sqrt{x}\right) \cdot \color{blue}{\left(y \cdot \sqrt{x}\right)} - \left(1 - x\right) \cdot \left(1 - x\right)\right)\right)\right) \]
      10. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(y, \mathsf{sqrt.f64}\left(x\right)\right), \mathsf{\_.f64}\left(1, x\right)\right), \mathsf{\_.f64}\left(\left(\left(y \cdot \sqrt{x}\right) \cdot \left(y \cdot \sqrt{x}\right)\right), \color{blue}{\left(\left(1 - x\right) \cdot \left(1 - x\right)\right)}\right)\right)\right) \]
      11. swap-sqrN/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(y, \mathsf{sqrt.f64}\left(x\right)\right), \mathsf{\_.f64}\left(1, x\right)\right), \mathsf{\_.f64}\left(\left(\left(y \cdot y\right) \cdot \left(\sqrt{x} \cdot \sqrt{x}\right)\right), \left(\color{blue}{\left(1 - x\right)} \cdot \left(1 - x\right)\right)\right)\right)\right) \]
      12. rem-square-sqrtN/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(y, \mathsf{sqrt.f64}\left(x\right)\right), \mathsf{\_.f64}\left(1, x\right)\right), \mathsf{\_.f64}\left(\left(\left(y \cdot y\right) \cdot x\right), \left(\left(1 - \color{blue}{x}\right) \cdot \left(1 - x\right)\right)\right)\right)\right) \]
      13. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(y, \mathsf{sqrt.f64}\left(x\right)\right), \mathsf{\_.f64}\left(1, x\right)\right), \mathsf{\_.f64}\left(\left(x \cdot \left(y \cdot y\right)\right), \left(\color{blue}{\left(1 - x\right)} \cdot \left(1 - x\right)\right)\right)\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(y, \mathsf{sqrt.f64}\left(x\right)\right), \mathsf{\_.f64}\left(1, x\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, \left(y \cdot y\right)\right), \left(\color{blue}{\left(1 - x\right)} \cdot \left(1 - x\right)\right)\right)\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(y, \mathsf{sqrt.f64}\left(x\right)\right), \mathsf{\_.f64}\left(1, x\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(y, y\right)\right), \left(\left(1 - \color{blue}{x}\right) \cdot \left(1 - x\right)\right)\right)\right)\right) \]
      16. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(y, \mathsf{sqrt.f64}\left(x\right)\right), \mathsf{\_.f64}\left(1, x\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(y, y\right)\right), \mathsf{*.f64}\left(\left(1 - x\right), \color{blue}{\left(1 - x\right)}\right)\right)\right)\right) \]
      17. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(y, \mathsf{sqrt.f64}\left(x\right)\right), \mathsf{\_.f64}\left(1, x\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(y, y\right)\right), \mathsf{*.f64}\left(\mathsf{\_.f64}\left(1, x\right), \left(\color{blue}{1} - x\right)\right)\right)\right)\right) \]
      18. --lowering--.f6426.0%

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(y, \mathsf{sqrt.f64}\left(x\right)\right), \mathsf{\_.f64}\left(1, x\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(y, y\right)\right), \mathsf{*.f64}\left(\mathsf{\_.f64}\left(1, x\right), \mathsf{\_.f64}\left(1, \color{blue}{x}\right)\right)\right)\right)\right) \]
    4. Applied egg-rr26.0%

      \[\leadsto \color{blue}{\frac{1}{\frac{y \cdot \sqrt{x} - \left(1 - x\right)}{x \cdot \left(y \cdot y\right) - \left(1 - x\right) \cdot \left(1 - x\right)}}} \]
    5. Taylor expanded in y around 0

      \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\color{blue}{\left(x - 1\right)}, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(y, y\right)\right), \mathsf{*.f64}\left(\mathsf{\_.f64}\left(1, x\right), \mathsf{\_.f64}\left(1, x\right)\right)\right)\right)\right) \]
    6. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(x + \left(\mathsf{neg}\left(1\right)\right)\right), \mathsf{\_.f64}\left(\color{blue}{\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(y, y\right)\right)}, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(1, x\right), \mathsf{\_.f64}\left(1, x\right)\right)\right)\right)\right) \]
      2. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(x + -1\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, \color{blue}{\mathsf{*.f64}\left(y, y\right)}\right), \mathsf{*.f64}\left(\mathsf{\_.f64}\left(1, x\right), \mathsf{\_.f64}\left(1, x\right)\right)\right)\right)\right) \]
      3. +-lowering-+.f648.6%

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(x, -1\right), \mathsf{\_.f64}\left(\color{blue}{\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(y, y\right)\right)}, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(1, x\right), \mathsf{\_.f64}\left(1, x\right)\right)\right)\right)\right) \]
    7. Simplified8.6%

      \[\leadsto \frac{1}{\frac{\color{blue}{x + -1}}{x \cdot \left(y \cdot y\right) - \left(1 - x\right) \cdot \left(1 - x\right)}} \]
    8. Taylor expanded in x around inf

      \[\leadsto \color{blue}{x \cdot \left(\left(\frac{1}{x} + \frac{{y}^{2}}{x}\right) - 1\right)} \]
    9. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{\left(\left(\frac{1}{x} + \frac{{y}^{2}}{x}\right) - 1\right)}\right) \]
      2. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(\left(\frac{1}{x} + \frac{{y}^{2}}{x}\right) + \color{blue}{\left(\mathsf{neg}\left(1\right)\right)}\right)\right) \]
      3. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(\left(\frac{1}{x} + \frac{{y}^{2}}{x}\right) + -1\right)\right) \]
      4. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(-1 + \color{blue}{\left(\frac{1}{x} + \frac{{y}^{2}}{x}\right)}\right)\right) \]
      5. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(-1, \color{blue}{\left(\frac{1}{x} + \frac{{y}^{2}}{x}\right)}\right)\right) \]
      6. *-lft-identityN/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(-1, \left(\frac{1}{x} + 1 \cdot \color{blue}{\frac{{y}^{2}}{x}}\right)\right)\right) \]
      7. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(-1, \left(\frac{1}{x} + \left(\mathsf{neg}\left(-1\right)\right) \cdot \frac{\color{blue}{{y}^{2}}}{x}\right)\right)\right) \]
      8. cancel-sign-sub-invN/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(-1, \left(\frac{1}{x} - \color{blue}{-1 \cdot \frac{{y}^{2}}{x}}\right)\right)\right) \]
      9. associate-*r/N/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(-1, \left(\frac{1}{x} - \frac{-1 \cdot {y}^{2}}{\color{blue}{x}}\right)\right)\right) \]
      10. div-subN/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(-1, \left(\frac{1 - -1 \cdot {y}^{2}}{\color{blue}{x}}\right)\right)\right) \]
      11. cancel-sign-sub-invN/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(-1, \left(\frac{1 + \left(\mathsf{neg}\left(-1\right)\right) \cdot {y}^{2}}{x}\right)\right)\right) \]
      12. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(-1, \left(\frac{1 + 1 \cdot {y}^{2}}{x}\right)\right)\right) \]
      13. *-lft-identityN/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(-1, \left(\frac{1 + {y}^{2}}{x}\right)\right)\right) \]
      14. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(-1, \mathsf{/.f64}\left(\left(1 + {y}^{2}\right), \color{blue}{x}\right)\right)\right) \]
      15. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \left({y}^{2}\right)\right), x\right)\right)\right) \]
      16. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \left(y \cdot y\right)\right), x\right)\right)\right) \]
      17. *-lowering-*.f6424.1%

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(y, y\right)\right), x\right)\right)\right) \]
    10. Simplified24.1%

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

      \[\leadsto \color{blue}{1 + \left(-1 \cdot x + {y}^{2}\right)} \]
    12. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto 1 + \left(\left(\mathsf{neg}\left(x\right)\right) + {\color{blue}{y}}^{2}\right) \]
      2. associate-+r+N/A

        \[\leadsto \left(1 + \left(\mathsf{neg}\left(x\right)\right)\right) + \color{blue}{{y}^{2}} \]
      3. sub-negN/A

        \[\leadsto \left(1 - x\right) + {\color{blue}{y}}^{2} \]
      4. associate-+l-N/A

        \[\leadsto 1 - \color{blue}{\left(x - {y}^{2}\right)} \]
      5. --lowering--.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(1, \color{blue}{\left(x - {y}^{2}\right)}\right) \]
      6. --lowering--.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{\_.f64}\left(x, \color{blue}{\left({y}^{2}\right)}\right)\right) \]
      7. unpow2N/A

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{\_.f64}\left(x, \left(y \cdot \color{blue}{y}\right)\right)\right) \]
      8. *-lowering-*.f6424.2%

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{\_.f64}\left(x, \mathsf{*.f64}\left(y, \color{blue}{y}\right)\right)\right) \]
    13. Simplified24.2%

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

Alternative 6: 65.0% accurate, 8.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.8 \cdot 10^{+93}:\\
\;\;\;\;1 - x\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 1.8e93

    1. Initial program 99.9%

      \[\left(1 - x\right) + y \cdot \sqrt{x} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0

      \[\leadsto \color{blue}{1 - x} \]
    4. Step-by-step derivation
      1. --lowering--.f6474.0%

        \[\leadsto \mathsf{\_.f64}\left(1, \color{blue}{x}\right) \]
    5. Simplified74.0%

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

    if 1.8e93 < y

    1. Initial program 99.7%

      \[\left(1 - x\right) + y \cdot \sqrt{x} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto y \cdot \sqrt{x} + \color{blue}{\left(1 - x\right)} \]
      2. flip-+N/A

        \[\leadsto \frac{\left(y \cdot \sqrt{x}\right) \cdot \left(y \cdot \sqrt{x}\right) - \left(1 - x\right) \cdot \left(1 - x\right)}{\color{blue}{y \cdot \sqrt{x} - \left(1 - x\right)}} \]
      3. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{y \cdot \sqrt{x} - \left(1 - x\right)}{\left(y \cdot \sqrt{x}\right) \cdot \left(y \cdot \sqrt{x}\right) - \left(1 - x\right) \cdot \left(1 - x\right)}}} \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(\frac{y \cdot \sqrt{x} - \left(1 - x\right)}{\left(y \cdot \sqrt{x}\right) \cdot \left(y \cdot \sqrt{x}\right) - \left(1 - x\right) \cdot \left(1 - x\right)}\right)}\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(y \cdot \sqrt{x} - \left(1 - x\right)\right), \color{blue}{\left(\left(y \cdot \sqrt{x}\right) \cdot \left(y \cdot \sqrt{x}\right) - \left(1 - x\right) \cdot \left(1 - x\right)\right)}\right)\right) \]
      6. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\left(y \cdot \sqrt{x}\right), \left(1 - x\right)\right), \left(\color{blue}{\left(y \cdot \sqrt{x}\right) \cdot \left(y \cdot \sqrt{x}\right)} - \left(1 - x\right) \cdot \left(1 - x\right)\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(y, \left(\sqrt{x}\right)\right), \left(1 - x\right)\right), \left(\color{blue}{\left(y \cdot \sqrt{x}\right)} \cdot \left(y \cdot \sqrt{x}\right) - \left(1 - x\right) \cdot \left(1 - x\right)\right)\right)\right) \]
      8. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(y, \mathsf{sqrt.f64}\left(x\right)\right), \left(1 - x\right)\right), \left(\left(y \cdot \color{blue}{\sqrt{x}}\right) \cdot \left(y \cdot \sqrt{x}\right) - \left(1 - x\right) \cdot \left(1 - x\right)\right)\right)\right) \]
      9. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(y, \mathsf{sqrt.f64}\left(x\right)\right), \mathsf{\_.f64}\left(1, x\right)\right), \left(\left(y \cdot \sqrt{x}\right) \cdot \color{blue}{\left(y \cdot \sqrt{x}\right)} - \left(1 - x\right) \cdot \left(1 - x\right)\right)\right)\right) \]
      10. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(y, \mathsf{sqrt.f64}\left(x\right)\right), \mathsf{\_.f64}\left(1, x\right)\right), \mathsf{\_.f64}\left(\left(\left(y \cdot \sqrt{x}\right) \cdot \left(y \cdot \sqrt{x}\right)\right), \color{blue}{\left(\left(1 - x\right) \cdot \left(1 - x\right)\right)}\right)\right)\right) \]
      11. swap-sqrN/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(y, \mathsf{sqrt.f64}\left(x\right)\right), \mathsf{\_.f64}\left(1, x\right)\right), \mathsf{\_.f64}\left(\left(\left(y \cdot y\right) \cdot \left(\sqrt{x} \cdot \sqrt{x}\right)\right), \left(\color{blue}{\left(1 - x\right)} \cdot \left(1 - x\right)\right)\right)\right)\right) \]
      12. rem-square-sqrtN/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(y, \mathsf{sqrt.f64}\left(x\right)\right), \mathsf{\_.f64}\left(1, x\right)\right), \mathsf{\_.f64}\left(\left(\left(y \cdot y\right) \cdot x\right), \left(\left(1 - \color{blue}{x}\right) \cdot \left(1 - x\right)\right)\right)\right)\right) \]
      13. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(y, \mathsf{sqrt.f64}\left(x\right)\right), \mathsf{\_.f64}\left(1, x\right)\right), \mathsf{\_.f64}\left(\left(x \cdot \left(y \cdot y\right)\right), \left(\color{blue}{\left(1 - x\right)} \cdot \left(1 - x\right)\right)\right)\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(y, \mathsf{sqrt.f64}\left(x\right)\right), \mathsf{\_.f64}\left(1, x\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, \left(y \cdot y\right)\right), \left(\color{blue}{\left(1 - x\right)} \cdot \left(1 - x\right)\right)\right)\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(y, \mathsf{sqrt.f64}\left(x\right)\right), \mathsf{\_.f64}\left(1, x\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(y, y\right)\right), \left(\left(1 - \color{blue}{x}\right) \cdot \left(1 - x\right)\right)\right)\right)\right) \]
      16. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(y, \mathsf{sqrt.f64}\left(x\right)\right), \mathsf{\_.f64}\left(1, x\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(y, y\right)\right), \mathsf{*.f64}\left(\left(1 - x\right), \color{blue}{\left(1 - x\right)}\right)\right)\right)\right) \]
      17. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(y, \mathsf{sqrt.f64}\left(x\right)\right), \mathsf{\_.f64}\left(1, x\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(y, y\right)\right), \mathsf{*.f64}\left(\mathsf{\_.f64}\left(1, x\right), \left(\color{blue}{1} - x\right)\right)\right)\right)\right) \]
      18. --lowering--.f6426.0%

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(y, \mathsf{sqrt.f64}\left(x\right)\right), \mathsf{\_.f64}\left(1, x\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(y, y\right)\right), \mathsf{*.f64}\left(\mathsf{\_.f64}\left(1, x\right), \mathsf{\_.f64}\left(1, \color{blue}{x}\right)\right)\right)\right)\right) \]
    4. Applied egg-rr26.0%

      \[\leadsto \color{blue}{\frac{1}{\frac{y \cdot \sqrt{x} - \left(1 - x\right)}{x \cdot \left(y \cdot y\right) - \left(1 - x\right) \cdot \left(1 - x\right)}}} \]
    5. Taylor expanded in y around 0

      \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\color{blue}{\left(x - 1\right)}, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(y, y\right)\right), \mathsf{*.f64}\left(\mathsf{\_.f64}\left(1, x\right), \mathsf{\_.f64}\left(1, x\right)\right)\right)\right)\right) \]
    6. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(x + \left(\mathsf{neg}\left(1\right)\right)\right), \mathsf{\_.f64}\left(\color{blue}{\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(y, y\right)\right)}, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(1, x\right), \mathsf{\_.f64}\left(1, x\right)\right)\right)\right)\right) \]
      2. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(x + -1\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, \color{blue}{\mathsf{*.f64}\left(y, y\right)}\right), \mathsf{*.f64}\left(\mathsf{\_.f64}\left(1, x\right), \mathsf{\_.f64}\left(1, x\right)\right)\right)\right)\right) \]
      3. +-lowering-+.f648.6%

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(x, -1\right), \mathsf{\_.f64}\left(\color{blue}{\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(y, y\right)\right)}, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(1, x\right), \mathsf{\_.f64}\left(1, x\right)\right)\right)\right)\right) \]
    7. Simplified8.6%

      \[\leadsto \frac{1}{\frac{\color{blue}{x + -1}}{x \cdot \left(y \cdot y\right) - \left(1 - x\right) \cdot \left(1 - x\right)}} \]
    8. Taylor expanded in x around inf

      \[\leadsto \color{blue}{x \cdot \left(\left(\frac{1}{x} + \frac{{y}^{2}}{x}\right) - 1\right)} \]
    9. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{\left(\left(\frac{1}{x} + \frac{{y}^{2}}{x}\right) - 1\right)}\right) \]
      2. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(\left(\frac{1}{x} + \frac{{y}^{2}}{x}\right) + \color{blue}{\left(\mathsf{neg}\left(1\right)\right)}\right)\right) \]
      3. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(\left(\frac{1}{x} + \frac{{y}^{2}}{x}\right) + -1\right)\right) \]
      4. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(-1 + \color{blue}{\left(\frac{1}{x} + \frac{{y}^{2}}{x}\right)}\right)\right) \]
      5. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(-1, \color{blue}{\left(\frac{1}{x} + \frac{{y}^{2}}{x}\right)}\right)\right) \]
      6. *-lft-identityN/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(-1, \left(\frac{1}{x} + 1 \cdot \color{blue}{\frac{{y}^{2}}{x}}\right)\right)\right) \]
      7. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(-1, \left(\frac{1}{x} + \left(\mathsf{neg}\left(-1\right)\right) \cdot \frac{\color{blue}{{y}^{2}}}{x}\right)\right)\right) \]
      8. cancel-sign-sub-invN/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(-1, \left(\frac{1}{x} - \color{blue}{-1 \cdot \frac{{y}^{2}}{x}}\right)\right)\right) \]
      9. associate-*r/N/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(-1, \left(\frac{1}{x} - \frac{-1 \cdot {y}^{2}}{\color{blue}{x}}\right)\right)\right) \]
      10. div-subN/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(-1, \left(\frac{1 - -1 \cdot {y}^{2}}{\color{blue}{x}}\right)\right)\right) \]
      11. cancel-sign-sub-invN/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(-1, \left(\frac{1 + \left(\mathsf{neg}\left(-1\right)\right) \cdot {y}^{2}}{x}\right)\right)\right) \]
      12. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(-1, \left(\frac{1 + 1 \cdot {y}^{2}}{x}\right)\right)\right) \]
      13. *-lft-identityN/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(-1, \left(\frac{1 + {y}^{2}}{x}\right)\right)\right) \]
      14. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(-1, \mathsf{/.f64}\left(\left(1 + {y}^{2}\right), \color{blue}{x}\right)\right)\right) \]
      15. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \left({y}^{2}\right)\right), x\right)\right)\right) \]
      16. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \left(y \cdot y\right)\right), x\right)\right)\right) \]
      17. *-lowering-*.f6424.1%

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(y, y\right)\right), x\right)\right)\right) \]
    10. Simplified24.1%

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

      \[\leadsto \color{blue}{1 + \left(-1 \cdot x + {y}^{2}\right)} \]
    12. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto 1 + \left(\left(\mathsf{neg}\left(x\right)\right) + {\color{blue}{y}}^{2}\right) \]
      2. associate-+r+N/A

        \[\leadsto \left(1 + \left(\mathsf{neg}\left(x\right)\right)\right) + \color{blue}{{y}^{2}} \]
      3. sub-negN/A

        \[\leadsto \left(1 - x\right) + {\color{blue}{y}}^{2} \]
      4. associate-+l-N/A

        \[\leadsto 1 - \color{blue}{\left(x - {y}^{2}\right)} \]
      5. --lowering--.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(1, \color{blue}{\left(x - {y}^{2}\right)}\right) \]
      6. --lowering--.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{\_.f64}\left(x, \color{blue}{\left({y}^{2}\right)}\right)\right) \]
      7. unpow2N/A

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{\_.f64}\left(x, \left(y \cdot \color{blue}{y}\right)\right)\right) \]
      8. *-lowering-*.f6424.2%

        \[\leadsto \mathsf{\_.f64}\left(1, \mathsf{\_.f64}\left(x, \mathsf{*.f64}\left(y, \color{blue}{y}\right)\right)\right) \]
    13. Simplified24.2%

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

Alternative 7: 65.3% accurate, 13.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 8 \cdot 10^{+131}:\\
\;\;\;\;1 - x\\

\mathbf{else}:\\
\;\;\;\;y \cdot y\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 7.9999999999999993e131

    1. Initial program 99.9%

      \[\left(1 - x\right) + y \cdot \sqrt{x} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0

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

        \[\leadsto \mathsf{\_.f64}\left(1, \color{blue}{x}\right) \]
    5. Simplified70.9%

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

    if 7.9999999999999993e131 < y

    1. Initial program 99.8%

      \[\left(1 - x\right) + y \cdot \sqrt{x} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto y \cdot \sqrt{x} + \color{blue}{\left(1 - x\right)} \]
      2. flip-+N/A

        \[\leadsto \frac{\left(y \cdot \sqrt{x}\right) \cdot \left(y \cdot \sqrt{x}\right) - \left(1 - x\right) \cdot \left(1 - x\right)}{\color{blue}{y \cdot \sqrt{x} - \left(1 - x\right)}} \]
      3. clear-numN/A

        \[\leadsto \frac{1}{\color{blue}{\frac{y \cdot \sqrt{x} - \left(1 - x\right)}{\left(y \cdot \sqrt{x}\right) \cdot \left(y \cdot \sqrt{x}\right) - \left(1 - x\right) \cdot \left(1 - x\right)}}} \]
      4. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(\frac{y \cdot \sqrt{x} - \left(1 - x\right)}{\left(y \cdot \sqrt{x}\right) \cdot \left(y \cdot \sqrt{x}\right) - \left(1 - x\right) \cdot \left(1 - x\right)}\right)}\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(y \cdot \sqrt{x} - \left(1 - x\right)\right), \color{blue}{\left(\left(y \cdot \sqrt{x}\right) \cdot \left(y \cdot \sqrt{x}\right) - \left(1 - x\right) \cdot \left(1 - x\right)\right)}\right)\right) \]
      6. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\left(y \cdot \sqrt{x}\right), \left(1 - x\right)\right), \left(\color{blue}{\left(y \cdot \sqrt{x}\right) \cdot \left(y \cdot \sqrt{x}\right)} - \left(1 - x\right) \cdot \left(1 - x\right)\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(y, \left(\sqrt{x}\right)\right), \left(1 - x\right)\right), \left(\color{blue}{\left(y \cdot \sqrt{x}\right)} \cdot \left(y \cdot \sqrt{x}\right) - \left(1 - x\right) \cdot \left(1 - x\right)\right)\right)\right) \]
      8. sqrt-lowering-sqrt.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(y, \mathsf{sqrt.f64}\left(x\right)\right), \left(1 - x\right)\right), \left(\left(y \cdot \color{blue}{\sqrt{x}}\right) \cdot \left(y \cdot \sqrt{x}\right) - \left(1 - x\right) \cdot \left(1 - x\right)\right)\right)\right) \]
      9. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(y, \mathsf{sqrt.f64}\left(x\right)\right), \mathsf{\_.f64}\left(1, x\right)\right), \left(\left(y \cdot \sqrt{x}\right) \cdot \color{blue}{\left(y \cdot \sqrt{x}\right)} - \left(1 - x\right) \cdot \left(1 - x\right)\right)\right)\right) \]
      10. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(y, \mathsf{sqrt.f64}\left(x\right)\right), \mathsf{\_.f64}\left(1, x\right)\right), \mathsf{\_.f64}\left(\left(\left(y \cdot \sqrt{x}\right) \cdot \left(y \cdot \sqrt{x}\right)\right), \color{blue}{\left(\left(1 - x\right) \cdot \left(1 - x\right)\right)}\right)\right)\right) \]
      11. swap-sqrN/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(y, \mathsf{sqrt.f64}\left(x\right)\right), \mathsf{\_.f64}\left(1, x\right)\right), \mathsf{\_.f64}\left(\left(\left(y \cdot y\right) \cdot \left(\sqrt{x} \cdot \sqrt{x}\right)\right), \left(\color{blue}{\left(1 - x\right)} \cdot \left(1 - x\right)\right)\right)\right)\right) \]
      12. rem-square-sqrtN/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(y, \mathsf{sqrt.f64}\left(x\right)\right), \mathsf{\_.f64}\left(1, x\right)\right), \mathsf{\_.f64}\left(\left(\left(y \cdot y\right) \cdot x\right), \left(\left(1 - \color{blue}{x}\right) \cdot \left(1 - x\right)\right)\right)\right)\right) \]
      13. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(y, \mathsf{sqrt.f64}\left(x\right)\right), \mathsf{\_.f64}\left(1, x\right)\right), \mathsf{\_.f64}\left(\left(x \cdot \left(y \cdot y\right)\right), \left(\color{blue}{\left(1 - x\right)} \cdot \left(1 - x\right)\right)\right)\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(y, \mathsf{sqrt.f64}\left(x\right)\right), \mathsf{\_.f64}\left(1, x\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, \left(y \cdot y\right)\right), \left(\color{blue}{\left(1 - x\right)} \cdot \left(1 - x\right)\right)\right)\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(y, \mathsf{sqrt.f64}\left(x\right)\right), \mathsf{\_.f64}\left(1, x\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(y, y\right)\right), \left(\left(1 - \color{blue}{x}\right) \cdot \left(1 - x\right)\right)\right)\right)\right) \]
      16. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(y, \mathsf{sqrt.f64}\left(x\right)\right), \mathsf{\_.f64}\left(1, x\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(y, y\right)\right), \mathsf{*.f64}\left(\left(1 - x\right), \color{blue}{\left(1 - x\right)}\right)\right)\right)\right) \]
      17. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(y, \mathsf{sqrt.f64}\left(x\right)\right), \mathsf{\_.f64}\left(1, x\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(y, y\right)\right), \mathsf{*.f64}\left(\mathsf{\_.f64}\left(1, x\right), \left(\color{blue}{1} - x\right)\right)\right)\right)\right) \]
      18. --lowering--.f6412.0%

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(y, \mathsf{sqrt.f64}\left(x\right)\right), \mathsf{\_.f64}\left(1, x\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(y, y\right)\right), \mathsf{*.f64}\left(\mathsf{\_.f64}\left(1, x\right), \mathsf{\_.f64}\left(1, \color{blue}{x}\right)\right)\right)\right)\right) \]
    4. Applied egg-rr12.0%

      \[\leadsto \color{blue}{\frac{1}{\frac{y \cdot \sqrt{x} - \left(1 - x\right)}{x \cdot \left(y \cdot y\right) - \left(1 - x\right) \cdot \left(1 - x\right)}}} \]
    5. Taylor expanded in y around 0

      \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\color{blue}{\left(x - 1\right)}, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(y, y\right)\right), \mathsf{*.f64}\left(\mathsf{\_.f64}\left(1, x\right), \mathsf{\_.f64}\left(1, x\right)\right)\right)\right)\right) \]
    6. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(x + \left(\mathsf{neg}\left(1\right)\right)\right), \mathsf{\_.f64}\left(\color{blue}{\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(y, y\right)\right)}, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(1, x\right), \mathsf{\_.f64}\left(1, x\right)\right)\right)\right)\right) \]
      2. metadata-evalN/A

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(x + -1\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, \color{blue}{\mathsf{*.f64}\left(y, y\right)}\right), \mathsf{*.f64}\left(\mathsf{\_.f64}\left(1, x\right), \mathsf{\_.f64}\left(1, x\right)\right)\right)\right)\right) \]
      3. +-lowering-+.f6410.3%

        \[\leadsto \mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(x, -1\right), \mathsf{\_.f64}\left(\color{blue}{\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(y, y\right)\right)}, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(1, x\right), \mathsf{\_.f64}\left(1, x\right)\right)\right)\right)\right) \]
    7. Simplified10.3%

      \[\leadsto \frac{1}{\frac{\color{blue}{x + -1}}{x \cdot \left(y \cdot y\right) - \left(1 - x\right) \cdot \left(1 - x\right)}} \]
    8. Taylor expanded in x around inf

      \[\leadsto \color{blue}{x \cdot \left(\left(\frac{1}{x} + \frac{{y}^{2}}{x}\right) - 1\right)} \]
    9. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{\left(\left(\frac{1}{x} + \frac{{y}^{2}}{x}\right) - 1\right)}\right) \]
      2. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(\left(\frac{1}{x} + \frac{{y}^{2}}{x}\right) + \color{blue}{\left(\mathsf{neg}\left(1\right)\right)}\right)\right) \]
      3. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(\left(\frac{1}{x} + \frac{{y}^{2}}{x}\right) + -1\right)\right) \]
      4. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(-1 + \color{blue}{\left(\frac{1}{x} + \frac{{y}^{2}}{x}\right)}\right)\right) \]
      5. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(-1, \color{blue}{\left(\frac{1}{x} + \frac{{y}^{2}}{x}\right)}\right)\right) \]
      6. *-lft-identityN/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(-1, \left(\frac{1}{x} + 1 \cdot \color{blue}{\frac{{y}^{2}}{x}}\right)\right)\right) \]
      7. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(-1, \left(\frac{1}{x} + \left(\mathsf{neg}\left(-1\right)\right) \cdot \frac{\color{blue}{{y}^{2}}}{x}\right)\right)\right) \]
      8. cancel-sign-sub-invN/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(-1, \left(\frac{1}{x} - \color{blue}{-1 \cdot \frac{{y}^{2}}{x}}\right)\right)\right) \]
      9. associate-*r/N/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(-1, \left(\frac{1}{x} - \frac{-1 \cdot {y}^{2}}{\color{blue}{x}}\right)\right)\right) \]
      10. div-subN/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(-1, \left(\frac{1 - -1 \cdot {y}^{2}}{\color{blue}{x}}\right)\right)\right) \]
      11. cancel-sign-sub-invN/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(-1, \left(\frac{1 + \left(\mathsf{neg}\left(-1\right)\right) \cdot {y}^{2}}{x}\right)\right)\right) \]
      12. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(-1, \left(\frac{1 + 1 \cdot {y}^{2}}{x}\right)\right)\right) \]
      13. *-lft-identityN/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(-1, \left(\frac{1 + {y}^{2}}{x}\right)\right)\right) \]
      14. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(-1, \mathsf{/.f64}\left(\left(1 + {y}^{2}\right), \color{blue}{x}\right)\right)\right) \]
      15. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \left({y}^{2}\right)\right), x\right)\right)\right) \]
      16. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \left(y \cdot y\right)\right), x\right)\right)\right) \]
      17. *-lowering-*.f6427.0%

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{+.f64}\left(-1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(y, y\right)\right), x\right)\right)\right) \]
    10. Simplified27.0%

      \[\leadsto \color{blue}{x \cdot \left(-1 + \frac{1 + y \cdot y}{x}\right)} \]
    11. Taylor expanded in y around inf

      \[\leadsto \color{blue}{{y}^{2}} \]
    12. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto y \cdot \color{blue}{y} \]
      2. *-lowering-*.f6427.0%

        \[\leadsto \mathsf{*.f64}\left(y, \color{blue}{y}\right) \]
    13. Simplified27.0%

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

Alternative 8: 61.3% accurate, 13.3× speedup?

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

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

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


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

    1. Initial program 99.9%

      \[\left(1 - x\right) + y \cdot \sqrt{x} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0

      \[\leadsto \color{blue}{1 - x} \]
    4. Step-by-step derivation
      1. --lowering--.f6459.3%

        \[\leadsto \mathsf{\_.f64}\left(1, \color{blue}{x}\right) \]
    5. Simplified59.3%

      \[\leadsto \color{blue}{1 - x} \]
    6. Taylor expanded in x around 0

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

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

      if 0.00419999999999999974 < x

      1. Initial program 99.9%

        \[\left(1 - x\right) + y \cdot \sqrt{x} \]
      2. Add Preprocessing
      3. Taylor expanded in y around 0

        \[\leadsto \color{blue}{1 - x} \]
      4. Step-by-step derivation
        1. --lowering--.f6463.2%

          \[\leadsto \mathsf{\_.f64}\left(1, \color{blue}{x}\right) \]
      5. Simplified63.2%

        \[\leadsto \color{blue}{1 - x} \]
      6. Taylor expanded in x around inf

        \[\leadsto \color{blue}{-1 \cdot x} \]
      7. Step-by-step derivation
        1. mul-1-negN/A

          \[\leadsto \mathsf{neg}\left(x\right) \]
        2. neg-sub0N/A

          \[\leadsto 0 - \color{blue}{x} \]
        3. --lowering--.f6462.7%

          \[\leadsto \mathsf{\_.f64}\left(0, \color{blue}{x}\right) \]
      8. Simplified62.7%

        \[\leadsto \color{blue}{0 - x} \]
      9. Step-by-step derivation
        1. sub0-negN/A

          \[\leadsto \mathsf{neg}\left(x\right) \]
        2. neg-lowering-neg.f6462.7%

          \[\leadsto \mathsf{neg.f64}\left(x\right) \]
      10. Applied egg-rr62.7%

        \[\leadsto \color{blue}{-x} \]
    8. Recombined 2 regimes into one program.
    9. Final simplification60.7%

      \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 0.0042:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;0 - x\\ \end{array} \]
    10. Add Preprocessing

    Alternative 9: 31.7% accurate, 107.0× speedup?

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

      \[\left(1 - x\right) + y \cdot \sqrt{x} \]
    2. Add Preprocessing
    3. Taylor expanded in y around 0

      \[\leadsto \color{blue}{1 - x} \]
    4. Step-by-step derivation
      1. --lowering--.f6461.4%

        \[\leadsto \mathsf{\_.f64}\left(1, \color{blue}{x}\right) \]
    5. Simplified61.4%

      \[\leadsto \color{blue}{1 - x} \]
    6. Taylor expanded in x around 0

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

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

      Reproduce

      ?
      herbie shell --seed 2024158 
      (FPCore (x y)
        :name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, E"
        :precision binary64
        (+ (- 1.0 x) (* y (sqrt x))))