Average Error: 7.7 → 4.2
Time: 14.2s
Precision: 64
\[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
\[\begin{array}{l} \mathbf{if}\;a \le -1.228510223266635066615353468569416308744 \cdot 10^{-99}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - 4.5 \cdot \frac{t}{\frac{a}{z}}\\ \mathbf{elif}\;a \le 64104884799497751389513187328:\\ \;\;\;\;\frac{0.5 \cdot \left(x \cdot y\right) - 4.5 \cdot \left(t \cdot z\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(\frac{x}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{y}{\sqrt[3]{a}}\right) - 4.5 \cdot \frac{t}{\frac{a}{z}}\\ \end{array}\]
\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}
\begin{array}{l}
\mathbf{if}\;a \le -1.228510223266635066615353468569416308744 \cdot 10^{-99}:\\
\;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - 4.5 \cdot \frac{t}{\frac{a}{z}}\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r496306 = x;
        double r496307 = y;
        double r496308 = r496306 * r496307;
        double r496309 = z;
        double r496310 = 9.0;
        double r496311 = r496309 * r496310;
        double r496312 = t;
        double r496313 = r496311 * r496312;
        double r496314 = r496308 - r496313;
        double r496315 = a;
        double r496316 = 2.0;
        double r496317 = r496315 * r496316;
        double r496318 = r496314 / r496317;
        return r496318;
}

double f(double x, double y, double z, double t, double a) {
        double r496319 = a;
        double r496320 = -1.228510223266635e-99;
        bool r496321 = r496319 <= r496320;
        double r496322 = 0.5;
        double r496323 = x;
        double r496324 = y;
        double r496325 = r496319 / r496324;
        double r496326 = r496323 / r496325;
        double r496327 = r496322 * r496326;
        double r496328 = 4.5;
        double r496329 = t;
        double r496330 = z;
        double r496331 = r496319 / r496330;
        double r496332 = r496329 / r496331;
        double r496333 = r496328 * r496332;
        double r496334 = r496327 - r496333;
        double r496335 = 6.410488479949775e+28;
        bool r496336 = r496319 <= r496335;
        double r496337 = r496323 * r496324;
        double r496338 = r496322 * r496337;
        double r496339 = r496329 * r496330;
        double r496340 = r496328 * r496339;
        double r496341 = r496338 - r496340;
        double r496342 = r496341 / r496319;
        double r496343 = cbrt(r496319);
        double r496344 = r496343 * r496343;
        double r496345 = r496323 / r496344;
        double r496346 = r496324 / r496343;
        double r496347 = r496345 * r496346;
        double r496348 = r496322 * r496347;
        double r496349 = r496348 - r496333;
        double r496350 = r496336 ? r496342 : r496349;
        double r496351 = r496321 ? r496334 : r496350;
        return r496351;
}

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.7
Target5.2
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 3 regimes
  2. if a < -1.228510223266635e-99

    1. Initial program 9.0

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

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

      \[\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-/l*5.2

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

    if -1.228510223266635e-99 < a < 6.410488479949775e+28

    1. Initial program 1.5

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

      \[\leadsto 0.5 \cdot \frac{x \cdot y}{a} - \color{blue}{\frac{4.5 \cdot \left(t \cdot z\right)}{a}}\]
    5. Applied associate-*r/1.5

      \[\leadsto \color{blue}{\frac{0.5 \cdot \left(x \cdot y\right)}{a}} - \frac{4.5 \cdot \left(t \cdot z\right)}{a}\]
    6. Applied sub-div1.5

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

    if 6.410488479949775e+28 < a

    1. Initial program 12.3

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

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

      \[\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 add-cube-cbrt10.0

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -1.228510223266635066615353468569416308744 \cdot 10^{-99}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - 4.5 \cdot \frac{t}{\frac{a}{z}}\\ \mathbf{elif}\;a \le 64104884799497751389513187328:\\ \;\;\;\;\frac{0.5 \cdot \left(x \cdot y\right) - 4.5 \cdot \left(t \cdot z\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(\frac{x}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{y}{\sqrt[3]{a}}\right) - 4.5 \cdot \frac{t}{\frac{a}{z}}\\ \end{array}\]

Reproduce

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