Average Error: 0.0 → 0.0
Time: 1.8s
Precision: 64
\[\left(x + 1\right) \cdot y - x\]
\[\mathsf{fma}\left(1, y, x \cdot y\right) - x\]
\left(x + 1\right) \cdot y - x
\mathsf{fma}\left(1, y, x \cdot y\right) - x
double code(double x, double y) {
	return (((x + 1.0) * y) - x);
}
double code(double x, double y) {
	return (fma(1.0, y, (x * y)) - 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.0

    \[\left(x + 1\right) \cdot y - x\]
  2. Taylor expanded around 0 0.0

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

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

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

Reproduce

herbie shell --seed 2020100 +o rules:numerics
(FPCore (x y)
  :name "Data.Colour.SRGB:transferFunction from colour-2.3.3"
  :precision binary64
  (- (* (+ x 1) y) x))