Average Error: 8.1 → 6.0
Time: 17.3s
Precision: 64
\[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
\[\begin{array}{l} \mathbf{if}\;z \le -3.964589955066153110151496336303542089574 \cdot 10^{-11}:\\ \;\;\;\;0.5 \cdot \frac{\frac{x}{a}}{\frac{1}{y}} - \left(4.5 \cdot \frac{t}{\sqrt[3]{a} \cdot \sqrt[3]{a}}\right) \cdot \frac{z}{\sqrt[3]{a}}\\ \mathbf{elif}\;z \le -5.447225618720536963997999586482503099222 \cdot 10^{-151}:\\ \;\;\;\;\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}\\ \mathbf{elif}\;z \le -1.205276844410740904002305820307771088332 \cdot 10^{-273}:\\ \;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a}\right) - 4.5 \cdot \frac{t \cdot z}{a}\\ \mathbf{elif}\;z \le 2.107113103927587276409729491380626109261 \cdot 10^{-227}:\\ \;\;\;\;0.5 \cdot \left(\frac{x}{a} \cdot y\right) - 4.5 \cdot \frac{t \cdot z}{a}\\ \mathbf{elif}\;z \le 8.760394845593749117763722532018894881612 \cdot 10^{105}:\\ \;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a}\right) - 4.5 \cdot \frac{t \cdot z}{a}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - \left(t \cdot 4.5\right) \cdot \frac{z}{a}\\ \end{array}\]
\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}
\begin{array}{l}
\mathbf{if}\;z \le -3.964589955066153110151496336303542089574 \cdot 10^{-11}:\\
\;\;\;\;0.5 \cdot \frac{\frac{x}{a}}{\frac{1}{y}} - \left(4.5 \cdot \frac{t}{\sqrt[3]{a} \cdot \sqrt[3]{a}}\right) \cdot \frac{z}{\sqrt[3]{a}}\\

\mathbf{elif}\;z \le -5.447225618720536963997999586482503099222 \cdot 10^{-151}:\\
\;\;\;\;\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}\\

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

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

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r489020 = x;
        double r489021 = y;
        double r489022 = r489020 * r489021;
        double r489023 = z;
        double r489024 = 9.0;
        double r489025 = r489023 * r489024;
        double r489026 = t;
        double r489027 = r489025 * r489026;
        double r489028 = r489022 - r489027;
        double r489029 = a;
        double r489030 = 2.0;
        double r489031 = r489029 * r489030;
        double r489032 = r489028 / r489031;
        return r489032;
}

