Average Error: 7.4 → 1.4
Time: 3.8s
Precision: 64
\[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\]
\[\begin{array}{l} \mathbf{if}\;\left(y - z\right) \cdot \left(t - z\right) \le -4.026222793044682 \cdot 10^{168}:\\ \;\;\;\;1 \cdot \frac{\frac{x}{t - z}}{y - z}\\ \mathbf{elif}\;\left(y - z\right) \cdot \left(t - z\right) \le -3.16701534575747388 \cdot 10^{-22}:\\ \;\;\;\;1 \cdot \left(x \cdot \frac{\frac{1}{y - z}}{t - z}\right)\\ \mathbf{else}:\\ \;\;\;\;1 \cdot \frac{\frac{x}{y - z}}{t - z}\\ \end{array}\]
\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}
\begin{array}{l}
\mathbf{if}\;\left(y - z\right) \cdot \left(t - z\right) \le -4.026222793044682 \cdot 10^{168}:\\
\;\;\;\;1 \cdot \frac{\frac{x}{t - z}}{y - z}\\

\mathbf{elif}\;\left(y - z\right) \cdot \left(t - z\right) \le -3.16701534575747388 \cdot 10^{-22}:\\
\;\;\;\;1 \cdot \left(x \cdot \frac{\frac{1}{y - z}}{t - z}\right)\\

\mathbf{else}:\\
\;\;\;\;1 \cdot \frac{\frac{x}{y - z}}{t - z}\\

\end{array}
double f(double x, double y, double z, double t) {
        double r798603 = x;
        double r798604 = y;
        double r798605 = z;
        double r798606 = r798604 - r798605;
        double r798607 = t;
        double r798608 = r798607 - r798605;
        double r798609 = r798606 * r798608;
        double r798610 = r798603 / r798609;
        return r798610;
}

