Average Error: 19.9 → 7.1
Time: 6.0s
Precision: 64
\[\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}\]
\[\begin{array}{l} \mathbf{if}\;c \le -9.755980397410743649742684071993362525627 \cdot 10^{238}:\\ \;\;\;\;\mathsf{fma}\left(-4, \frac{t}{\frac{c}{a}}, \mathsf{fma}\left(9, \frac{x}{\frac{z \cdot c}{y}}, \frac{b}{z \cdot c}\right)\right)\\ \mathbf{elif}\;c \le -896835397887796577325650839578653753344:\\ \;\;\;\;\mathsf{fma}\left(-4, \frac{t}{\frac{c}{a}}, \frac{1}{z} \cdot \frac{\mathsf{fma}\left(9 \cdot x, y, b\right)}{c}\right)\\ \mathbf{elif}\;c \le 30632114.7795526646077632904052734375:\\ \;\;\;\;\mathsf{fma}\left(-4, \frac{t \cdot a}{c}, \frac{\frac{\mathsf{fma}\left(9 \cdot x, y, b\right)}{z}}{c}\right)\\ \mathbf{elif}\;c \le 1.085731230018495074559249086460757998066 \cdot 10^{214}:\\ \;\;\;\;\mathsf{fma}\left(-4, \frac{t}{\frac{c}{a}}, \mathsf{fma}\left(9, \frac{x}{\frac{z \cdot c}{y}}, \frac{b}{z \cdot c}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-4, \frac{t}{\frac{c}{a}}, \frac{1}{z} \cdot \frac{\mathsf{fma}\left(9 \cdot x, y, b\right)}{c}\right)\\ \end{array}\]
\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}
\begin{array}{l}
\mathbf{if}\;c \le -9.755980397410743649742684071993362525627 \cdot 10^{238}:\\
\;\;\;\;\mathsf{fma}\left(-4, \frac{t}{\frac{c}{a}}, \mathsf{fma}\left(9, \frac{x}{\frac{z \cdot c}{y}}, \frac{b}{z \cdot c}\right)\right)\\

\mathbf{elif}\;c \le -896835397887796577325650839578653753344:\\
\;\;\;\;\mathsf{fma}\left(-4, \frac{t}{\frac{c}{a}}, \frac{1}{z} \cdot \frac{\mathsf{fma}\left(9 \cdot x, y, b\right)}{c}\right)\\

\mathbf{elif}\;c \le 30632114.7795526646077632904052734375:\\
\;\;\;\;\mathsf{fma}\left(-4, \frac{t \cdot a}{c}, \frac{\frac{\mathsf{fma}\left(9 \cdot x, y, b\right)}{z}}{c}\right)\\

