Average Error: 6.3 → 1.8
Time: 1.5s
Precision: 64
\[\frac{x \cdot y}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y = -\infty:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{elif}\;x \cdot y \le -4.1872115872888202 \cdot 10^{-218}:\\ \;\;\;\;\frac{1}{\frac{z}{x \cdot y}}\\ \mathbf{elif}\;x \cdot y \le 8.47685242098004365 \cdot 10^{-299}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;1 \cdot \frac{x \cdot y}{z}\\ \end{array}\]
\frac{x \cdot y}{z}
\begin{array}{l}
\mathbf{if}\;x \cdot y = -\infty:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\

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

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

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

\end{array}
double f(double x, double y, double z) {
        double r847180 = x;
        double r847181 = y;
        double r847182 = r847180 * r847181;
        double r847183 = z;
        double r847184 = r847182 / r847183;
        return r847184;
}

double f(double x, double y, double z) {
        double r847185 = x;
        double r847186 = y;
        double r847187 = r847185 * r847186;
        double r847188 = -inf.0;
        bool r847189 = r847187 <= r847188;
        double r847190 = z;
        double r847191 = r847190 / r847186;
        double r847192 = r847185 / r847191;
        double r847193 = -4.18721158728882e-218;
        bool r847194 = r847187 <= r847193;
        double r847195 = 1.0;
        double r847196 = r847190 / r847187;
        double r847197 = r847195 / r847196;
        double r847198 = 8.476852420980044e-299;
        bool r847199 = r847187 <= r847198;
        double r847200 = r847186 / r847190;
        double r847201 = r847185 * r847200;
        double r847202 = r847187 / r847190;
        double r847203 = r847195 * r847202;
        double r847204 = r847199 ? r847201 : r847203;
        double r847205 = r847194 ? r847197 : r847204;
        double r847206 = r847189 ? r847192 : r847205;
        return r847206;
}

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
Target5.9
Herbie1.8
\[\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) < -inf.0

    1. Initial program 64.0

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

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

    if -inf.0 < (* x y) < -4.18721158728882e-218

    1. Initial program 0.2

      \[\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 -4.18721158728882e-218 < (* x y) < 8.476852420980044e-299

    1. Initial program 15.5

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

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

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

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

    if 8.476852420980044e-299 < (* x y)

    1. Initial program 3.7

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

      \[\leadsto \color{blue}{\frac{1}{\frac{z}{x \cdot y}}}\]
    4. Using strategy rm
    5. Applied *-un-lft-identity4.1

      \[\leadsto \frac{1}{\color{blue}{1 \cdot \frac{z}{x \cdot y}}}\]
    6. Applied add-cube-cbrt4.1

      \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \sqrt[3]{1}}}{1 \cdot \frac{z}{x \cdot y}}\]
    7. Applied times-frac4.1

      \[\leadsto \color{blue}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{1} \cdot \frac{\sqrt[3]{1}}{\frac{z}{x \cdot y}}}\]
    8. Simplified4.1

      \[\leadsto \color{blue}{1} \cdot \frac{\sqrt[3]{1}}{\frac{z}{x \cdot y}}\]
    9. Simplified3.7

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y = -\infty:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{elif}\;x \cdot y \le -4.1872115872888202 \cdot 10^{-218}:\\ \;\;\;\;\frac{1}{\frac{z}{x \cdot y}}\\ \mathbf{elif}\;x \cdot y \le 8.47685242098004365 \cdot 10^{-299}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;1 \cdot \frac{x \cdot y}{z}\\ \end{array}\]

Reproduce

herbie shell --seed 2020035 
(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))