Average Error: 7.4 → 1.4
Time: 4.2s
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}:\\ \;\;\;\;\frac{\frac{x}{t - z}}{y - z}\\ \mathbf{elif}\;\left(y - z\right) \cdot \left(t - z\right) \le -3.16701534575747388 \cdot 10^{-22}:\\ \;\;\;\;{\left(x \cdot \frac{\frac{1}{y - z}}{t - z}\right)}^{1}\\ \mathbf{else}:\\ \;\;\;\;{\left(\frac{\frac{x}{y - z}}{t - z}\right)}^{1}\\ \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}:\\
\;\;\;\;\frac{\frac{x}{t - z}}{y - z}\\

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

\mathbf{else}:\\
\;\;\;\;{\left(\frac{\frac{x}{y - z}}{t - z}\right)}^{1}\\

\end{array}
double f(double x, double y, double z, double t) {
        double r754818 = x;
        double r754819 = y;
        double r754820 = z;
        double r754821 = r754819 - r754820;
        double r754822 = t;
        double r754823 = r754822 - r754820;
        double r754824 = r754821 * r754823;
        double r754825 = r754818 / r754824;
        return r754825;
}

double f(double x, double y, double z, double t) {
        double r754826 = y;
        double r754827 = z;
        double r754828 = r754826 - r754827;
        double r754829 = t;
        double r754830 = r754829 - r754827;
        double r754831 = r754828 * r754830;
        double r754832 = -4.026222793044682e+168;
        bool r754833 = r754831 <= r754832;
        double r754834 = x;
        double r754835 = r754834 / r754830;
        double r754836 = r754835 / r754828;
        double r754837 = -3.167015345757474e-22;
        bool r754838 = r754831 <= r754837;
        double r754839 = 1.0;
        double r754840 = r754839 / r754828;
        double r754841 = r754840 / r754830;
        double r754842 = r754834 * r754841;
        double r754843 = pow(r754842, r754839);
        double r754844 = r754834 / r754828;
        double r754845 = r754844 / r754830;
        double r754846 = pow(r754845, r754839);
        double r754847 = r754838 ? r754843 : r754846;
        double r754848 = r754833 ? r754836 : r754847;
        return r754848;
}

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 associate-*l/0.9

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

      \[\leadsto \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 pow15.3

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

      \[\leadsto \color{blue}{{\left(\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{y - z}\right)}^{1}} \cdot {\left(\frac{\sqrt[3]{x}}{t - z}\right)}^{1}\]
    8. Applied pow-prod-down5.3

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

      \[\leadsto {\color{blue}{\left(\frac{\frac{x}{y - z}}{t - z}\right)}}^{1}\]
    10. Using strategy rm
    11. Applied *-un-lft-identity8.4

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

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

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

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

    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 pow11.6

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

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

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

      \[\leadsto {\color{blue}{\left(\frac{\frac{x}{y - z}}{t - z}\right)}}^{1}\]
  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}:\\ \;\;\;\;\frac{\frac{x}{t - z}}{y - z}\\ \mathbf{elif}\;\left(y - z\right) \cdot \left(t - z\right) \le -3.16701534575747388 \cdot 10^{-22}:\\ \;\;\;\;{\left(x \cdot \frac{\frac{1}{y - z}}{t - z}\right)}^{1}\\ \mathbf{else}:\\ \;\;\;\;{\left(\frac{\frac{x}{y - z}}{t - z}\right)}^{1}\\ \end{array}\]

Reproduce

herbie shell --seed 2020039 +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))))