Average Error: 6.1 → 1.0
Time: 22.8s
Precision: 64
\[\frac{x \cdot y}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y \le -3.215556071613412899309254113303266622928 \cdot 10^{211}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;x \cdot y \le -8.160507073987472840955517624398211725717 \cdot 10^{-196}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\ \mathbf{elif}\;x \cdot y \le -0.0:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{elif}\;x \cdot y \le 3.674603601854208702851027640434707440909 \cdot 10^{86}:\\ \;\;\;\;\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 -3.215556071613412899309254113303266622928 \cdot 10^{211}:\\
\;\;\;\;x \cdot \frac{y}{z}\\

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

\mathbf{elif}\;x \cdot y \le -0.0:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\

\mathbf{elif}\;x \cdot y \le 3.674603601854208702851027640434707440909 \cdot 10^{86}:\\
\;\;\;\;\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 r545589 = x;
        double r545590 = y;
        double r545591 = r545589 * r545590;
        double r545592 = z;
        double r545593 = r545591 / r545592;
        return r545593;
}

double f(double x, double y, double z) {
        double r545594 = x;
        double r545595 = y;
        double r545596 = r545594 * r545595;
        double r545597 = -3.215556071613413e+211;
        bool r545598 = r545596 <= r545597;
        double r545599 = z;
        double r545600 = r545595 / r545599;
        double r545601 = r545594 * r545600;
        double r545602 = -8.160507073987473e-196;
        bool r545603 = r545596 <= r545602;
        double r545604 = 1.0;
        double r545605 = r545604 / r545599;
        double r545606 = r545596 * r545605;
        double r545607 = -0.0;
        bool r545608 = r545596 <= r545607;
        double r545609 = r545599 / r545595;
        double r545610 = r545594 / r545609;
        double r545611 = 3.6746036018542087e+86;
        bool r545612 = r545596 <= r545611;
        double r545613 = r545612 ? r545606 : r545601;
        double r545614 = r545608 ? r545610 : r545613;
        double r545615 = r545603 ? r545606 : r545614;
        double r545616 = r545598 ? r545601 : r545615;
        return r545616;
}

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.4
Herbie1.0
\[\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) < -3.215556071613413e+211 or 3.6746036018542087e+86 < (* x y)

    1. Initial program 17.8

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

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

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

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

    if -3.215556071613413e+211 < (* x y) < -8.160507073987473e-196 or -0.0 < (* x y) < 3.6746036018542087e+86

    1. Initial program 0.4

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

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

    if -8.160507073987473e-196 < (* x y) < -0.0

    1. Initial program 13.4

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \le -3.215556071613412899309254113303266622928 \cdot 10^{211}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;x \cdot y \le -8.160507073987472840955517624398211725717 \cdot 10^{-196}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\ \mathbf{elif}\;x \cdot y \le -0.0:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{elif}\;x \cdot y \le 3.674603601854208702851027640434707440909 \cdot 10^{86}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \end{array}\]

Reproduce

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