double f(double x, double y, double z, double t) {
        double r798611 = y;
        double r798612 = z;
        double r798613 = r798611 - r798612;
        double r798614 = t;
        double r798615 = r798614 - r798612;
        double r798616 = r798613 * r798615;
        double r798617 = -4.026222793044682e+168;
        bool r798618 = r798616 <= r798617;
        double r798619 = 1.0;
        double r798620 = x;
        double r798621 = r798620 / r798615;
        double r798622 = r798621 / r798613;
        double r798623 = r798619 * r798622;
        double r798624 = -3.167015345757474e-22;
        bool r798625 = r798616 <= r798624;
        double r798626 = r798619 / r798613;
        double r798627 = r798626 / r798615;
        double r798628 = r798620 * r798627;
        double r798629 = r798619 * r798628;
        double r798630 = r798620 / r798613;
        double r798631 = r798630 / r798615;
        double r798632 = r798619 * r798631;
        double r798633 = r798625 ? r798629 : r798632;
        double r798634 = r798618 ? r798623 : r798633;
        return r798634;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original7.4
Target8.3
Herbie1.4
\[\begin{array}{l} \mathbf{if}\;\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \lt 0.0:\\ \;\;\;\;\frac{\frac{x}{y - z}}{t - z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{1}{\left(y - z\right) \cdot \left(t - z\right)}\\ \end{array}\]

Derivation

  1. Split input into 3 regimes
  2. if (* (- y z) (- t z)) < -4.026222793044682e+168

    1. Initial program 11.3

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\]
    2. Using strategy rm
    3. Applied add-cube-cbrt11.6

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

      \[\leadsto \color{blue}{\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{y - z} \cdot \frac{\sqrt[3]{x}}{t - z}}\]
    5. Using strategy rm
    6. Applied *-un-lft-identity0.7

      \[\leadsto \color{blue}{\left(1 \cdot \frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{y - z}\right)} \cdot \frac{\sqrt[3]{x}}{t - z}\]
    7. Applied associate-*l*0.7

      \[\leadsto \color{blue}{1 \cdot \left(\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{y - z} \cdot \frac{\sqrt[3]{x}}{t - z}\right)}\]
    8. Simplified0.6

      \[\leadsto 1 \cdot \color{blue}{\frac{\frac{x}{y - z}}{t - z}}\]
    9. Using strategy rm
    10. Applied div-inv0.7

      \[\leadsto 1 \cdot \color{blue}{\left(\frac{x}{y - z} \cdot \frac{1}{t - z}\right)}\]
    11. Using strategy rm
    12. Applied associate-*l/0.5

      \[\leadsto 1 \cdot \color{blue}{\frac{x \cdot \frac{1}{t - z}}{y - z}}\]
    13. Simplified0.4

      \[\leadsto 1 \cdot \frac{\color{blue}{\frac{x}{t - z}}}{y - z}\]

    if -4.026222793044682e+168 < (* (- y z) (- t z)) < -3.167015345757474e-22

    1. Initial program 0.2

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\]
    2. Using strategy rm
    3. Applied add-cube-cbrt1.2

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

      \[\leadsto \color{blue}{\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{y - z} \cdot \frac{\sqrt[3]{x}}{t - z}}\]
    5. Using strategy rm
    6. Applied *-un-lft-identity5.3

      \[\leadsto \color{blue}{\left(1 \cdot \frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{y - z}\right)} \cdot \frac{\sqrt[3]{x}}{t - z}\]
    7. Applied associate-*l*5.3

      \[\leadsto \color{blue}{1 \cdot \left(\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{y - z} \cdot \frac{\sqrt[3]{x}}{t - z}\right)}\]
    8. Simplified8.4

      \[\leadsto 1 \cdot \color{blue}{\frac{\frac{x}{y - z}}{t - z}}\]
    9. Using strategy rm
    10. Applied *-un-lft-identity8.4

      \[\leadsto 1 \cdot \frac{\frac{x}{y - z}}{\color{blue}{1 \cdot \left(t - z\right)}}\]
    11. Applied div-inv8.5

      \[\leadsto 1 \cdot \frac{\color{blue}{x \cdot \frac{1}{y - z}}}{1 \cdot \left(t - z\right)}\]
    12. Applied times-frac0.4

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

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

    if -3.167015345757474e-22 < (* (- y z) (- t z))

    1. Initial program 7.5

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\]
    2. Using strategy rm
    3. Applied add-cube-cbrt8.0

      \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \sqrt[3]{x}}}{\left(y - z\right) \cdot \left(t - z\right)}\]
    4. Applied times-frac1.6

      \[\leadsto \color{blue}{\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{y - z} \cdot \frac{\sqrt[3]{x}}{t - z}}\]
    5. Using strategy rm
    6. Applied *-un-lft-identity1.6

      \[\leadsto \color{blue}{\left(1 \cdot \frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{y - z}\right)} \cdot \frac{\sqrt[3]{x}}{t - z}\]
    7. Applied associate-*l*1.6

      \[\leadsto \color{blue}{1 \cdot \left(\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{y - z} \cdot \frac{\sqrt[3]{x}}{t - z}\right)}\]
    8. Simplified1.7

      \[\leadsto 1 \cdot \color{blue}{\frac{\frac{x}{y - z}}{t - z}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification1.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(y - z\right) \cdot \left(t - z\right) \le -4.026222793044682 \cdot 10^{168}:\\ \;\;\;\;1 \cdot \frac{\frac{x}{t - z}}{y - z}\\ \mathbf{elif}\;\left(y - z\right) \cdot \left(t - z\right) \le -3.16701534575747388 \cdot 10^{-22}:\\ \;\;\;\;1 \cdot \left(x \cdot \frac{\frac{1}{y - z}}{t - z}\right)\\ \mathbf{else}:\\ \;\;\;\;1 \cdot \frac{\frac{x}{y - z}}{t - z}\\ \end{array}\]

Reproduce

herbie shell --seed 2020039 
(FPCore (x y z t)
  :name "Data.Random.Distribution.Triangular:triangularCDF from random-fu-0.2.6.2, B"
  :precision binary64

  :herbie-target
  (if (< (/ x (* (- y z) (- t z))) 0.0) (/ (/ x (- y z)) (- t z)) (* x (/ 1 (* (- y z) (- t z)))))

  (/ x (* (- y z) (- t z))))