Average Error: 7.3 → 4.2
Time: 3.8s
Precision: 64
\[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
\[\begin{array}{l} \mathbf{if}\;a \cdot 2 \le -1.186352449555409772300601511929585285543 \cdot 10^{-4}:\\ \;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a}\right) - 4.5 \cdot \frac{t}{\frac{a}{z}}\\ \mathbf{elif}\;a \cdot 2 \le 1.991114129634725570451632963990079700412 \cdot 10^{-22}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - \left(4.5 \cdot \left(t \cdot z\right)\right) \cdot \frac{1}{a}\\ \mathbf{elif}\;a \cdot 2 \le 2.613794900569257027791129745425388273253 \cdot 10^{222}:\\ \;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a}\right) - 4.5 \cdot \frac{t}{\frac{a}{z}}\\ \mathbf{elif}\;a \cdot 2 \le 3.349885366301817315811260673424127640942 \cdot 10^{285}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \left(\frac{t}{a} \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{a \cdot 2}{x \cdot y - 9 \cdot \left(t \cdot z\right)}}\\ \end{array}\]
\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}
\begin{array}{l}
\mathbf{if}\;a \cdot 2 \le -1.186352449555409772300601511929585285543 \cdot 10^{-4}:\\
\;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a}\right) - 4.5 \cdot \frac{t}{\frac{a}{z}}\\

\mathbf{elif}\;a \cdot 2 \le 1.991114129634725570451632963990079700412 \cdot 10^{-22}:\\
\;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - \left(4.5 \cdot \left(t \cdot z\right)\right) \cdot \frac{1}{a}\\

\mathbf{elif}\;a \cdot 2 \le 2.613794900569257027791129745425388273253 \cdot 10^{222}:\\
\;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a}\right) - 4.5 \cdot \frac{t}{\frac{a}{z}}\\

\mathbf{elif}\;a \cdot 2 \le 3.349885366301817315811260673424127640942 \cdot 10^{285}:\\
\;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \left(\frac{t}{a} \cdot z\right)\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r799145 = x;
        double r799146 = y;
        double r799147 = r799145 * r799146;
        double r799148 = z;
        double r799149 = 9.0;
        double r799150 = r799148 * r799149;
        double r799151 = t;
        double r799152 = r799150 * r799151;
        double r799153 = r799147 - r799152;
        double r799154 = a;
        double r799155 = 2.0;
        double r799156 = r799154 * r799155;
        double r799157 = r799153 / r799156;
        return r799157;
}

double f(double x, double y, double z, double t, double a) {
        double r799158 = a;
        double r799159 = 2.0;
        double r799160 = r799158 * r799159;
        double r799161 = -0.00011863524495554098;
        bool r799162 = r799160 <= r799161;
        double r799163 = 0.5;
        double r799164 = x;
        double r799165 = y;
        double r799166 = r799165 / r799158;
        double r799167 = r799164 * r799166;
        double r799168 = r799163 * r799167;
        double r799169 = 4.5;
        double r799170 = t;
        double r799171 = z;
        double r799172 = r799158 / r799171;
        double r799173 = r799170 / r799172;
        double r799174 = r799169 * r799173;
        double r799175 = r799168 - r799174;
        double r799176 = 1.9911141296347256e-22;
        bool r799177 = r799160 <= r799176;
        double r799178 = r799164 * r799165;
        double r799179 = r799178 / r799158;
        double r799180 = r799163 * r799179;
        double r799181 = r799170 * r799171;
        double r799182 = r799169 * r799181;
        double r799183 = 1.0;
        double r799184 = r799183 / r799158;
        double r799185 = r799182 * r799184;
        double r799186 = r799180 - r799185;
        double r799187 = 2.613794900569257e+222;
        bool r799188 = r799160 <= r799187;
        double r799189 = 3.3498853663018173e+285;
        bool r799190 = r799160 <= r799189;
        double r799191 = r799170 / r799158;
        double r799192 = r799191 * r799171;
        double r799193 = r799169 * r799192;
        double r799194 = r799180 - r799193;
        double r799195 = 9.0;
        double r799196 = r799195 * r799181;
        double r799197 = r799178 - r799196;
        double r799198 = r799160 / r799197;
        double r799199 = r799183 / r799198;
        double r799200 = r799190 ? r799194 : r799199;
        double r799201 = r799188 ? r799175 : r799200;
        double r799202 = r799177 ? r799186 : r799201;
        double r799203 = r799162 ? r799175 : r799202;
        return r799203;
}

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
Herbie4.2
\[\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 (* a 2.0) < -0.00011863524495554098 or 1.9911141296347256e-22 < (* a 2.0) < 2.613794900569257e+222

    1. Initial program 9.6

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

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

      \[\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-identity8.0

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

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

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

    if -0.00011863524495554098 < (* a 2.0) < 1.9911141296347256e-22

    1. Initial program 1.6

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

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

      \[\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)}\]
    5. Applied associate-*r*1.6

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

    if 2.613794900569257e+222 < (* a 2.0) < 3.3498853663018173e+285

    1. Initial program 13.6

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

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

      \[\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 associate-/r/8.8

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

    if 3.3498853663018173e+285 < (* a 2.0)

    1. Initial program 12.2

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

      \[\leadsto \frac{\color{blue}{x \cdot y - 9 \cdot \left(t \cdot z\right)}}{a \cdot 2}\]
    3. Using strategy rm
    4. Applied clear-num12.7

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot 2 \le -1.186352449555409772300601511929585285543 \cdot 10^{-4}:\\ \;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a}\right) - 4.5 \cdot \frac{t}{\frac{a}{z}}\\ \mathbf{elif}\;a \cdot 2 \le 1.991114129634725570451632963990079700412 \cdot 10^{-22}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - \left(4.5 \cdot \left(t \cdot z\right)\right) \cdot \frac{1}{a}\\ \mathbf{elif}\;a \cdot 2 \le 2.613794900569257027791129745425388273253 \cdot 10^{222}:\\ \;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a}\right) - 4.5 \cdot \frac{t}{\frac{a}{z}}\\ \mathbf{elif}\;a \cdot 2 \le 3.349885366301817315811260673424127640942 \cdot 10^{285}:\\ \;\;\;\;0.5 \cdot \frac{x \cdot y}{a} - 4.5 \cdot \left(\frac{t}{a} \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{a \cdot 2}{x \cdot y - 9 \cdot \left(t \cdot z\right)}}\\ \end{array}\]

Reproduce

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

  :herbie-target
  (if (< a -2.090464557976709e+86) (- (* 0.5 (/ (* y x) a)) (* 4.5 (/ t (/ a z)))) (if (< a 2.144030707833976e+99) (/ (- (* x y) (* z (* 9 t))) (* a 2)) (- (* (/ y a) (* x 0.5)) (* (/ t a) (* z 4.5)))))

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