Average Error: 6.3 → 0.5
Time: 10.6s
Precision: 64
\[\frac{x \cdot y}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y \le -1.00913018527108544 \cdot 10^{193}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{elif}\;x \cdot y \le -5.44063564524967612 \cdot 10^{-183}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\ \mathbf{elif}\;x \cdot y \le 2.7243815378783738 \cdot 10^{-256}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{elif}\;x \cdot y \le 9.81129541249854884 \cdot 10^{171}:\\ \;\;\;\;\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 -1.00913018527108544 \cdot 10^{193}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\

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

\mathbf{elif}\;x \cdot y \le 2.7243815378783738 \cdot 10^{-256}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\

\mathbf{elif}\;x \cdot y \le 9.81129541249854884 \cdot 10^{171}:\\
\;\;\;\;\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 r740863 = x;
        double r740864 = y;
        double r740865 = r740863 * r740864;
        double r740866 = z;
        double r740867 = r740865 / r740866;
        return r740867;
}

double f(double x, double y, double z) {
        double r740868 = x;
        double r740869 = y;
        double r740870 = r740868 * r740869;
        double r740871 = -1.0091301852710854e+193;
        bool r740872 = r740870 <= r740871;
        double r740873 = z;
        double r740874 = r740873 / r740869;
        double r740875 = r740868 / r740874;
        double r740876 = -5.440635645249676e-183;
        bool r740877 = r740870 <= r740876;
        double r740878 = 1.0;
        double r740879 = r740878 / r740873;
        double r740880 = r740870 * r740879;
        double r740881 = 2.724381537878374e-256;
        bool r740882 = r740870 <= r740881;
        double r740883 = 9.811295412498549e+171;
        bool r740884 = r740870 <= r740883;
        double r740885 = r740869 / r740873;
        double r740886 = r740868 * r740885;
        double r740887 = r740884 ? r740880 : r740886;
        double r740888 = r740882 ? r740875 : r740887;
        double r740889 = r740877 ? r740880 : r740888;
        double r740890 = r740872 ? r740875 : r740889;
        return r740890;
}

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
Herbie0.5
\[\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 3 regimes
  2. if (* x y) < -1.0091301852710854e+193 or -5.440635645249676e-183 < (* x y) < 2.724381537878374e-256

    1. Initial program 14.6

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

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

    if -1.0091301852710854e+193 < (* x y) < -5.440635645249676e-183 or 2.724381537878374e-256 < (* x y) < 9.811295412498549e+171

    1. Initial program 0.2

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

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

    if 9.811295412498549e+171 < (* x y)

    1. Initial program 22.4

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \le -1.00913018527108544 \cdot 10^{193}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{elif}\;x \cdot y \le -5.44063564524967612 \cdot 10^{-183}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\ \mathbf{elif}\;x \cdot y \le 2.7243815378783738 \cdot 10^{-256}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{elif}\;x \cdot y \le 9.81129541249854884 \cdot 10^{171}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \end{array}\]

Reproduce

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