Average Error: 5.9 → 1.5
Time: 31.6s
Precision: 64
Internal precision: 128
\[x - \frac{y \cdot \left(z - t\right)}{a}\]
\[\begin{array}{l} \mathbf{if}\;y \le -2.930244047323321 \cdot 10^{+18}:\\ \;\;\;\;x - y \cdot \frac{z - t}{a}\\ \mathbf{if}\;y \le 8.166728288538418 \cdot 10^{-294}:\\ \;\;\;\;x - \frac{1}{\frac{a}{y \cdot \left(z - t\right)}}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{y}{a} \cdot \left(z - t\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

Original5.9
Comparison0.7
Herbie1.5
\[ \begin{array}{l} \mathbf{if}\;y \lt -1.0761266216389975 \cdot 10^{-10}:\\ \;\;\;\;x - \frac{1}{\frac{\frac{a}{z - t}}{y}}\\ \mathbf{if}\;y \lt 2.894426862792089 \cdot 10^{-49}:\\ \;\;\;\;x - \frac{y \cdot \left(z - t\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{y}{\frac{a}{z - t}}\\ \end{array} \]

Derivation

  1. Split input into 3 regimes.
  2. if y < -2.930244047323321e+18

    1. Initial program 16.2

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

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

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

      \[\leadsto \color{blue}{x - \frac{y}{a} \cdot \left(z - t\right)}\]
    5. Using strategy rm
    6. Applied div-inv 3.7

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

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

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

    if -2.930244047323321e+18 < y < 8.166728288538418e-294

    1. Initial program 0.5

      \[x - \frac{y \cdot \left(z - t\right)}{a}\]
    2. Using strategy rm
    3. Applied clear-num 0.5

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

    if 8.166728288538418e-294 < y

    1. Initial program 5.9

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

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

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

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

Runtime

Time bar (total: 31.6s) Debug log

Please include this information when filing a bug report:

herbie --seed '#(3663857942 159484730 3367875525 4143958929 2381550403 3748760641)'
(FPCore (x y z t a)
  :name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, F"

  :target
  (if (< y -1.0761266216389975e-10) (- x (/ 1 (/ (/ a (- z t)) y))) (if (< y 2.894426862792089e-49) (- x (/ (* y (- z t)) a)) (- x (/ y (/ a (- z t))))))

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