Average Error: 7.5 → 0.0
Time: 49.9s
Precision: 64
Internal Precision: 384
\[\frac{x \cdot y}{y + 1.0}\]
\[\begin{array}{l} \mathbf{if}\;y \le -411930.8608633218:\\ \;\;\;\;x + \left(\frac{1.0}{y} - 1.0\right) \cdot \frac{x}{y}\\ \mathbf{if}\;y \le 282709.3197423372:\\ \;\;\;\;\frac{x \cdot y}{y + 1.0}\\ \mathbf{else}:\\ \;\;\;\;x + \left(\frac{1.0}{y} - 1.0\right) \cdot \frac{x}{y}\\ \end{array}\]

Error

Bits error versus x

Bits error versus y

Target

Original7.5
Target0.0
Herbie0.0
\[\begin{array}{l} \mathbf{if}\;y \lt -3693.8482788297247:\\ \;\;\;\;\frac{x}{y \cdot y} - \left(\frac{x}{y} - x\right)\\ \mathbf{if}\;y \lt 6799310503.41891:\\ \;\;\;\;\frac{x \cdot y}{y + 1.0}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot y} - \left(\frac{x}{y} - x\right)\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if y < -411930.8608633218 or 282709.3197423372 < y

    1. Initial program 15.2

      \[\frac{x \cdot y}{y + 1.0}\]
    2. Taylor expanded around inf 0.0

      \[\leadsto \color{blue}{\left(1.0 \cdot \frac{x}{{y}^{2}} + x\right) - 1.0 \cdot \frac{x}{y}}\]
    3. Applied simplify0

      \[\leadsto \color{blue}{x + \left(\frac{1.0}{y} - 1.0\right) \cdot \frac{x}{y}}\]

    if -411930.8608633218 < y < 282709.3197423372

    1. Initial program 0.0

      \[\frac{x \cdot y}{y + 1.0}\]
  3. Recombined 2 regimes into one program.
  4. Removed slow pow expressions.

Runtime

Time bar (total: 49.9s)Debug log

herbie shell --seed '#(1567391828 2030694642 2833800258 828025724 3004380912 3532991858)' +o setup:early-exit +o reduce:binary-search
(FPCore (x y)
  :name "Diagrams.Trail:splitAtParam  from diagrams-lib-1.3.0.3, B"

  :herbie-target
  (if (< y -3693.8482788297247) (- (/ x (* y y)) (- (/ x y) x)) (if (< y 6799310503.41891) (/ (* x y) (+ y 1.0)) (- (/ x (* y y)) (- (/ x y) x))))

  (/ (* x y) (+ y 1.0)))