Average Error: 7.7 → 1.5
Time: 11.0s
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 -7.10938901979545519 \cdot 10^{300} \lor \neg \left(\left(y - z\right) \cdot \left(t - z\right) \le -2.4754507687590531 \cdot 10^{-14}\right):\\ \;\;\;\;\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \frac{\frac{x}{t - z}}{y - z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\left(t - z\right) \cdot \left(y - z\right)}\\ \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 -7.10938901979545519 \cdot 10^{300} \lor \neg \left(\left(y - z\right) \cdot \left(t - z\right) \le -2.4754507687590531 \cdot 10^{-14}\right):\\
\;\;\;\;\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \frac{\frac{x}{t - z}}{y - z}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r831324 = x;
        double r831325 = y;
        double r831326 = z;
        double r831327 = r831325 - r831326;
        double r831328 = t;
        double r831329 = r831328 - r831326;
        double r831330 = r831327 * r831329;
        double r831331 = r831324 / r831330;
        return r831331;
}

double f(double x, double y, double z, double t) {
        double r831332 = y;
        double r831333 = z;
        double r831334 = r831332 - r831333;
        double r831335 = t;
        double r831336 = r831335 - r831333;
        double r831337 = r831334 * r831336;
        double r831338 = -7.109389019795455e+300;
        bool r831339 = r831337 <= r831338;
        double r831340 = -2.475450768759053e-14;
        bool r831341 = r831337 <= r831340;
        double r831342 = !r831341;
        bool r831343 = r831339 || r831342;
        double r831344 = 1.0;
        double r831345 = cbrt(r831344);
        double r831346 = r831345 * r831345;
        double r831347 = x;
        double r831348 = r831347 / r831336;
        double r831349 = r831348 / r831334;
        double r831350 = r831346 * r831349;
        double r831351 = r831336 * r831334;
        double r831352 = r831347 / r831351;
        double r831353 = r831343 ? r831350 : r831352;
        return r831353;
}

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.7
Target8.4
Herbie1.5
\[\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 2 regimes
  2. if (* (- y z) (- t z)) < -7.109389019795455e+300 or -2.475450768759053e-14 < (* (- y z) (- t z))

    1. Initial program 9.1

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

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

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

      \[\leadsto \frac{1}{\color{blue}{1 \cdot \left(y - z\right)}} \cdot \frac{x}{t - z}\]
    7. Applied add-cube-cbrt1.9

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

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

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

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

    if -7.109389019795455e+300 < (* (- y z) (- t z)) < -2.475450768759053e-14

    1. Initial program 0.2

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(y - z\right) \cdot \left(t - z\right) \le -7.10938901979545519 \cdot 10^{300} \lor \neg \left(\left(y - z\right) \cdot \left(t - z\right) \le -2.4754507687590531 \cdot 10^{-14}\right):\\ \;\;\;\;\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \frac{\frac{x}{t - z}}{y - z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\left(t - z\right) \cdot \left(y - z\right)}\\ \end{array}\]

Reproduce

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