Average Error: 7.5 → 1.9
Time: 13.7s
Precision: 64
\[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\]
\[\begin{array}{l} \mathbf{if}\;x \le -4.800350695501532909653686407635874960598 \cdot 10^{-272}:\\ \;\;\;\;\frac{\frac{x}{t - z}}{y - z}\\ \mathbf{elif}\;x \le 1.462607247572835755145071210685761706744 \cdot 10^{224}:\\ \;\;\;\;\frac{\frac{x}{y - z}}{t - z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{x}}{y - z} \cdot \frac{\sqrt{x}}{t - z}\\ \end{array}\]
\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}
\begin{array}{l}
\mathbf{if}\;x \le -4.800350695501532909653686407635874960598 \cdot 10^{-272}:\\
\;\;\;\;\frac{\frac{x}{t - z}}{y - z}\\

\mathbf{elif}\;x \le 1.462607247572835755145071210685761706744 \cdot 10^{224}:\\
\;\;\;\;\frac{\frac{x}{y - z}}{t - z}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r542313 = x;
        double r542314 = y;
        double r542315 = z;
        double r542316 = r542314 - r542315;
        double r542317 = t;
        double r542318 = r542317 - r542315;
        double r542319 = r542316 * r542318;
        double r542320 = r542313 / r542319;
        return r542320;
}

double f(double x, double y, double z, double t) {
        double r542321 = x;
        double r542322 = -4.800350695501533e-272;
        bool r542323 = r542321 <= r542322;
        double r542324 = t;
        double r542325 = z;
        double r542326 = r542324 - r542325;
        double r542327 = r542321 / r542326;
        double r542328 = y;
        double r542329 = r542328 - r542325;
        double r542330 = r542327 / r542329;
        double r542331 = 1.4626072475728358e+224;
        bool r542332 = r542321 <= r542331;
        double r542333 = r542321 / r542329;
        double r542334 = r542333 / r542326;
        double r542335 = sqrt(r542321);
        double r542336 = r542335 / r542329;
        double r542337 = r542335 / r542326;
        double r542338 = r542336 * r542337;
        double r542339 = r542332 ? r542334 : r542338;
        double r542340 = r542323 ? r542330 : r542339;
        return r542340;
}

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.2
Herbie1.9
\[\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 x < -4.800350695501533e-272

    1. Initial program 7.4

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

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

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

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

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

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

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

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

    if -4.800350695501533e-272 < x < 1.4626072475728358e+224

    1. Initial program 5.1

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

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

    if 1.4626072475728358e+224 < x

    1. Initial program 27.3

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -4.800350695501532909653686407635874960598 \cdot 10^{-272}:\\ \;\;\;\;\frac{\frac{x}{t - z}}{y - z}\\ \mathbf{elif}\;x \le 1.462607247572835755145071210685761706744 \cdot 10^{224}:\\ \;\;\;\;\frac{\frac{x}{y - z}}{t - z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{x}}{y - z} \cdot \frac{\sqrt{x}}{t - z}\\ \end{array}\]

Reproduce

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

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

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