Average Error: 6.5 → 3.9
Time: 2.9s
Precision: 64
\[\frac{x \cdot y}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y \le -7.4631714988571799 \cdot 10^{-140} \lor \neg \left(x \cdot y \le -0.0\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 -7.4631714988571799 \cdot 10^{-140} \lor \neg \left(x \cdot y \le -0.0\right):\\
\;\;\;\;\frac{x \cdot y}{z}\\

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

\end{array}
double f(double x, double y, double z) {
        double r676025 = x;
        double r676026 = y;
        double r676027 = r676025 * r676026;
        double r676028 = z;
        double r676029 = r676027 / r676028;
        return r676029;
}

double f(double x, double y, double z) {
        double r676030 = x;
        double r676031 = y;
        double r676032 = r676030 * r676031;
        double r676033 = -7.46317149885718e-140;
        bool r676034 = r676032 <= r676033;
        double r676035 = -0.0;
        bool r676036 = r676032 <= r676035;
        double r676037 = !r676036;
        bool r676038 = r676034 || r676037;
        double r676039 = z;
        double r676040 = r676032 / r676039;
        double r676041 = r676039 / r676031;
        double r676042 = r676030 / r676041;
        double r676043 = r676038 ? r676040 : r676042;
        return r676043;
}

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.5
Target6.4
Herbie3.9
\[\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) < -7.46317149885718e-140 or -0.0 < (* x y)

    1. Initial program 4.8

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

    if -7.46317149885718e-140 < (* x y) < -0.0

    1. Initial program 11.5

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

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

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

Reproduce

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