Average Error: 6.1 → 0.9
Time: 1.7s
Precision: 64
\[\frac{x \cdot y}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y \le -1.70578255955175172 \cdot 10^{222}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;x \cdot y \le -2.6336268525467556 \cdot 10^{-109}:\\ \;\;\;\;\frac{1}{\frac{z}{x \cdot y}}\\ \mathbf{elif}\;x \cdot y \le 2.391070767296255 \cdot 10^{-243}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;x \cdot y \le 5.3405022564328761 \cdot 10^{154}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{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.70578255955175172 \cdot 10^{222}:\\
\;\;\;\;x \cdot \frac{y}{z}\\

\mathbf{elif}\;x \cdot y \le -2.6336268525467556 \cdot 10^{-109}:\\
\;\;\;\;\frac{1}{\frac{z}{x \cdot y}}\\

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

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

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

\end{array}
double f(double x, double y, double z) {
        double r783149 = x;
        double r783150 = y;
        double r783151 = r783149 * r783150;
        double r783152 = z;
        double r783153 = r783151 / r783152;
        return r783153;
}

double f(double x, double y, double z) {
        double r783154 = x;
        double r783155 = y;
        double r783156 = r783154 * r783155;
        double r783157 = -1.7057825595517517e+222;
        bool r783158 = r783156 <= r783157;
        double r783159 = z;
        double r783160 = r783155 / r783159;
        double r783161 = r783154 * r783160;
        double r783162 = -2.6336268525467556e-109;
        bool r783163 = r783156 <= r783162;
        double r783164 = 1.0;
        double r783165 = r783159 / r783156;
        double r783166 = r783164 / r783165;
        double r783167 = 2.391070767296255e-243;
        bool r783168 = r783156 <= r783167;
        double r783169 = 5.340502256432876e+154;
        bool r783170 = r783156 <= r783169;
        double r783171 = r783164 / r783159;
        double r783172 = r783156 * r783171;
        double r783173 = r783159 / r783155;
        double r783174 = r783154 / r783173;
        double r783175 = r783170 ? r783172 : r783174;
        double r783176 = r783168 ? r783161 : r783175;
        double r783177 = r783163 ? r783166 : r783176;
        double r783178 = r783158 ? r783161 : r783177;
        return r783178;
}

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.3
Herbie0.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 4 regimes
  2. if (* x y) < -1.7057825595517517e+222 or -2.6336268525467556e-109 < (* x y) < 2.391070767296255e-243

    1. Initial program 12.2

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

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

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

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

    if -1.7057825595517517e+222 < (* x y) < -2.6336268525467556e-109

    1. Initial program 0.3

      \[\frac{x \cdot y}{z}\]
    2. Using strategy rm
    3. Applied clear-num0.6

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

    if 2.391070767296255e-243 < (* x y) < 5.340502256432876e+154

    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 5.340502256432876e+154 < (* x y)

    1. Initial program 18.1

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \le -1.70578255955175172 \cdot 10^{222}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;x \cdot y \le -2.6336268525467556 \cdot 10^{-109}:\\ \;\;\;\;\frac{1}{\frac{z}{x \cdot y}}\\ \mathbf{elif}\;x \cdot y \le 2.391070767296255 \cdot 10^{-243}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;x \cdot y \le 5.3405022564328761 \cdot 10^{154}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \end{array}\]

Reproduce

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