Average Error: 6.5 → 3.9
Time: 2.5s
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 r712841 = x;
        double r712842 = y;
        double r712843 = r712841 * r712842;
        double r712844 = z;
        double r712845 = r712843 / r712844;
        return r712845;
}

double f(double x, double y, double z) {
        double r712846 = x;
        double r712847 = y;
        double r712848 = r712846 * r712847;
        double r712849 = -7.46317149885718e-140;
        bool r712850 = r712848 <= r712849;
        double r712851 = -0.0;
        bool r712852 = r712848 <= r712851;
        double r712853 = !r712852;
        bool r712854 = r712850 || r712853;
        double r712855 = z;
        double r712856 = r712848 / r712855;
        double r712857 = r712855 / r712847;
        double r712858 = r712846 / r712857;
        double r712859 = r712854 ? r712856 : r712858;
        return r712859;
}

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 
(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))