\mathbf{elif}\;c \le 1.085731230018495074559249086460757998066 \cdot 10^{214}:\\
\;\;\;\;\mathsf{fma}\left(-4, \frac{t}{\frac{c}{a}}, \mathsf{fma}\left(9, \frac{x}{\frac{z \cdot c}{y}}, \frac{b}{z \cdot c}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-4, \frac{t}{\frac{c}{a}}, \frac{1}{z} \cdot \frac{\mathsf{fma}\left(9 \cdot x, y, b\right)}{c}\right)\\

\end{array}
double f(double x, double y, double z, double t, double a, double b, double c) {
        double r1018256 = x;
        double r1018257 = 9.0;
        double r1018258 = r1018256 * r1018257;
        double r1018259 = y;
        double r1018260 = r1018258 * r1018259;
        double r1018261 = z;
        double r1018262 = 4.0;
        double r1018263 = r1018261 * r1018262;
        double r1018264 = t;
        double r1018265 = r1018263 * r1018264;
        double r1018266 = a;
        double r1018267 = r1018265 * r1018266;
        double r1018268 = r1018260 - r1018267;
        double r1018269 = b;
        double r1018270 = r1018268 + r1018269;
        double r1018271 = c;
        double r1018272 = r1018261 * r1018271;
        double r1018273 = r1018270 / r1018272;
        return r1018273;
}

double f(double x, double y, double z, double t, double a, double b, double c) {
        double r1018274 = c;
        double r1018275 = -9.755980397410744e+238;
        bool r1018276 = r1018274 <= r1018275;
        double r1018277 = 4.0;
        double r1018278 = -r1018277;
        double r1018279 = t;
        double r1018280 = a;
        double r1018281 = r1018274 / r1018280;
        double r1018282 = r1018279 / r1018281;
        double r1018283 = 9.0;
        double r1018284 = x;
        double r1018285 = z;
        double r1018286 = r1018285 * r1018274;
        double r1018287 = y;
        double r1018288 = r1018286 / r1018287;
        double r1018289 = r1018284 / r1018288;
        double r1018290 = b;
        double r1018291 = r1018290 / r1018286;
        double r1018292 = fma(r1018283, r1018289, r1018291);
        double r1018293 = fma(r1018278, r1018282, r1018292);
        double r1018294 = -8.968353978877966e+38;
        bool r1018295 = r1018274 <= r1018294;
        double r1018296 = 1.0;
        double r1018297 = r1018296 / r1018285;
        double r1018298 = r1018283 * r1018284;
        double r1018299 = fma(r1018298, r1018287, r1018290);
        double r1018300 = r1018299 / r1018274;
        double r1018301 = r1018297 * r1018300;
        double r1018302 = fma(r1018278, r1018282, r1018301);
        double r1018303 = 30632114.779552665;
        bool r1018304 = r1018274 <= r1018303;
        double r1018305 = r1018279 * r1018280;
        double r1018306 = r1018305 / r1018274;
        double r1018307 = r1018299 / r1018285;
        double r1018308 = r1018307 / r1018274;
        double r1018309 = fma(r1018278, r1018306, r1018308);
        double r1018310 = 1.085731230018495e+214;
        bool r1018311 = r1018274 <= r1018310;
        double r1018312 = r1018311 ? r1018293 : r1018302;
        double r1018313 = r1018304 ? r1018309 : r1018312;
        double r1018314 = r1018295 ? r1018302 : r1018313;
        double r1018315 = r1018276 ? r1018293 : r1018314;
        return r1018315;
}

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.9
Target15.0
Herbie7.1
\[\begin{array}{l} \mathbf{if}\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c} \lt -1.100156740804105117061698089246936481893 \cdot 10^{-171}:\\ \;\;\;\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(z \cdot 4\right) \cdot \left(t \cdot a\right)\right) + b}{z \cdot c}\\ \mathbf{elif}\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c} \lt -0.0:\\ \;\;\;\;\frac{\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z}}{c}\\ \mathbf{elif}\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c} \lt 1.170887791174748819600820354912645756062 \cdot 10^{-53}:\\ \;\;\;\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(z \cdot 4\right) \cdot \left(t \cdot a\right)\right) + b}{z \cdot c}\\ \mathbf{elif}\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c} \lt 2.876823679546137226963937101710277849382 \cdot 10^{130}:\\ \;\;\;\;\left(\left(9 \cdot \frac{y}{c}\right) \cdot \frac{x}{z} + \frac{b}{c \cdot z}\right) - 4 \cdot \frac{a \cdot t}{c}\\ \mathbf{elif}\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c} \lt 1.383851504245631860711731716196098366993 \cdot 10^{158}:\\ \;\;\;\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(z \cdot 4\right) \cdot \left(t \cdot a\right)\right) + b}{z \cdot c}\\ \mathbf{else}:\\ \;\;\;\;\left(9 \cdot \left(\frac{y}{c \cdot z} \cdot x\right) + \frac{b}{c \cdot z}\right) - 4 \cdot \frac{a \cdot t}{c}\\ \end{array}\]

