Average Error: 6.1 → 1.0
Time: 19.6s
Precision: 64
\[\frac{x \cdot y}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y \le -3.215556071613412899309254113303266622928 \cdot 10^{211}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;x \cdot y \le -8.160507073987472840955517624398211725717 \cdot 10^{-196}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\ \mathbf{elif}\;x \cdot y \le -0.0:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{elif}\;x \cdot y \le 3.674603601854208702851027640434707440909 \cdot 10^{86}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \end{array}\]
\frac{x \cdot y}{z}
\begin{array}{l}
\mathbf{if}\;x \cdot y \le -3.215556071613412899309254113303266622928 \cdot 10^{211}:\\
\;\;\;\;x \cdot \frac{y}{z}\\

\mathbf{elif}\;x \cdot y \le -8.160507073987472840955517624398211725717 \cdot 10^{-196}:\\
\;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\

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

\mathbf{elif}\;x \cdot y \le 3.674603601854208702851027640434707440909 \cdot 10^{86}:\\
\;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\

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

\end{array}
double f(double x, double y, double z) {
        double r435356 = x;
        double r435357 = y;
        double r435358 = r435356 * r435357;
        double r435359 = z;
        double r435360 = r435358 / r435359;
        return r435360;
}

double f(double x, double y, double z) {
        double r435361 = x;
        double r435362 = y;
        double r435363 = r435361 * r435362;
        double r435364 = -3.215556071613413e+211;
        bool r435365 = r435363 <= r435364;
        double r435366 = z;
        double r435367 = r435362 / r435366;
        double r435368 = r435361 * r435367;
        double r435369 = -8.160507073987473e-196;
        bool r435370 = r435363 <= r435369;
        double r435371 = 1.0;
        double r435372 = r435371 / r435366;
        double r435373 = r435363 * r435372;
        double r435374 = -0.0;
        bool r435375 = r435363 <= r435374;
        double r435376 = r435366 / r435362;
        double r435377 = r435361 / r435376;
        double r435378 = 3.6746036018542087e+86;
        bool r435379 = r435363 <= r435378;
        double r435380 = r435379 ? r435373 : r435368;
        double r435381 = r435375 ? r435377 : r435380;
        double r435382 = r435370 ? r435373 : r435381;
        double r435383 = r435365 ? r435368 : r435382;
        return r435383;
}

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.1
Target6.4
Herbie1.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 3 regimes
  2. if (* x y) < -3.215556071613413e+211 or 3.6746036018542087e+86 < (* x y)

    1. Initial program 17.8

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

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

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

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

    if -3.215556071613413e+211 < (* x y) < -8.160507073987473e-196 or -0.0 < (* x y) < 3.6746036018542087e+86

    1. Initial program 2.2

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

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

    if -8.160507073987473e-196 < (* x y) < -0.0

    1. Initial program 10.6

      \[\frac{x \cdot y}{z}\]
    2. Using strategy rm
    3. Applied associate-/l*0.5

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{y}}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification1.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \le -3.215556071613412899309254113303266622928 \cdot 10^{211}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;x \cdot y \le -8.160507073987472840955517624398211725717 \cdot 10^{-196}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\ \mathbf{elif}\;x \cdot y \le -0.0:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{elif}\;x \cdot y \le 3.674603601854208702851027640434707440909 \cdot 10^{86}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \end{array}\]

Reproduce

herbie shell --seed 2019325 +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.7042130660650472e-164) (/ x (/ z y)) (* (/ x z) y)))

  (/ (* x y) z))