Average Error: 0.1 → 0.1
Time: 2.8s
Precision: 64
\[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z\]
\[x - \left(y \cdot \log y + \mathsf{fma}\left(0.5, \log y, z - y\right)\right)\]
\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z
x - \left(y \cdot \log y + \mathsf{fma}\left(0.5, \log y, z - y\right)\right)
double code(double x, double y, double z) {
	return (((x - ((y + 0.5) * log(y))) + y) - z);
}
double code(double x, double y, double z) {
	return (x - ((y * log(y)) + fma(0.5, log(y), (z - y))));
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original0.1
Target0.1
Herbie0.1
\[\left(\left(y + x\right) - z\right) - \left(y + 0.5\right) \cdot \log y\]

Derivation

  1. Initial program 0.1

    \[\left(\left(x - \left(y + 0.5\right) \cdot \log y\right) + y\right) - z\]
  2. Simplified0.1

    \[\leadsto \color{blue}{x - \left(\mathsf{fma}\left(\log y, y + 0.5, z\right) - y\right)}\]
  3. Using strategy rm
  4. Applied fma-udef0.1

    \[\leadsto x - \left(\color{blue}{\left(\log y \cdot \left(y + 0.5\right) + z\right)} - y\right)\]
  5. Applied associate--l+0.1

    \[\leadsto x - \color{blue}{\left(\log y \cdot \left(y + 0.5\right) + \left(z - y\right)\right)}\]
  6. Using strategy rm
  7. Applied distribute-rgt-in0.1

    \[\leadsto x - \left(\color{blue}{\left(y \cdot \log y + 0.5 \cdot \log y\right)} + \left(z - y\right)\right)\]
  8. Applied associate-+l+0.1

    \[\leadsto x - \color{blue}{\left(y \cdot \log y + \left(0.5 \cdot \log y + \left(z - y\right)\right)\right)}\]
  9. Simplified0.1

    \[\leadsto x - \left(y \cdot \log y + \color{blue}{\mathsf{fma}\left(0.5, \log y, z - y\right)}\right)\]
  10. Final simplification0.1

    \[\leadsto x - \left(y \cdot \log y + \mathsf{fma}\left(0.5, \log y, z - y\right)\right)\]

Reproduce

herbie shell --seed 2020078 +o rules:numerics
(FPCore (x y z)
  :name "Numeric.SpecFunctions:stirlingError from math-functions-0.1.5.2"
  :precision binary64

  :herbie-target
  (- (- (+ y x) z) (* (+ y 0.5) (log y)))

  (- (+ (- x (* (+ y 0.5) (log y))) y) z))