Derivation

  1. Split input into 3 regimes
  2. if c < -9.755980397410744e+238 or 30632114.779552665 < c < 1.085731230018495e+214

    1. Initial program 22.7

      \[\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}\]
    2. Simplified15.1

      \[\leadsto \color{blue}{\mathsf{fma}\left(-4, \frac{t \cdot a}{c}, \frac{\mathsf{fma}\left(x, 9 \cdot y, b\right)}{z \cdot c}\right)}\]
    3. Using strategy rm
    4. Applied associate-/l*12.1

      \[\leadsto \mathsf{fma}\left(-4, \color{blue}{\frac{t}{\frac{c}{a}}}, \frac{\mathsf{fma}\left(x, 9 \cdot y, b\right)}{z \cdot c}\right)\]
    5. Taylor expanded around 0 12.0

      \[\leadsto \mathsf{fma}\left(-4, \frac{t}{\frac{c}{a}}, \color{blue}{\frac{b}{z \cdot c} + 9 \cdot \frac{x \cdot y}{z \cdot c}}\right)\]
    6. Simplified12.0

      \[\leadsto \mathsf{fma}\left(-4, \frac{t}{\frac{c}{a}}, \color{blue}{\mathsf{fma}\left(9, \frac{x \cdot y}{z \cdot c}, \frac{b}{z \cdot c}\right)}\right)\]
    7. Using strategy rm
    8. Applied associate-/l*9.5

      \[\leadsto \mathsf{fma}\left(-4, \frac{t}{\frac{c}{a}}, \mathsf{fma}\left(9, \color{blue}{\frac{x}{\frac{z \cdot c}{y}}}, \frac{b}{z \cdot c}\right)\right)\]

    if -9.755980397410744e+238 < c < -8.968353978877966e+38 or 1.085731230018495e+214 < c

    1. Initial program 23.3

      \[\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}\]
    2. Simplified15.7

      \[\leadsto \color{blue}{\mathsf{fma}\left(-4, \frac{t \cdot a}{c}, \frac{\mathsf{fma}\left(x, 9 \cdot y, b\right)}{z \cdot c}\right)}\]
    3. Using strategy rm
    4. Applied associate-/l*12.3

      \[\leadsto \mathsf{fma}\left(-4, \color{blue}{\frac{t}{\frac{c}{a}}}, \frac{\mathsf{fma}\left(x, 9 \cdot y, b\right)}{z \cdot c}\right)\]
    5. Using strategy rm
    6. Applied *-un-lft-identity12.3

      \[\leadsto \mathsf{fma}\left(-4, \frac{t}{\frac{c}{a}}, \frac{\color{blue}{1 \cdot \mathsf{fma}\left(x, 9 \cdot y, b\right)}}{z \cdot c}\right)\]
    7. Applied times-frac9.2

      \[\leadsto \mathsf{fma}\left(-4, \frac{t}{\frac{c}{a}}, \color{blue}{\frac{1}{z} \cdot \frac{\mathsf{fma}\left(x, 9 \cdot y, b\right)}{c}}\right)\]
    8. Simplified9.2

      \[\leadsto \mathsf{fma}\left(-4, \frac{t}{\frac{c}{a}}, \frac{1}{z} \cdot \color{blue}{\frac{\mathsf{fma}\left(9 \cdot x, y, b\right)}{c}}\right)\]

    if -8.968353978877966e+38 < c < 30632114.779552665

    1. Initial program 14.3

      \[\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}\]
    2. Simplified5.4

      \[\leadsto \color{blue}{\mathsf{fma}\left(-4, \frac{t \cdot a}{c}, \frac{\mathsf{fma}\left(x, 9 \cdot y, b\right)}{z \cdot c}\right)}\]
    3. Using strategy rm
    4. Applied associate-/r*3.0

      \[\leadsto \mathsf{fma}\left(-4, \frac{t \cdot a}{c}, \color{blue}{\frac{\frac{\mathsf{fma}\left(x, 9 \cdot y, b\right)}{z}}{c}}\right)\]
    5. Simplified3.0

      \[\leadsto \mathsf{fma}\left(-4, \frac{t \cdot a}{c}, \frac{\color{blue}{\frac{\mathsf{fma}\left(9 \cdot x, y, b\right)}{z}}}{c}\right)\]
  3. Recombined 3 regimes into one program.
  4. Final simplification7.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \le -9.755980397410743649742684071993362525627 \cdot 10^{238}:\\ \;\;\;\;\mathsf{fma}\left(-4, \frac{t}{\frac{c}{a}}, \mathsf{fma}\left(9, \frac{x}{\frac{z \cdot c}{y}}, \frac{b}{z \cdot c}\right)\right)\\ \mathbf{elif}\;c \le -896835397887796577325650839578653753344:\\ \;\;\;\;\mathsf{fma}\left(-4, \frac{t}{\frac{c}{a}}, \frac{1}{z} \cdot \frac{\mathsf{fma}\left(9 \cdot x, y, b\right)}{c}\right)\\ \mathbf{elif}\;c \le 30632114.7795526646077632904052734375:\\ \;\;\;\;\mathsf{fma}\left(-4, \frac{t \cdot a}{c}, \frac{\frac{\mathsf{fma}\left(9 \cdot x, y, b\right)}{z}}{c}\right)\\ \mathbf{elif}\;c \le 1.085731230018495074559249086460757998066 \cdot 10^{214}:\\ \;\;\;\;\mathsf{fma}\left(-4, \frac{t}{\frac{c}{a}}, \mathsf{fma}\left(9, \frac{x}{\frac{z \cdot c}{y}}, \frac{b}{z \cdot c}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-4, \frac{t}{\frac{c}{a}}, \frac{1}{z} \cdot \frac{\mathsf{fma}\left(9 \cdot x, y, b\right)}{c}\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019362 +o rules:numerics
(FPCore (x y z t a b c)
  :name "Diagrams.Solve.Polynomial:cubForm  from diagrams-solve-0.1, J"
  :precision binary64

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

  (/ (+ (- (* (* x 9) y) (* (* (* z 4) t) a)) b) (* z c)))