Average Error: 7.3 → 8.0
Time: 10.8s
Precision: 64
\[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
\[0.5 \cdot \frac{x}{\frac{a}{y}} - \frac{4.5 \cdot \left(t \cdot z\right)}{a}\]
\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}
0.5 \cdot \frac{x}{\frac{a}{y}} - \frac{4.5 \cdot \left(t \cdot z\right)}{a}
double f(double x, double y, double z, double t, double a) {
        double r437652 = x;
        double r437653 = y;
        double r437654 = r437652 * r437653;
        double r437655 = z;
        double r437656 = 9.0;
        double r437657 = r437655 * r437656;
        double r437658 = t;
        double r437659 = r437657 * r437658;
        double r437660 = r437654 - r437659;
        double r437661 = a;
        double r437662 = 2.0;
        double r437663 = r437661 * r437662;
        double r437664 = r437660 / r437663;
        return r437664;
}

double f(double x, double y, double z, double t, double a) {
        double r437665 = 0.5;
        double r437666 = x;
        double r437667 = a;
        double r437668 = y;
        double r437669 = r437667 / r437668;
        double r437670 = r437666 / r437669;
        double r437671 = r437665 * r437670;
        double r437672 = 4.5;
        double r437673 = t;
        double r437674 = z;
        double r437675 = r437673 * r437674;
        double r437676 = r437672 * r437675;
        double r437677 = r437676 / r437667;
        double r437678 = r437671 - r437677;
        return r437678;
}

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

Original7.3
Target5.5
Herbie8.0
\[\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 4 regimes
  2. if (* x y) < -inf.0

    1. Initial program 64.0

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
    2. Taylor expanded around 0 64.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-*r/64.0

      \[\leadsto 0.5 \cdot \frac{x \cdot y}{a} - \color{blue}{\frac{4.5 \cdot \left(t \cdot z\right)}{a}}\]
    5. Using strategy rm
    6. Applied *-un-lft-identity64.0

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

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

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

    if -inf.0 < (* x y) < -1.8798820468816307e+17

    1. Initial program 4.3

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

      \[\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*1.9

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

    if -1.8798820468816307e+17 < (* x y) < 2.7107991116943106e+188

    1. Initial program 3.8

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

      \[\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-inv3.7

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

    if 2.7107991116943106e+188 < (* x y)

    1. Initial program 27.9

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

      \[\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-*r/27.7

      \[\leadsto 0.5 \cdot \frac{x \cdot y}{a} - \color{blue}{\frac{4.5 \cdot \left(t \cdot z\right)}{a}}\]
    5. Using strategy rm
    6. Applied associate-/l*6.6

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

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

Reproduce

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