Average Error: 10.0 → 6.5
Time: 2.5m
Precision: 64
Internal Precision: 1408
\[x + \frac{y - z}{\left(t + 1.0\right) - z} \cdot \left(a - x\right)\]
\[\begin{array}{l} \mathbf{if}\;x + \frac{y - z}{\left(t + 1.0\right) - z} \cdot \left(a - x\right) \le -4.729447263504346 \cdot 10^{-308}:\\ \;\;\;\;x + \left(y - z\right) \cdot \frac{a - x}{1.0 + \left(t - z\right)}\\ \mathbf{if}\;x + \frac{y - z}{\left(t + 1.0\right) - z} \cdot \left(a - x\right) \le 3.735682881900282 \cdot 10^{-256}:\\ \;\;\;\;a - \left(a - x\right) \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;x + \left(y - z\right) \cdot \frac{a - x}{1.0 + \left(t - z\right)}\\ \end{array}\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Target

Original10.0
Target10.0
Herbie6.5
\[x + \frac{y - z}{\left(t + 1.0\right) - z} \cdot \left(a - x\right)\]

Derivation

  1. Split input into 2 regimes
  2. if (+ x (* (/ (- y z) (- (+ t 1.0) z)) (- a x))) < -4.729447263504346e-308 or 3.735682881900282e-256 < (+ x (* (/ (- y z) (- (+ t 1.0) z)) (- a x)))

    1. Initial program 0.9

      \[x + \frac{y - z}{\left(t + 1.0\right) - z} \cdot \left(a - x\right)\]
    2. Using strategy rm
    3. Applied div-inv1.0

      \[\leadsto x + \color{blue}{\left(\left(y - z\right) \cdot \frac{1}{\left(t + 1.0\right) - z}\right)} \cdot \left(a - x\right)\]
    4. Applied associate-*l*2.5

      \[\leadsto x + \color{blue}{\left(y - z\right) \cdot \left(\frac{1}{\left(t + 1.0\right) - z} \cdot \left(a - x\right)\right)}\]
    5. Applied simplify2.4

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

    if -4.729447263504346e-308 < (+ x (* (/ (- y z) (- (+ t 1.0) z)) (- a x))) < 3.735682881900282e-256

    1. Initial program 61.2

      \[x + \frac{y - z}{\left(t + 1.0\right) - z} \cdot \left(a - x\right)\]
    2. Taylor expanded around inf 34.5

      \[\leadsto \color{blue}{\left(\frac{y \cdot x}{z} + a\right) - \frac{y \cdot a}{z}}\]
    3. Applied simplify29.4

      \[\leadsto \color{blue}{a - \left(a - x\right) \cdot \frac{y}{z}}\]
  3. Recombined 2 regimes into one program.
  4. Removed slow pow expressions.

Runtime

Time bar (total: 2.5m)Debug log

herbie shell --seed '#(1567391828 2030694642 2833800258 828025724 3004380912 3532991858)' +o setup:early-exit +o reduce:binary-search
(FPCore (x y z t a)
  :name "Hakyll.Web.Tags:renderTagCloud from hakyll-4.7.2.3"

  :herbie-target
  (+ x (* (/ (- y z) (- (+ t 1.0) z)) (- a x)))

  (+ x (* (/ (- y z) (- (+ t 1.0) z)) (- a x))))