Average Error: 7.5 → 2.3
Time: 11.9s
Precision: 64
\[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\]
\[\begin{array}{l} \mathbf{if}\;z \le 4.0510841144545337 \cdot 10^{-255}:\\ \;\;\;\;\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\frac{y - z}{x} \cdot \left(t - z\right)}\\ \mathbf{elif}\;z \le 1.5692981510658075 \cdot 10^{-125}:\\ \;\;\;\;\frac{1}{y - z} \cdot \frac{x}{t - z}\\ \mathbf{else}:\\ \;\;\;\;\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}\;z \le 4.0510841144545337 \cdot 10^{-255}:\\
\;\;\;\;\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\frac{y - z}{x} \cdot \left(t - z\right)}\\

\mathbf{elif}\;z \le 1.5692981510658075 \cdot 10^{-125}:\\
\;\;\;\;\frac{1}{y - z} \cdot \frac{x}{t - z}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r809007 = x;
        double r809008 = y;
        double r809009 = z;
        double r809010 = r809008 - r809009;
        double r809011 = t;
        double r809012 = r809011 - r809009;
        double r809013 = r809010 * r809012;
        double r809014 = r809007 / r809013;
        return r809014;
}

double f(double x, double y, double z, double t) {
        double r809015 = z;
        double r809016 = 4.0510841144545337e-255;
        bool r809017 = r809015 <= r809016;
        double r809018 = 1.0;
        double r809019 = cbrt(r809018);
        double r809020 = r809019 * r809019;
        double r809021 = y;
        double r809022 = r809021 - r809015;
        double r809023 = x;
        double r809024 = r809022 / r809023;
        double r809025 = t;
        double r809026 = r809025 - r809015;
        double r809027 = r809024 * r809026;
        double r809028 = r809020 / r809027;
        double r809029 = 1.5692981510658075e-125;
        bool r809030 = r809015 <= r809029;
        double r809031 = r809018 / r809022;
        double r809032 = r809023 / r809026;
        double r809033 = r809031 * r809032;
        double r809034 = r809023 / r809022;
        double r809035 = r809034 / r809026;
        double r809036 = r809030 ? r809033 : r809035;
        double r809037 = r809017 ? r809028 : r809036;
        return r809037;
}

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.5
Target8.3
Herbie2.3
\[\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 z < 4.0510841144545337e-255

    1. Initial program 7.5

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\]
    2. Using strategy rm
    3. Applied associate-/r*2.5

      \[\leadsto \color{blue}{\frac{\frac{x}{y - z}}{t - z}}\]
    4. Using strategy rm
    5. Applied clear-num2.8

      \[\leadsto \frac{\color{blue}{\frac{1}{\frac{y - z}{x}}}}{t - z}\]
    6. Using strategy rm
    7. Applied *-un-lft-identity2.8

      \[\leadsto \frac{\frac{1}{\frac{y - z}{\color{blue}{1 \cdot x}}}}{t - z}\]
    8. Applied *-un-lft-identity2.8

      \[\leadsto \frac{\frac{1}{\frac{\color{blue}{1 \cdot \left(y - z\right)}}{1 \cdot x}}}{t - z}\]
    9. Applied times-frac2.8

      \[\leadsto \frac{\frac{1}{\color{blue}{\frac{1}{1} \cdot \frac{y - z}{x}}}}{t - z}\]
    10. Applied add-cube-cbrt2.8

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

      \[\leadsto \frac{\color{blue}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\frac{1}{1}} \cdot \frac{\sqrt[3]{1}}{\frac{y - z}{x}}}}{t - z}\]
    12. Applied associate-/l*3.3

      \[\leadsto \color{blue}{\frac{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\frac{1}{1}}}{\frac{t - z}{\frac{\sqrt[3]{1}}{\frac{y - z}{x}}}}}\]
    13. Simplified3.0

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

    if 4.0510841144545337e-255 < z < 1.5692981510658075e-125

    1. Initial program 5.3

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity5.3

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

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

    if 1.5692981510658075e-125 < z

    1. Initial program 8.1

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\]
    2. Using strategy rm
    3. Applied associate-/r*0.7

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le 4.0510841144545337 \cdot 10^{-255}:\\ \;\;\;\;\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\frac{y - z}{x} \cdot \left(t - z\right)}\\ \mathbf{elif}\;z \le 1.5692981510658075 \cdot 10^{-125}:\\ \;\;\;\;\frac{1}{y - z} \cdot \frac{x}{t - z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y - z}}{t - z}\\ \end{array}\]

Reproduce

herbie shell --seed 2020046 +o rules:numerics
(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))))