Average Error: 6.3 → 2.7
Time: 16.7s
Precision: 64
\[\frac{x \cdot y}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y \le -1.479973884495300604070714800261381475132 \cdot 10^{167}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;x \cdot y \le -1.416209028111420696434446461734804676286 \cdot 10^{-165} \lor \neg \left(x \cdot y \le 6.735758574504119133242399316181506457656 \cdot 10^{-122}\right):\\ \;\;\;\;\frac{1}{z} \cdot \left(x \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \end{array}\]
\frac{x \cdot y}{z}
\begin{array}{l}
\mathbf{if}\;x \cdot y \le -1.479973884495300604070714800261381475132 \cdot 10^{167}:\\
\;\;\;\;y \cdot \frac{x}{z}\\

\mathbf{elif}\;x \cdot y \le -1.416209028111420696434446461734804676286 \cdot 10^{-165} \lor \neg \left(x \cdot y \le 6.735758574504119133242399316181506457656 \cdot 10^{-122}\right):\\
\;\;\;\;\frac{1}{z} \cdot \left(x \cdot y\right)\\

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

\end{array}
double f(double x, double y, double z) {
        double r466518 = x;
        double r466519 = y;
        double r466520 = r466518 * r466519;
        double r466521 = z;
        double r466522 = r466520 / r466521;
        return r466522;
}

double f(double x, double y, double z) {
        double r466523 = x;
        double r466524 = y;
        double r466525 = r466523 * r466524;
        double r466526 = -1.4799738844953006e+167;
        bool r466527 = r466525 <= r466526;
        double r466528 = z;
        double r466529 = r466523 / r466528;
        double r466530 = r466524 * r466529;
        double r466531 = -1.4162090281114207e-165;
        bool r466532 = r466525 <= r466531;
        double r466533 = 6.735758574504119e-122;
        bool r466534 = r466525 <= r466533;
        double r466535 = !r466534;
        bool r466536 = r466532 || r466535;
        double r466537 = 1.0;
        double r466538 = r466537 / r466528;
        double r466539 = r466538 * r466525;
        double r466540 = r466528 / r466524;
        double r466541 = r466523 / r466540;
        double r466542 = r466536 ? r466539 : r466541;
        double r466543 = r466527 ? r466530 : r466542;
        return r466543;
}

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.3
Herbie2.7
\[\begin{array}{l} \mathbf{if}\;z \lt -4.262230790519428958560619200129306371776 \cdot 10^{-138}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;z \lt 1.704213066065047207696571404603247573308 \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.4799738844953006e+167

    1. Initial program 19.6

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

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{y}}}\]
    4. Using strategy rm
    5. Applied clear-num1.7

      \[\leadsto \color{blue}{\frac{1}{\frac{\frac{z}{y}}{x}}}\]
    6. Taylor expanded around 0 19.6

      \[\leadsto \color{blue}{\frac{x \cdot y}{z}}\]
    7. Simplified2.4

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

    if -1.4799738844953006e+167 < (* x y) < -1.4162090281114207e-165 or 6.735758574504119e-122 < (* x y)

    1. Initial program 3.2

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

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{y}}}\]
    4. Using strategy rm
    5. Applied div-inv10.0

      \[\leadsto \frac{x}{\color{blue}{z \cdot \frac{1}{y}}}\]
    6. Applied *-un-lft-identity10.0

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

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

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

    if -1.4162090281114207e-165 < (* x y) < 6.735758574504119e-122

    1. Initial program 8.6

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \le -1.479973884495300604070714800261381475132 \cdot 10^{167}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;x \cdot y \le -1.416209028111420696434446461734804676286 \cdot 10^{-165} \lor \neg \left(x \cdot y \le 6.735758574504119133242399316181506457656 \cdot 10^{-122}\right):\\ \;\;\;\;\frac{1}{z} \cdot \left(x \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \end{array}\]

Reproduce

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