Average Error: 6.2 → 2.0
Time: 7.9s
Precision: 64
\[\frac{x \cdot y}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y \le -1.926622627642983907222823390598358692722 \cdot 10^{158} \lor \neg \left(x \cdot y \le -1.247759449621090803465755159668841719159 \cdot 10^{-277}\right) \land x \cdot y \le 7.34380694489727298836667505377526972286 \cdot 10^{-173}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\ \end{array}\]
\frac{x \cdot y}{z}
\begin{array}{l}
\mathbf{if}\;x \cdot y \le -1.926622627642983907222823390598358692722 \cdot 10^{158} \lor \neg \left(x \cdot y \le -1.247759449621090803465755159668841719159 \cdot 10^{-277}\right) \land x \cdot y \le 7.34380694489727298836667505377526972286 \cdot 10^{-173}:\\
\;\;\;\;x \cdot \frac{y}{z}\\

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

\end{array}
double f(double x, double y, double z) {
        double r364078 = x;
        double r364079 = y;
        double r364080 = r364078 * r364079;
        double r364081 = z;
        double r364082 = r364080 / r364081;
        return r364082;
}

double f(double x, double y, double z) {
        double r364083 = x;
        double r364084 = y;
        double r364085 = r364083 * r364084;
        double r364086 = -1.926622627642984e+158;
        bool r364087 = r364085 <= r364086;
        double r364088 = -1.2477594496210908e-277;
        bool r364089 = r364085 <= r364088;
        double r364090 = !r364089;
        double r364091 = 7.343806944897273e-173;
        bool r364092 = r364085 <= r364091;
        bool r364093 = r364090 && r364092;
        bool r364094 = r364087 || r364093;
        double r364095 = z;
        double r364096 = r364084 / r364095;
        double r364097 = r364083 * r364096;
        double r364098 = 1.0;
        double r364099 = r364098 / r364095;
        double r364100 = r364085 * r364099;
        double r364101 = r364094 ? r364097 : r364100;
        return r364101;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original6.2
Target6.0
Herbie2.0
\[\begin{array}{l} \mathbf{if}\;z \lt -4.262230790519428958560619200129306371776 \cdot 10^{-138}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;z \lt 1.704213066065047207696571404603247573308 \cdot 10^{-164}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} \cdot y\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if (* x y) < -1.926622627642984e+158 or -1.2477594496210908e-277 < (* x y) < 7.343806944897273e-173

    1. Initial program 14.1

      \[\frac{x \cdot y}{z}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity14.1

      \[\leadsto \frac{x \cdot y}{\color{blue}{1 \cdot z}}\]
    4. Applied times-frac0.9

      \[\leadsto \color{blue}{\frac{x}{1} \cdot \frac{y}{z}}\]
    5. Simplified0.9

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

    if -1.926622627642984e+158 < (* x y) < -1.2477594496210908e-277 or 7.343806944897273e-173 < (* x y)

    1. Initial program 2.4

      \[\frac{x \cdot y}{z}\]
    2. Using strategy rm
    3. Applied div-inv2.5

      \[\leadsto \color{blue}{\left(x \cdot y\right) \cdot \frac{1}{z}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification2.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \le -1.926622627642983907222823390598358692722 \cdot 10^{158} \lor \neg \left(x \cdot y \le -1.247759449621090803465755159668841719159 \cdot 10^{-277}\right) \land x \cdot y \le 7.34380694489727298836667505377526972286 \cdot 10^{-173}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\ \end{array}\]

Reproduce

herbie shell --seed 2019212 +o rules:numerics
(FPCore (x y z)
  :name "Diagrams.Solve.Tridiagonal:solveCyclicTriDiagonal from diagrams-solve-0.1, A"
  :precision binary64

  :herbie-target
  (if (< z -4.262230790519429e-138) (/ (* x y) z) (if (< z 1.70421306606504721e-164) (/ x (/ z y)) (* (/ x z) y)))

  (/ (* x y) z))