Average Error: 6.4 → 2.1
Time: 18.9s
Precision: 64
Internal precision: 128
\[x + \frac{y \cdot \left(z - x\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;x \le -1.3209176906660093 \cdot 10^{-170}:\\ \;\;\;\;\frac{z - x}{\frac{t}{y}} + x\\ \mathbf{if}\;x \le 2.0581640871701446 \cdot 10^{-95}:\\ \;\;\;\;x + \frac{y \cdot \left(z - x\right)}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{t} \cdot \left(z - x\right) + x\\ \end{array}\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

Original6.4
Comparison2.0
Herbie2.1
\[ x - \left(x \cdot \frac{y}{t} + \left(-z\right) \cdot \frac{y}{t}\right) \]

Derivation

  1. Split input into 3 regimes.
  2. if x < -1.3209176906660093e-170

    1. Initial program 6.7

      \[x + \frac{y \cdot \left(z - x\right)}{t}\]
    2. Applied taylor 6.7

      \[\leadsto x + \left(\frac{y \cdot z}{t} - \frac{y \cdot x}{t}\right)\]
    3. Taylor expanded around 0 6.7

      \[\leadsto x + \color{blue}{\left(\frac{y \cdot z}{t} - \frac{y \cdot x}{t}\right)}\]
    4. Applied simplify 0.7

      \[\leadsto \color{blue}{\frac{z - x}{\frac{t}{y}} + x}\]

    if -1.3209176906660093e-170 < x < 2.0581640871701446e-95

    1. Initial program 5.2

      \[x + \frac{y \cdot \left(z - x\right)}{t}\]

    if 2.0581640871701446e-95 < x

    1. Initial program 7.3

      \[x + \frac{y \cdot \left(z - x\right)}{t}\]
    2. Applied taylor 7.3

      \[\leadsto x + \frac{y \cdot z - y \cdot x}{t}\]
    3. Taylor expanded around 0 7.3

      \[\leadsto x + \frac{\color{blue}{y \cdot z - y \cdot x}}{t}\]
    4. Applied simplify 0.3

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

Runtime

Time bar (total: 18.9s) Debug log

Please include this information when filing a bug report:

herbie --seed '#(3177963436 888103403 3093071472 2189699733 2284055197 1183748214)'
(FPCore (x y z t)
  :name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, D"

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

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