Average Error: 8.0 → 0.9
Time: 17.2s
Precision: 64
\[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y - \left(z \cdot 9\right) \cdot t \le -3.397261068180268733517436164043746284167 \cdot 10^{288} \lor \neg \left(x \cdot y - \left(z \cdot 9\right) \cdot t \le 3.753404758648867148597172224071890067461 \cdot 10^{280}\right):\\ \;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a}\right) - 4.5 \cdot \frac{t}{\frac{a}{z}}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(\left(x \cdot y\right) \cdot \frac{1}{a}\right) - 4.5 \cdot \frac{t \cdot z}{a}\\ \end{array}\]
\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}
\begin{array}{l}
\mathbf{if}\;x \cdot y - \left(z \cdot 9\right) \cdot t \le -3.397261068180268733517436164043746284167 \cdot 10^{288} \lor \neg \left(x \cdot y - \left(z \cdot 9\right) \cdot t \le 3.753404758648867148597172224071890067461 \cdot 10^{280}\right):\\
\;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a}\right) - 4.5 \cdot \frac{t}{\frac{a}{z}}\\

\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(\left(x \cdot y\right) \cdot \frac{1}{a}\right) - 4.5 \cdot \frac{t \cdot z}{a}\\

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r473281 = x;
        double r473282 = y;
        double r473283 = r473281 * r473282;
        double r473284 = z;
        double r473285 = 9.0;
        double r473286 = r473284 * r473285;
        double r473287 = t;
        double r473288 = r473286 * r473287;
        double r473289 = r473283 - r473288;
        double r473290 = a;
        double r473291 = 2.0;
        double r473292 = r473290 * r473291;
        double r473293 = r473289 / r473292;
        return r473293;
}

double f(double x, double y, double z, double t, double a) {
        double r473294 = x;
        double r473295 = y;
        double r473296 = r473294 * r473295;
        double r473297 = z;
        double r473298 = 9.0;
        double r473299 = r473297 * r473298;
        double r473300 = t;
        double r473301 = r473299 * r473300;
        double r473302 = r473296 - r473301;
        double r473303 = -3.397261068180269e+288;
        bool r473304 = r473302 <= r473303;
        double r473305 = 3.753404758648867e+280;
        bool r473306 = r473302 <= r473305;
        double r473307 = !r473306;
        bool r473308 = r473304 || r473307;
        double r473309 = 0.5;
        double r473310 = a;
        double r473311 = r473295 / r473310;
        double r473312 = r473294 * r473311;
        double r473313 = r473309 * r473312;
        double r473314 = 4.5;
        double r473315 = r473310 / r473297;
        double r473316 = r473300 / r473315;
        double r473317 = r473314 * r473316;
        double r473318 = r473313 - r473317;
        double r473319 = 1.0;
        double r473320 = r473319 / r473310;
        double r473321 = r473296 * r473320;
        double r473322 = r473309 * r473321;
        double r473323 = r473300 * r473297;
        double r473324 = r473323 / r473310;
        double r473325 = r473314 * r473324;
        double r473326 = r473322 - r473325;
        double r473327 = r473308 ? r473318 : r473326;
        return r473327;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original8.0
Target5.5
Herbie0.9
\[\begin{array}{l} \mathbf{if}\;a \lt -2.090464557976709043451944897028999329376 \cdot 10^{86}:\\ \;\;\;\;0.5 \cdot \frac{y \cdot x}{a} - 4.5 \cdot \frac{t}{\frac{a}{z}}\\ \mathbf{elif}\;a \lt 2.144030707833976090627817222818061808815 \cdot 10^{99}:\\ \;\;\;\;\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{a} \cdot \left(x \cdot 0.5\right) - \frac{t}{a} \cdot \left(z \cdot 4.5\right)\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if (- (* x y) (* (* z 9.0) t)) < -3.397261068180269e+288 or 3.753404758648867e+280 < (- (* x y) (* (* z 9.0) t))

    1. Initial program 52.7

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
    2. Taylor expanded around 0 52.0

      \[\leadsto \color{blue}{0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \frac{t \cdot z}{a}}\]
    3. Using strategy rm
    4. Applied associate-/l*26.1

      \[\leadsto 0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \color{blue}{\frac{t}{\frac{a}{z}}}\]
    5. Using strategy rm
    6. Applied *-un-lft-identity26.1

      \[\leadsto 0.5 \cdot \frac{x \cdot y}{\color{blue}{1 \cdot a}} - 4.5 \cdot \frac{t}{\frac{a}{z}}\]
    7. Applied times-frac0.4

      \[\leadsto 0.5 \cdot \color{blue}{\left(\frac{x}{1} \cdot \frac{y}{a}\right)} - 4.5 \cdot \frac{t}{\frac{a}{z}}\]
    8. Simplified0.4

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

    if -3.397261068180269e+288 < (- (* x y) (* (* z 9.0) t)) < 3.753404758648867e+280

    1. Initial program 1.0

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
    2. Taylor expanded around 0 1.0

      \[\leadsto \color{blue}{0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \frac{t \cdot z}{a}}\]
    3. Using strategy rm
    4. Applied div-inv1.0

      \[\leadsto 0.5 \cdot \color{blue}{\left(\left(x \cdot y\right) \cdot \frac{1}{a}\right)} - 4.5 \cdot \frac{t \cdot z}{a}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.9

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y - \left(z \cdot 9\right) \cdot t \le -3.397261068180268733517436164043746284167 \cdot 10^{288} \lor \neg \left(x \cdot y - \left(z \cdot 9\right) \cdot t \le 3.753404758648867148597172224071890067461 \cdot 10^{280}\right):\\ \;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a}\right) - 4.5 \cdot \frac{t}{\frac{a}{z}}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(\left(x \cdot y\right) \cdot \frac{1}{a}\right) - 4.5 \cdot \frac{t \cdot z}{a}\\ \end{array}\]

Reproduce

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

  :herbie-target
  (if (< a -2.090464557976709e86) (- (* 0.5 (/ (* y x) a)) (* 4.5 (/ t (/ a z)))) (if (< a 2.14403070783397609e99) (/ (- (* x y) (* z (* 9 t))) (* a 2)) (- (* (/ y a) (* x 0.5)) (* (/ t a) (* z 4.5)))))

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