Average Error: 0.0 → 0.1
Time: 1.5s
Precision: 64
\[x + \frac{y}{500}\]
\[\mathsf{fma}\left(y, 2 \cdot 10^{-3}, x\right)\]
x + \frac{y}{500}
\mathsf{fma}\left(y, 2 \cdot 10^{-3}, x\right)
double code(double x, double y) {
	return (x + (y / 500.0));
}
double code(double x, double y) {
	return fma(y, 0.002, 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

    \[x + \frac{y}{500}\]
  2. Taylor expanded around 0 0.1

    \[\leadsto \color{blue}{x + 2 \cdot 10^{-3} \cdot y}\]
  3. Simplified0.1

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

    \[\leadsto \mathsf{fma}\left(y, 2 \cdot 10^{-3}, x\right)\]

Reproduce

herbie shell --seed 2020060 +o rules:numerics
(FPCore (x y)
  :name "Data.Colour.CIE:cieLAB from colour-2.3.3, C"
  :precision binary64
  (+ x (/ y 500)))