Average Error: 0.1 → 0.1
Time: 3.0s
Precision: binary64
\[\left(1 - x\right) + y \cdot \sqrt{x} \]
\[\mathsf{fma}\left(-1, x, \mathsf{fma}\left(y, \sqrt{x}, 1\right)\right) \]
(FPCore (x y) :precision binary64 (+ (- 1.0 x) (* y (sqrt x))))
(FPCore (x y) :precision binary64 (fma -1.0 x (fma y (sqrt x) 1.0)))
double code(double x, double y) {
	return (1.0 - x) + (y * sqrt(x));
}
double code(double x, double y) {
	return fma(-1.0, x, fma(y, sqrt(x), 1.0));
}
function code(x, y)
	return Float64(Float64(1.0 - x) + Float64(y * sqrt(x)))
end
function code(x, y)
	return fma(-1.0, x, fma(y, sqrt(x), 1.0))
end
code[x_, y_] := N[(N[(1.0 - x), $MachinePrecision] + N[(y * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_] := N[(-1.0 * x + N[(y * N[Sqrt[x], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]
\left(1 - x\right) + y \cdot \sqrt{x}
\mathsf{fma}\left(-1, x, \mathsf{fma}\left(y, \sqrt{x}, 1\right)\right)

Error

Bits error versus x

Bits error versus y

Derivation

  1. Initial program 0.1

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(y, \sqrt{x}, 1\right) - x} \]
  3. Applied egg-rr0.4

    \[\leadsto \color{blue}{{\left(\sqrt[3]{\mathsf{fma}\left(y, \sqrt{x}, 1\right)}\right)}^{3}} - x \]
  4. Taylor expanded in y around inf 0.4

    \[\leadsto {\left(\sqrt[3]{\color{blue}{1 + y \cdot \sqrt{x}}}\right)}^{3} - x \]
  5. Applied egg-rr0.1

    \[\leadsto \color{blue}{\mathsf{fma}\left(-1, x, \mathsf{fma}\left(y, \sqrt{x}, 1\right)\right)} \]
  6. Final simplification0.1

    \[\leadsto \mathsf{fma}\left(-1, x, \mathsf{fma}\left(y, \sqrt{x}, 1\right)\right) \]

Reproduce

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