Average Error: 7.6 → 7.6
Time: 1.3m
Precision: 64
Internal Precision: 384
\[\frac{x + y}{1.0 - \frac{y}{z}}\]
\[\frac{x + y}{1.0 - \frac{y}{z}}\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

Original7.6
Target3.9
Herbie7.6
\[\begin{array}{l} \mathbf{if}\;y \lt -3.7429310762689856 \cdot 10^{+171}:\\ \;\;\;\;\frac{y + x}{-y} \cdot z\\ \mathbf{if}\;y \lt 3.5534662456086734 \cdot 10^{+168}:\\ \;\;\;\;\frac{x + y}{1.0 - \frac{y}{z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{y + x}{-y} \cdot z\\ \end{array}\]

Derivation

  1. Initial program 7.6

    \[\frac{x + y}{1.0 - \frac{y}{z}}\]
  2. Removed slow pow expressions.

Runtime

Time bar (total: 1.3m)Debug log

herbie shell --seed '#(1567391828 2030694642 2833800258 828025724 3004380912 3532991858)' +o setup:early-exit +o reduce:binary-search
(FPCore (x y z)
  :name "Graphics.Rendering.Chart.Backend.Diagrams:calcFontMetrics from Chart-diagrams-1.5.1, A"

  :herbie-target
  (if (< y -3.7429310762689856e+171) (* (/ (+ y x) (- y)) z) (if (< y 3.5534662456086734e+168) (/ (+ x y) (- 1.0 (/ y z))) (* (/ (+ y x) (- y)) z)))

  (/ (+ x y) (- 1.0 (/ y z))))