Average Error: 6.4 → 2.8
Time: 9.8s
Precision: 64
\[\frac{x \cdot y}{z}\]
\[\begin{array}{l} \mathbf{if}\;\frac{x \cdot y}{z} \le -9.346912219037789209140723401452172595047 \cdot 10^{250}:\\ \;\;\;\;\frac{x}{z} \cdot y\\ \mathbf{elif}\;\frac{x \cdot y}{z} \le -1.97626258336498617670627517147288548946 \cdot 10^{-323}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;\frac{x \cdot y}{z} \le -0.0:\\ \;\;\;\;\frac{x}{z} \cdot y\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \end{array}\]
\frac{x \cdot y}{z}
\begin{array}{l}
\mathbf{if}\;\frac{x \cdot y}{z} \le -9.346912219037789209140723401452172595047 \cdot 10^{250}:\\
\;\;\;\;\frac{x}{z} \cdot y\\

\mathbf{elif}\;\frac{x \cdot y}{z} \le -1.97626258336498617670627517147288548946 \cdot 10^{-323}:\\
\;\;\;\;\frac{x \cdot y}{z}\\

\mathbf{elif}\;\frac{x \cdot y}{z} \le -0.0:\\
\;\;\;\;\frac{x}{z} \cdot y\\

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

\end{array}
double f(double x, double y, double z) {
        double r43585111 = x;
        double r43585112 = y;
        double r43585113 = r43585111 * r43585112;
        double r43585114 = z;
        double r43585115 = r43585113 / r43585114;
        return r43585115;
}

double f(double x, double y, double z) {
        double r43585116 = x;
        double r43585117 = y;
        double r43585118 = r43585116 * r43585117;
        double r43585119 = z;
        double r43585120 = r43585118 / r43585119;
        double r43585121 = -9.346912219037789e+250;
        bool r43585122 = r43585120 <= r43585121;
        double r43585123 = r43585116 / r43585119;
        double r43585124 = r43585123 * r43585117;
        double r43585125 = -1.976262583365e-323;
        bool r43585126 = r43585120 <= r43585125;
        double r43585127 = -0.0;
        bool r43585128 = r43585120 <= r43585127;
        double r43585129 = r43585128 ? r43585124 : r43585120;
        double r43585130 = r43585126 ? r43585120 : r43585129;
        double r43585131 = r43585122 ? r43585124 : r43585130;
        return r43585131;
}

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.4
Target6.5
Herbie2.8
\[\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) z) < -9.346912219037789e+250 or -1.976262583365e-323 < (/ (* x y) z) < -0.0

    1. Initial program 14.6

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

      \[\leadsto \color{blue}{\left(x \cdot y\right) \cdot \frac{1}{z}}\]
    4. Using strategy rm
    5. Applied pow114.6

      \[\leadsto \left(x \cdot y\right) \cdot \color{blue}{{\left(\frac{1}{z}\right)}^{1}}\]
    6. Applied pow114.6

      \[\leadsto \left(x \cdot \color{blue}{{y}^{1}}\right) \cdot {\left(\frac{1}{z}\right)}^{1}\]
    7. Applied pow114.6

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

      \[\leadsto \color{blue}{{\left(x \cdot y\right)}^{1}} \cdot {\left(\frac{1}{z}\right)}^{1}\]
    9. Applied pow-prod-down14.6

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

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

    if -9.346912219037789e+250 < (/ (* x y) z) < -1.976262583365e-323 or -0.0 < (/ (* x y) z)

    1. Initial program 3.1

      \[\frac{x \cdot y}{z}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification2.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x \cdot y}{z} \le -9.346912219037789209140723401452172595047 \cdot 10^{250}:\\ \;\;\;\;\frac{x}{z} \cdot y\\ \mathbf{elif}\;\frac{x \cdot y}{z} \le -1.97626258336498617670627517147288548946 \cdot 10^{-323}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;\frac{x \cdot y}{z} \le -0.0:\\ \;\;\;\;\frac{x}{z} \cdot y\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \end{array}\]

Reproduce

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

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

  (/ (* x y) z))