Average Error: 0.1 → 0.1
Time: 4.1s
Precision: 64
\[\left(1 - x\right) + y \cdot \sqrt{x}\]
\[\mathsf{fma}\left(\sqrt{x}, y, 1 - x\right)\]
\left(1 - x\right) + y \cdot \sqrt{x}
\mathsf{fma}\left(\sqrt{x}, y, 1 - x\right)
double code(double x, double y) {
	return ((1.0 - x) + (y * sqrt(x)));
}
double code(double x, double y) {
	return fma(sqrt(x), y, (1.0 - x));
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.1

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

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

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

Reproduce

herbie shell --seed 2020092 +o rules:numerics
(FPCore (x y)
  :name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, E"
  :precision binary64
  (+ (- 1 x) (* y (sqrt x))))