Average Error: 6.3 → 2.2
Time: 1.8s
Precision: 64
\[\frac{x \cdot y}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y \le -1.20767702168173617 \cdot 10^{-132} \lor \neg \left(x \cdot y \le 0.0 \lor \neg \left(x \cdot y \le 1.4448027941880176 \cdot 10^{194}\right)\right):\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \end{array}\]
\frac{x \cdot y}{z}
\begin{array}{l}
\mathbf{if}\;x \cdot y \le -1.20767702168173617 \cdot 10^{-132} \lor \neg \left(x \cdot y \le 0.0 \lor \neg \left(x \cdot y \le 1.4448027941880176 \cdot 10^{194}\right)\right):\\
\;\;\;\;\frac{x \cdot y}{z}\\

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

\end{array}
double f(double x, double y, double z) {
        double r801451 = x;
        double r801452 = y;
        double r801453 = r801451 * r801452;
        double r801454 = z;
        double r801455 = r801453 / r801454;
        return r801455;
}

double f(double x, double y, double z) {
        double r801456 = x;
        double r801457 = y;
        double r801458 = r801456 * r801457;
        double r801459 = -1.2076770216817362e-132;
        bool r801460 = r801458 <= r801459;
        double r801461 = 0.0;
        bool r801462 = r801458 <= r801461;
        double r801463 = 1.4448027941880176e+194;
        bool r801464 = r801458 <= r801463;
        double r801465 = !r801464;
        bool r801466 = r801462 || r801465;
        double r801467 = !r801466;
        bool r801468 = r801460 || r801467;
        double r801469 = z;
        double r801470 = r801458 / r801469;
        double r801471 = r801469 / r801457;
        double r801472 = r801456 / r801471;
        double r801473 = r801468 ? r801470 : r801472;
        return r801473;
}

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.3
Target6.2
Herbie2.2
\[\begin{array}{l} \mathbf{if}\;z \lt -4.262230790519429 \cdot 10^{-138}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;z \lt 1.70421306606504721 \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.2076770216817362e-132 or 0.0 < (* x y) < 1.4448027941880176e+194

    1. Initial program 2.8

      \[\frac{x \cdot y}{z}\]

    if -1.2076770216817362e-132 < (* x y) < 0.0 or 1.4448027941880176e+194 < (* x y)

    1. Initial program 13.7

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \le -1.20767702168173617 \cdot 10^{-132} \lor \neg \left(x \cdot y \le 0.0 \lor \neg \left(x \cdot y \le 1.4448027941880176 \cdot 10^{194}\right)\right):\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \end{array}\]

Reproduce

herbie shell --seed 2020024 +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))