Average Error: 21.0 → 7.2
Time: 1.0m
Precision: 64
\[\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 -3.106524866606892 \cdot 10^{-06}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9.0 \cdot \frac{x}{\frac{c}{y} \cdot z}\right) - 4.0 \cdot \frac{a}{\frac{c}{t}}\\ \mathbf{elif}\;c \le 5.809570948300936 \cdot 10^{-42}:\\ \;\;\;\;\frac{1}{\frac{c}{\frac{y \cdot \left(9.0 \cdot x\right) + b}{z} - \left(4.0 \cdot t\right) \cdot a}}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9.0 \cdot \frac{x}{\frac{z \cdot c}{y}}\right) - 4.0 \cdot \frac{\frac{a}{c}}{\frac{1}{t}}\\ \end{array}\]
\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 -3.106524866606892 \cdot 10^{-06}:\\
\;\;\;\;\left(\frac{b}{z \cdot c} + 9.0 \cdot \frac{x}{\frac{c}{y} \cdot z}\right) - 4.0 \cdot \frac{a}{\frac{c}{t}}\\

\mathbf{elif}\;c \le 5.809570948300936 \cdot 10^{-42}:\\
\;\;\;\;\frac{1}{\frac{c}{\frac{y \cdot \left(9.0 \cdot x\right) + b}{z} - \left(4.0 \cdot t\right) \cdot a}}\\

\mathbf{else}:\\
\;\;\;\;\left(\frac{b}{z \cdot c} + 9.0 \cdot \frac{x}{\frac{z \cdot c}{y}}\right) - 4.0 \cdot \frac{\frac{a}{c}}{\frac{1}{t}}\\

\end{array}
double f(double x, double y, double z, double t, double a, double b, double c) {
        double r36537223 = x;
        double r36537224 = 9.0;
        double r36537225 = r36537223 * r36537224;
        double r36537226 = y;
        double r36537227 = r36537225 * r36537226;
        double r36537228 = z;
        double r36537229 = 4.0;
        double r36537230 = r36537228 * r36537229;
        double r36537231 = t;
        double r36537232 = r36537230 * r36537231;
        double r36537233 = a;
        double r36537234 = r36537232 * r36537233;
        double r36537235 = r36537227 - r36537234;
        double r36537236 = b;
        double r36537237 = r36537235 + r36537236;
        double r36537238 = c;
        double r36537239 = r36537228 * r36537238;
        double r36537240 = r36537237 / r36537239;
        return r36537240;
}

double f(double x, double y, double z, double t, double a, double b, double c) {
        double r36537241 = c;
        double r36537242 = -3.106524866606892e-06;
        bool r36537243 = r36537241 <= r36537242;
        double r36537244 = b;
        double r36537245 = z;
        double r36537246 = r36537245 * r36537241;
        double r36537247 = r36537244 / r36537246;
        double r36537248 = 9.0;
        double r36537249 = x;
        double r36537250 = y;
        double r36537251 = r36537241 / r36537250;
        double r36537252 = r36537251 * r36537245;
        double r36537253 = r36537249 / r36537252;
        double r36537254 = r36537248 * r36537253;
        double r36537255 = r36537247 + r36537254;
        double r36537256 = 4.0;
        double r36537257 = a;
        double r36537258 = t;
        double r36537259 = r36537241 / r36537258;
        double r36537260 = r36537257 / r36537259;
        double r36537261 = r36537256 * r36537260;
        double r36537262 = r36537255 - r36537261;
        double r36537263 = 5.809570948300936e-42;
        bool r36537264 = r36537241 <= r36537263;
        double r36537265 = 1.0;
        double r36537266 = r36537248 * r36537249;
        double r36537267 = r36537250 * r36537266;
        double r36537268 = r36537267 + r36537244;
        double r36537269 = r36537268 / r36537245;
        double r36537270 = r36537256 * r36537258;
        double r36537271 = r36537270 * r36537257;
        double r36537272 = r36537269 - r36537271;
        double r36537273 = r36537241 / r36537272;
        double r36537274 = r36537265 / r36537273;
        double r36537275 = r36537246 / r36537250;
        double r36537276 = r36537249 / r36537275;
        double r36537277 = r36537248 * r36537276;
        double r36537278 = r36537247 + r36537277;
        double r36537279 = r36537257 / r36537241;
        double r36537280 = r36537265 / r36537258;
        double r36537281 = r36537279 / r36537280;
        double r36537282 = r36537256 * r36537281;
        double r36537283 = r36537278 - r36537282;
        double r36537284 = r36537264 ? r36537274 : r36537283;
        double r36537285 = r36537243 ? r36537262 : r36537284;
        return r36537285;
}

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

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original21.0
Target15.0
Herbie7.2
\[\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{elif}\;\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{elif}\;\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{elif}\;\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{elif}\;\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 3 regimes
  2. if c < -3.106524866606892e-06

    1. Initial program 23.9

      \[\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. Simplified19.1

      \[\leadsto \color{blue}{\frac{\frac{b + \left(x \cdot 9.0\right) \cdot y}{z} - \left(t \cdot 4.0\right) \cdot a}{c}}\]
    3. Taylor expanded around 0 15.4

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

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

      \[\leadsto \left(9.0 \cdot \color{blue}{\frac{x}{\frac{z \cdot c}{y}}} + \frac{b}{z \cdot c}\right) - 4.0 \cdot \frac{a}{\frac{c}{t}}\]
    8. Using strategy rm
    9. Applied *-un-lft-identity9.9

      \[\leadsto \left(9.0 \cdot \frac{x}{\frac{z \cdot c}{\color{blue}{1 \cdot y}}} + \frac{b}{z \cdot c}\right) - 4.0 \cdot \frac{a}{\frac{c}{t}}\]
    10. Applied times-frac8.4

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

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

    if -3.106524866606892e-06 < c < 5.809570948300936e-42

    1. Initial program 14.1

      \[\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. Simplified2.9

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

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

    if 5.809570948300936e-42 < c

    1. Initial program 23.3

      \[\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. Simplified16.1

      \[\leadsto \color{blue}{\frac{\frac{b + \left(x \cdot 9.0\right) \cdot y}{z} - \left(t \cdot 4.0\right) \cdot a}{c}}\]
    3. Taylor expanded around 0 14.2

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \le -3.106524866606892 \cdot 10^{-06}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9.0 \cdot \frac{x}{\frac{c}{y} \cdot z}\right) - 4.0 \cdot \frac{a}{\frac{c}{t}}\\ \mathbf{elif}\;c \le 5.809570948300936 \cdot 10^{-42}:\\ \;\;\;\;\frac{1}{\frac{c}{\frac{y \cdot \left(9.0 \cdot x\right) + b}{z} - \left(4.0 \cdot t\right) \cdot a}}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9.0 \cdot \frac{x}{\frac{z \cdot c}{y}}\right) - 4.0 \cdot \frac{\frac{a}{c}}{\frac{1}{t}}\\ \end{array}\]

Reproduce

herbie shell --seed 2019165 
(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)))