double f(double x, double y, double z, double t, double a) {
        double r489033 = z;
        double r489034 = -3.964589955066153e-11;
        bool r489035 = r489033 <= r489034;
        double r489036 = 0.5;
        double r489037 = x;
        double r489038 = a;
        double r489039 = r489037 / r489038;
        double r489040 = 1.0;
        double r489041 = y;
        double r489042 = r489040 / r489041;
        double r489043 = r489039 / r489042;
        double r489044 = r489036 * r489043;
        double r489045 = 4.5;
        double r489046 = t;
        double r489047 = cbrt(r489038);
        double r489048 = r489047 * r489047;
        double r489049 = r489046 / r489048;
        double r489050 = r489045 * r489049;
        double r489051 = r489033 / r489047;
        double r489052 = r489050 * r489051;
        double r489053 = r489044 - r489052;
        double r489054 = -5.447225618720537e-151;
        bool r489055 = r489033 <= r489054;
        double r489056 = r489037 * r489041;
        double r489057 = 9.0;
        double r489058 = r489057 * r489046;
        double r489059 = r489033 * r489058;
        double r489060 = r489056 - r489059;
        double r489061 = 2.0;
        double r489062 = r489038 * r489061;
        double r489063 = r489060 / r489062;
        double r489064 = -1.205276844410741e-273;
        bool r489065 = r489033 <= r489064;
        double r489066 = r489041 / r489038;
        double r489067 = r489037 * r489066;
        double r489068 = r489036 * r489067;
        double r489069 = r489046 * r489033;
        double r489070 = r489069 / r489038;
        double r489071 = r489045 * r489070;
        double r489072 = r489068 - r489071;
        double r489073 = 2.1071131039275873e-227;
        bool r489074 = r489033 <= r489073;
        double r489075 = r489039 * r489041;
        double r489076 = r489036 * r489075;
        double r489077 = r489076 - r489071;
        double r489078 = 8.760394845593749e+105;
        bool r489079 = r489033 <= r489078;
        double r489080 = r489038 / r489041;
        double r489081 = r489037 / r489080;
        double r489082 = r489036 * r489081;
        double r489083 = r489046 * r489045;
        double r489084 = r489033 / r489038;
        double r489085 = r489083 * r489084;
        double r489086 = r489082 - r489085;
        double r489087 = r489079 ? r489072 : r489086;
        double r489088 = r489074 ? r489077 : r489087;
        double r489089 = r489065 ? r489072 : r489088;
        double r489090 = r489055 ? r489063 : r489089;
        double r489091 = r489035 ? r489053 : r489090;
        return r489091;
}

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.1
Target5.8
Herbie6.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 5 regimes
  2. if z < -3.964589955066153e-11

    1. Initial program 11.9

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

      \[\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 \color{blue}{\frac{x}{\frac{a}{y}}} - 4.5 \cdot \frac{t \cdot z}{a}\]
    5. Using strategy rm
    6. Applied add-cube-cbrt12.3

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

      \[\leadsto 0.5 \cdot \frac{x}{\frac{a}{y}} - 4.5 \cdot \color{blue}{\left(\frac{t}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{z}{\sqrt[3]{a}}\right)}\]
    8. Applied associate-*r*6.5

      \[\leadsto 0.5 \cdot \frac{x}{\frac{a}{y}} - \color{blue}{\left(4.5 \cdot \frac{t}{\sqrt[3]{a} \cdot \sqrt[3]{a}}\right) \cdot \frac{z}{\sqrt[3]{a}}}\]
    9. Using strategy rm
    10. Applied div-inv6.5

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

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

    if -3.964589955066153e-11 < z < -5.447225618720537e-151

    1. Initial program 3.7

      \[\frac{x \cdot y - \left(z \cdot 9\right) \cdot t}{a \cdot 2}\]
    2. Using strategy rm
    3. Applied associate-*l*3.7

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

    if -5.447225618720537e-151 < z < -1.205276844410741e-273 or 2.1071131039275873e-227 < z < 8.760394845593749e+105

    1. Initial program 5.7

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

      \[\leadsto 0.5 \cdot \frac{x \cdot y}{\color{blue}{1 \cdot a}} - 4.5 \cdot \frac{t \cdot z}{a}\]
    5. Applied times-frac6.2

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

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

    if -1.205276844410741e-273 < z < 2.1071131039275873e-227

    1. Initial program 3.9

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

      \[\leadsto 0.5 \cdot \color{blue}{\frac{x}{\frac{a}{y}}} - 4.5 \cdot \frac{t \cdot z}{a}\]
    5. Using strategy rm
    6. Applied associate-/r/5.5

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

    if 8.760394845593749e+105 < z

    1. Initial program 15.8

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -3.964589955066153110151496336303542089574 \cdot 10^{-11}:\\ \;\;\;\;0.5 \cdot \frac{\frac{x}{a}}{\frac{1}{y}} - \left(4.5 \cdot \frac{t}{\sqrt[3]{a} \cdot \sqrt[3]{a}}\right) \cdot \frac{z}{\sqrt[3]{a}}\\ \mathbf{elif}\;z \le -5.447225618720536963997999586482503099222 \cdot 10^{-151}:\\ \;\;\;\;\frac{x \cdot y - z \cdot \left(9 \cdot t\right)}{a \cdot 2}\\ \mathbf{elif}\;z \le -1.205276844410740904002305820307771088332 \cdot 10^{-273}:\\ \;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a}\right) - 4.5 \cdot \frac{t \cdot z}{a}\\ \mathbf{elif}\;z \le 2.107113103927587276409729491380626109261 \cdot 10^{-227}:\\ \;\;\;\;0.5 \cdot \left(\frac{x}{a} \cdot y\right) - 4.5 \cdot \frac{t \cdot z}{a}\\ \mathbf{elif}\;z \le 8.760394845593749117763722532018894881612 \cdot 10^{105}:\\ \;\;\;\;0.5 \cdot \left(x \cdot \frac{y}{a}\right) - 4.5 \cdot \frac{t \cdot z}{a}\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \frac{x}{\frac{a}{y}} - \left(t \cdot 4.5\right) \cdot \frac{z}{a}\\ \end{array}\]

Reproduce

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