Average Error: 3.3 → 0.5
Time: 1.3m
Precision: 64
Internal Precision: 384
\[\left(x - \frac{y}{z \cdot 3.0}\right) + \frac{t}{\left(z \cdot 3.0\right) \cdot y}\]
\[\begin{array}{l} \mathbf{if}\;z \le -1.2018128981968222 \cdot 10^{-61}:\\ \;\;\;\;\left(x - \frac{\frac{y}{z}}{3.0}\right) + \frac{t}{\left(z \cdot 3.0\right) \cdot y}\\ \mathbf{if}\;z \le 1.0607797663860536 \cdot 10^{-27}:\\ \;\;\;\;x - \frac{0.3333333333333333}{z} \cdot \left(y - \frac{t}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x - \frac{\frac{y}{z}}{3.0}\right) + \frac{t}{\left(z \cdot 3.0\right) \cdot y}\\ \end{array}\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

Original3.3
Target1.9
Herbie0.5
\[\left(x - \frac{y}{z \cdot 3.0}\right) + \frac{\frac{t}{z \cdot 3.0}}{y}\]

Derivation

  1. Split input into 3 regimes
  2. if z < -1.2018128981968222e-61

    1. Initial program 0.6

      \[\left(x - \frac{y}{z \cdot 3.0}\right) + \frac{t}{\left(z \cdot 3.0\right) \cdot y}\]
    2. Using strategy rm
    3. Applied associate-/r*0.6

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

    if -1.2018128981968222e-61 < z < 1.0607797663860536e-27

    1. Initial program 11.6

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

      \[\leadsto \color{blue}{\left(x + 0.3333333333333333 \cdot \frac{t}{z \cdot y}\right) - 0.3333333333333333 \cdot \frac{y}{z}}\]
    3. Applied simplify0.2

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

    if 1.0607797663860536e-27 < z

    1. Initial program 0.5

      \[\left(x - \frac{y}{z \cdot 3.0}\right) + \frac{t}{\left(z \cdot 3.0\right) \cdot y}\]
    2. Using strategy rm
    3. Applied associate-/r*0.5

      \[\leadsto \left(x - \color{blue}{\frac{\frac{y}{z}}{3.0}}\right) + \frac{t}{\left(z \cdot 3.0\right) \cdot y}\]
  3. Recombined 3 regimes into one program.
  4. 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
(FPCore (x y z t)
  :name "Diagrams.Solve.Polynomial:cubForm  from diagrams-solve-0.1, H"

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

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