Average Error: 6.0 → 1.8
Time: 44.4s
Precision: 64
Internal Precision: 384
\[x + \frac{y \cdot \left(z - x\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;x \le -6.906465135771799 \cdot 10^{-107}:\\ \;\;\;\;x + \frac{z - x}{\frac{t}{y}}\\ \mathbf{if}\;x \le -7.288444445623281 \cdot 10^{-258}:\\ \;\;\;\;x + \frac{y \cdot \left(z - x\right)}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{z - x}{\frac{t}{y}}\\ \end{array}\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

Original6.0
Target2.0
Herbie1.8
\[x - \left(x \cdot \frac{y}{t} + \left(-z\right) \cdot \frac{y}{t}\right)\]

Derivation

  1. Split input into 2 regimes
  2. if x < -6.906465135771799e-107 or -7.288444445623281e-258 < x

    1. Initial program 6.4

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

      \[\leadsto x + \frac{\color{blue}{z \cdot y - y \cdot x}}{t}\]
    3. Applied simplify1.5

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

    if -6.906465135771799e-107 < x < -7.288444445623281e-258

    1. Initial program 3.9

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

Runtime

Time bar (total: 44.4s)Debug log

herbie shell --seed '#(1567391828 2030694642 2833800258 828025724 3004380912 3532991858)' +o setup:early-exit
(FPCore (x y z t)
  :name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, D"

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

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