Average Error: 19.8 → 9.3
Time: 2.0m
Precision: 64
Internal Precision: 384
\[\frac{\left(\left(x \cdot 9.0\right) \cdot y - \left(\left(z \cdot 4.0\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}\]
\[\begin{array}{l} \mathbf{if}\;c \le -4.518506568601351 \cdot 10^{+81}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9.0 \cdot \frac{y \cdot \frac{x}{c}}{z}\right) - 4.0 \cdot \frac{a}{\frac{c}{t}}\\ \mathbf{if}\;c \le 2.7389558874700873 \cdot 10^{+193}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9.0 \cdot \left(\left(\frac{y}{z} \cdot x\right) \cdot \frac{1}{c}\right)\right) - 4.0 \cdot \frac{a}{\frac{c}{t}}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9.0 \cdot \frac{y \cdot \frac{x}{c}}{z}\right) - 4.0 \cdot \frac{a}{\frac{c}{t}}\\ \end{array}\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Bits error versus b

Bits error versus c

Target

Original19.8
Target14.0
Herbie9.3
\[\begin{array}{l} \mathbf{if}\;\frac{\left(\left(x \cdot 9.0\right) \cdot y - \left(\left(z \cdot 4.0\right) \cdot t\right) \cdot a\right) + b}{z \cdot c} \lt -1.100156740804105 \cdot 10^{-171}:\\ \;\;\;\;\frac{\left(\left(x \cdot 9.0\right) \cdot y - \left(z \cdot 4.0\right) \cdot \left(t \cdot a\right)\right) + b}{z \cdot c}\\ \mathbf{if}\;\frac{\left(\left(x \cdot 9.0\right) \cdot y - \left(\left(z \cdot 4.0\right) \cdot t\right) \cdot a\right) + b}{z \cdot c} \lt -0.0:\\ \;\;\;\;\frac{\frac{\left(\left(x \cdot 9.0\right) \cdot y - \left(\left(z \cdot 4.0\right) \cdot t\right) \cdot a\right) + b}{z}}{c}\\ \mathbf{if}\;\frac{\left(\left(x \cdot 9.0\right) \cdot y - \left(\left(z \cdot 4.0\right) \cdot t\right) \cdot a\right) + b}{z \cdot c} \lt 1.1708877911747488 \cdot 10^{-53}:\\ \;\;\;\;\frac{\left(\left(x \cdot 9.0\right) \cdot y - \left(z \cdot 4.0\right) \cdot \left(t \cdot a\right)\right) + b}{z \cdot c}\\ \mathbf{if}\;\frac{\left(\left(x \cdot 9.0\right) \cdot y - \left(\left(z \cdot 4.0\right) \cdot t\right) \cdot a\right) + b}{z \cdot c} \lt 2.876823679546137 \cdot 10^{+130}:\\ \;\;\;\;\left(\left(9.0 \cdot \frac{y}{c}\right) \cdot \frac{x}{z} + \frac{b}{c \cdot z}\right) - 4.0 \cdot \frac{a \cdot t}{c}\\ \mathbf{if}\;\frac{\left(\left(x \cdot 9.0\right) \cdot y - \left(\left(z \cdot 4.0\right) \cdot t\right) \cdot a\right) + b}{z \cdot c} \lt 1.3838515042456319 \cdot 10^{+158}:\\ \;\;\;\;\frac{\left(\left(x \cdot 9.0\right) \cdot y - \left(z \cdot 4.0\right) \cdot \left(t \cdot a\right)\right) + b}{z \cdot c}\\ \mathbf{else}:\\ \;\;\;\;\left(9.0 \cdot \left(\frac{y}{c \cdot z} \cdot x\right) + \frac{b}{c \cdot z}\right) - 4.0 \cdot \frac{a \cdot t}{c}\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if c < -4.518506568601351e+81 or 2.7389558874700873e+193 < c

    1. Initial program 24.7

      \[\frac{\left(\left(x \cdot 9.0\right) \cdot y - \left(\left(z \cdot 4.0\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}\]
    2. Taylor expanded around 0 16.4

      \[\leadsto \color{blue}{\left(\frac{b}{z \cdot c} + 9.0 \cdot \frac{y \cdot x}{z \cdot c}\right) - 4.0 \cdot \frac{a \cdot t}{c}}\]
    3. Using strategy rm
    4. Applied associate-/l*13.2

      \[\leadsto \left(\frac{b}{z \cdot c} + 9.0 \cdot \frac{y \cdot x}{z \cdot c}\right) - 4.0 \cdot \color{blue}{\frac{a}{\frac{c}{t}}}\]
    5. Using strategy rm
    6. Applied times-frac12.4

      \[\leadsto \left(\frac{b}{z \cdot c} + 9.0 \cdot \color{blue}{\left(\frac{y}{z} \cdot \frac{x}{c}\right)}\right) - 4.0 \cdot \frac{a}{\frac{c}{t}}\]
    7. Using strategy rm
    8. Applied associate-*l/8.9

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

    if -4.518506568601351e+81 < c < 2.7389558874700873e+193

    1. Initial program 16.4

      \[\frac{\left(\left(x \cdot 9.0\right) \cdot y - \left(\left(z \cdot 4.0\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}\]
    2. Taylor expanded around 0 7.8

      \[\leadsto \color{blue}{\left(\frac{b}{z \cdot c} + 9.0 \cdot \frac{y \cdot x}{z \cdot c}\right) - 4.0 \cdot \frac{a \cdot t}{c}}\]
    3. Using strategy rm
    4. Applied associate-/l*9.3

      \[\leadsto \left(\frac{b}{z \cdot c} + 9.0 \cdot \frac{y \cdot x}{z \cdot c}\right) - 4.0 \cdot \color{blue}{\frac{a}{\frac{c}{t}}}\]
    5. Using strategy rm
    6. Applied times-frac11.5

      \[\leadsto \left(\frac{b}{z \cdot c} + 9.0 \cdot \color{blue}{\left(\frac{y}{z} \cdot \frac{x}{c}\right)}\right) - 4.0 \cdot \frac{a}{\frac{c}{t}}\]
    7. Using strategy rm
    8. Applied div-inv11.5

      \[\leadsto \left(\frac{b}{z \cdot c} + 9.0 \cdot \left(\frac{y}{z} \cdot \color{blue}{\left(x \cdot \frac{1}{c}\right)}\right)\right) - 4.0 \cdot \frac{a}{\frac{c}{t}}\]
    9. Applied associate-*r*9.6

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

Runtime

Time bar (total: 2.0m)Debug log

herbie shell --seed '#(1567391828 2030694642 2833800258 828025724 3004380912 3532991858)' +o setup:early-exit
(FPCore (x y z t a b c)
  :name "Diagrams.Solve.Polynomial:cubForm  from diagrams-solve-0.1, J"

  :herbie-target
  (if (< (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)) -1.100156740804105e-171) (/ (+ (- (* (* x 9.0) y) (* (* z 4.0) (* t a))) b) (* z c)) (if (< (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)) -0.0) (/ (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) z) c) (if (< (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)) 1.1708877911747488e-53) (/ (+ (- (* (* x 9.0) y) (* (* z 4.0) (* t a))) b) (* z c)) (if (< (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)) 2.876823679546137e+130) (- (+ (* (* 9.0 (/ y c)) (/ x z)) (/ b (* c z))) (* 4.0 (/ (* a t) c))) (if (< (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)) 1.3838515042456319e+158) (/ (+ (- (* (* x 9.0) y) (* (* z 4.0) (* t a))) b) (* z c)) (- (+ (* 9.0 (* (/ y (* c z)) x)) (/ b (* c z))) (* 4.0 (/ (* a t) c))))))))

  (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)))