?

Average Error: 0.13% → 0.18%
Time: 34.7s
Precision: binary64

?

\[\left(1 - x\right) + y \cdot \sqrt{x} \]
\[\begin{array}{l} \mathbf{if}\;1 - x \ne 0:\\ \;\;\;\;\left(1 - x\right) \cdot \left(\frac{y}{1} \cdot \frac{\sqrt{x}}{1 - x} + 1\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y, \sqrt{x}, 1 - x\right)\\ \end{array} \]
(FPCore (x y) :precision binary64 (+ (- 1.0 x) (* y (sqrt x))))
(FPCore (x y)
 :precision binary64
 (if (!= (- 1.0 x) 0.0)
   (* (- 1.0 x) (+ (* (/ y 1.0) (/ (sqrt x) (- 1.0 x))) 1.0))
   (fma y (sqrt x) (- 1.0 x))))
double code(double x, double y) {
	return (1.0 - x) + (y * sqrt(x));
}
double code(double x, double y) {
	double tmp;
	if ((1.0 - x) != 0.0) {
		tmp = (1.0 - x) * (((y / 1.0) * (sqrt(x) / (1.0 - x))) + 1.0);
	} else {
		tmp = fma(y, sqrt(x), (1.0 - x));
	}
	return tmp;
}
function code(x, y)
	return Float64(Float64(1.0 - x) + Float64(y * sqrt(x)))
end
function code(x, y)
	tmp = 0.0
	if (Float64(1.0 - x) != 0.0)
		tmp = Float64(Float64(1.0 - x) * Float64(Float64(Float64(y / 1.0) * Float64(sqrt(x) / Float64(1.0 - x))) + 1.0));
	else
		tmp = fma(y, sqrt(x), Float64(1.0 - x));
	end
	return tmp
end
code[x_, y_] := N[(N[(1.0 - x), $MachinePrecision] + N[(y * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_] := If[Unequal[N[(1.0 - x), $MachinePrecision], 0.0], N[(N[(1.0 - x), $MachinePrecision] * N[(N[(N[(y / 1.0), $MachinePrecision] * N[(N[Sqrt[x], $MachinePrecision] / N[(1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(y * N[Sqrt[x], $MachinePrecision] + N[(1.0 - x), $MachinePrecision]), $MachinePrecision]]
\left(1 - x\right) + y \cdot \sqrt{x}
\begin{array}{l}
\mathbf{if}\;1 - x \ne 0:\\
\;\;\;\;\left(1 - x\right) \cdot \left(\frac{y}{1} \cdot \frac{\sqrt{x}}{1 - x} + 1\right)\\

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


\end{array}

Error?

Derivation?

  1. Initial program 0.13

    \[\left(1 - x\right) + y \cdot \sqrt{x} \]
  2. Applied egg-rr0.15

    \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;1 - x \ne 0:\\ \;\;\;\;\left(1 - x\right) \cdot \left(\frac{y \cdot \sqrt{x}}{1 - x} + 1\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y, \sqrt{x}, 1 - x\right)\\ } \end{array}} \]
  3. Applied egg-rr0.18

    \[\leadsto \begin{array}{l} \mathbf{if}\;1 - x \ne 0:\\ \;\;\;\;\left(1 - x\right) \cdot \left(\color{blue}{\frac{y}{1} \cdot \frac{\sqrt{x}}{1 - x}} + 1\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y, \sqrt{x}, 1 - x\right)\\ \end{array} \]

Reproduce?

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