Average Error: 6.1 → 1.0
Time: 14.9s
Precision: 64
\[\frac{x \cdot y}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y \le -3.215556071613412899309254113303266622928 \cdot 10^{211} \lor \neg \left(x \cdot y \le -8.160507073987472840955517624398211725717 \cdot 10^{-196} \lor \neg \left(x \cdot y \le -0.0\right) \land x \cdot y \le 3.674603601854208702851027640434707440909 \cdot 10^{86}\right):\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \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 -3.215556071613412899309254113303266622928 \cdot 10^{211} \lor \neg \left(x \cdot y \le -8.160507073987472840955517624398211725717 \cdot 10^{-196} \lor \neg \left(x \cdot y \le -0.0\right) \land x \cdot y \le 3.674603601854208702851027640434707440909 \cdot 10^{86}\right):\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\

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

\end{array}
double f(double x, double y, double z) {
        double r483491 = x;
        double r483492 = y;
        double r483493 = r483491 * r483492;
        double r483494 = z;
        double r483495 = r483493 / r483494;
        return r483495;
}

double f(double x, double y, double z) {
        double r483496 = x;
        double r483497 = y;
        double r483498 = r483496 * r483497;
        double r483499 = -3.215556071613413e+211;
        bool r483500 = r483498 <= r483499;
        double r483501 = -8.160507073987473e-196;
        bool r483502 = r483498 <= r483501;
        double r483503 = -0.0;
        bool r483504 = r483498 <= r483503;
        double r483505 = !r483504;
        double r483506 = 3.6746036018542087e+86;
        bool r483507 = r483498 <= r483506;
        bool r483508 = r483505 && r483507;
        bool r483509 = r483502 || r483508;
        double r483510 = !r483509;
        bool r483511 = r483500 || r483510;
        double r483512 = z;
        double r483513 = r483512 / r483497;
        double r483514 = r483496 / r483513;
        double r483515 = 1.0;
        double r483516 = r483515 / r483512;
        double r483517 = r483498 * r483516;
        double r483518 = r483511 ? r483514 : r483517;
        return r483518;
}

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 2 regimes
  2. if (* x y) < -3.215556071613413e+211 or -8.160507073987473e-196 < (* x y) < -0.0 or 3.6746036018542087e+86 < (* x y)

    1. Initial program 15.4

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

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

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

    1. Initial program 0.4

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

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

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

Reproduce

herbie shell --seed 2019325 
(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))