Average Error: 15.3 → 0.5
Time: 1.1s
Precision: binary64
\[\frac{-\left(2 \cdot x\right) \cdot y}{x - y}\]
\[\begin{array}{l} \mathbf{if}\;\frac{-\left(2 \cdot x\right) \cdot y}{x - y} \le -4.7689681932628732 \cdot 10^{61} \lor \neg \left(\frac{-\left(2 \cdot x\right) \cdot y}{x - y} \le -1.32736955359934003 \cdot 10^{-306} \lor \neg \left(\frac{-\left(2 \cdot x\right) \cdot y}{x - y} \le 0.0 \lor \neg \left(\frac{-\left(2 \cdot x\right) \cdot y}{x - y} \le 3.66481594550757464 \cdot 10^{56}\right)\right)\right):\\ \;\;\;\;\frac{2}{\frac{\frac{y}{x} + -1}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-\left(2 \cdot x\right) \cdot y}{x - y}\\ \end{array}\]

Error

Bits error versus x

Bits error versus y

Derivation

  1. Split input into 2 regimes
  2. if (/ (neg (* (* 2.0 x) y)) (- x y)) < -4.7689681932628732e61 or -1.32736955359934003e-306 < (/ (neg (* (* 2.0 x) y)) (- x y)) < 0.0 or 3.66481594550757464e56 < (/ (neg (* (* 2.0 x) y)) (- x y))

    1. Initial program 51.5

      \[\frac{-\left(2 \cdot x\right) \cdot y}{x - y}\]
    2. Simplified0.4

      \[\leadsto \color{blue}{\frac{2}{\frac{\frac{y}{x} + -1}{y}}}\]

    if -4.7689681932628732e61 < (/ (neg (* (* 2.0 x) y)) (- x y)) < -1.32736955359934003e-306 or 0.0 < (/ (neg (* (* 2.0 x) y)) (- x y)) < 3.66481594550757464e56

    1. Initial program 0.6

      \[\frac{-\left(2 \cdot x\right) \cdot y}{x - y}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.5

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{-\left(2 \cdot x\right) \cdot y}{x - y} \le -4.7689681932628732 \cdot 10^{61} \lor \neg \left(\frac{-\left(2 \cdot x\right) \cdot y}{x - y} \le -1.32736955359934003 \cdot 10^{-306} \lor \neg \left(\frac{-\left(2 \cdot x\right) \cdot y}{x - y} \le 0.0 \lor \neg \left(\frac{-\left(2 \cdot x\right) \cdot y}{x - y} \le 3.66481594550757464 \cdot 10^{56}\right)\right)\right):\\ \;\;\;\;\frac{2}{\frac{\frac{y}{x} + -1}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-\left(2 \cdot x\right) \cdot y}{x - y}\\ \end{array}\]

Reproduce

herbie shell --seed 2020153 
(FPCore (x y)
  :name "(/ (- (* (* 2 x) y)) (- x y))"
  :precision binary64
  (/ (neg (* (* 2.0 x) y)) (- x y)))