Average Error: 6.4 → 2.8
Time: 10.3s
Precision: 64
\[\frac{x \cdot y}{z}\]
\[\begin{array}{l} \mathbf{if}\;\frac{x \cdot y}{z} \le -9.346912219037789209140723401452172595047 \cdot 10^{250}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \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:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \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}:\\
\;\;\;\;y \cdot \frac{x}{z}\\

\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:\\
\;\;\;\;y \cdot \frac{x}{z}\\

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

\end{array}
double f(double x, double y, double z) {
        double r29550189 = x;
        double r29550190 = y;
        double r29550191 = r29550189 * r29550190;
        double r29550192 = z;
        double r29550193 = r29550191 / r29550192;
        return r29550193;
}

double f(double x, double y, double z) {
        double r29550194 = x;
        double r29550195 = y;
        double r29550196 = r29550194 * r29550195;
        double r29550197 = z;
        double r29550198 = r29550196 / r29550197;
        double r29550199 = -9.346912219037789e+250;
        bool r29550200 = r29550198 <= r29550199;
        double r29550201 = r29550194 / r29550197;
        double r29550202 = r29550195 * r29550201;
        double r29550203 = -1.976262583365e-323;
        bool r29550204 = r29550198 <= r29550203;
        double r29550205 = -0.0;
        bool r29550206 = r29550198 <= r29550205;
        double r29550207 = r29550206 ? r29550202 : r29550198;
        double r29550208 = r29550204 ? r29550198 : r29550207;
        double r29550209 = r29550200 ? r29550202 : r29550208;
        return r29550209;
}

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}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \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:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \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))