Average Error: 0.0 → 0.0
Time: 931.0ms
Precision: binary64
\[\frac{x + y}{y + y}\]
\[0.5 \cdot \left(1 + \frac{x}{y}\right)\]
\frac{x + y}{y + y}
0.5 \cdot \left(1 + \frac{x}{y}\right)
(FPCore (x y) :precision binary64 (/ (+ x y) (+ y y)))
(FPCore (x y) :precision binary64 (* 0.5 (+ 1.0 (/ x y))))
double code(double x, double y) {
	return (((double) (x + y)) / ((double) (y + y)));
}
double code(double x, double y) {
	return ((double) (0.5 * ((double) (1.0 + (x / y)))));
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original0.0
Target0.0
Herbie0.0
\[0.5 \cdot \frac{x}{y} + 0.5\]

Derivation

  1. Initial program Error: 0.0 bits

    \[\frac{x + y}{y + y}\]
  2. Using strategy rm
  3. Applied *-un-lft-identityError: 0.0 bits

    \[\leadsto \frac{x + y}{\color{blue}{1 \cdot y} + y}\]
  4. Applied distribute-lft1-inError: 0.0 bits

    \[\leadsto \frac{x + y}{\color{blue}{\left(1 + 1\right) \cdot y}}\]
  5. Applied *-un-lft-identityError: 0.0 bits

    \[\leadsto \frac{\color{blue}{1 \cdot \left(x + y\right)}}{\left(1 + 1\right) \cdot y}\]
  6. Applied times-fracError: 0.0 bits

    \[\leadsto \color{blue}{\frac{1}{1 + 1} \cdot \frac{x + y}{y}}\]
  7. SimplifiedError: 0.0 bits

    \[\leadsto \color{blue}{0.5} \cdot \frac{x + y}{y}\]
  8. Taylor expanded around 0 Error: 0.0 bits

    \[\leadsto 0.5 \cdot \color{blue}{\left(\frac{x}{y} + 1\right)}\]
  9. SimplifiedError: 0.0 bits

    \[\leadsto 0.5 \cdot \color{blue}{\left(1 + \frac{x}{y}\right)}\]
  10. Final simplificationError: 0.0 bits

    \[\leadsto 0.5 \cdot \left(1 + \frac{x}{y}\right)\]

Reproduce

herbie shell --seed 2020203 
(FPCore (x y)
  :name "Data.Random.Distribution.T:$ccdf from random-fu-0.2.6.2"
  :precision binary64

  :herbie-target
  (+ (* 0.5 (/ x y)) 0.5)

  (/ (+ x y) (+ y y)))