Average Error: 6.1 → 0.4
Time: 1.8s
Precision: 64
\[\frac{x \cdot y}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y \le -1.0188180482536784 \cdot 10^{223}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;x \cdot y \le -3.3986893734781059 \cdot 10^{-305}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;x \cdot y \le 8.7562734804 \cdot 10^{-315}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;x \cdot y \le 8.57761901132407323 \cdot 10^{191}:\\ \;\;\;\;\frac{x \cdot y}{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.0188180482536784 \cdot 10^{223}:\\
\;\;\;\;x \cdot \frac{y}{z}\\

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

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

\mathbf{elif}\;x \cdot y \le 8.57761901132407323 \cdot 10^{191}:\\
\;\;\;\;\frac{x \cdot y}{z}\\

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

\end{array}
double f(double x, double y, double z) {
        double r765121 = x;
        double r765122 = y;
        double r765123 = r765121 * r765122;
        double r765124 = z;
        double r765125 = r765123 / r765124;
        return r765125;
}

double f(double x, double y, double z) {
        double r765126 = x;
        double r765127 = y;
        double r765128 = r765126 * r765127;
        double r765129 = -1.0188180482536784e+223;
        bool r765130 = r765128 <= r765129;
        double r765131 = z;
        double r765132 = r765127 / r765131;
        double r765133 = r765126 * r765132;
        double r765134 = -3.398689373478106e-305;
        bool r765135 = r765128 <= r765134;
        double r765136 = r765128 / r765131;
        double r765137 = 8.7562734803604e-315;
        bool r765138 = r765128 <= r765137;
        double r765139 = 8.577619011324073e+191;
        bool r765140 = r765128 <= r765139;
        double r765141 = r765131 / r765127;
        double r765142 = r765126 / r765141;
        double r765143 = r765140 ? r765136 : r765142;
        double r765144 = r765138 ? r765133 : r765143;
        double r765145 = r765135 ? r765136 : r765144;
        double r765146 = r765130 ? r765133 : r765145;
        return r765146;
}

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.2
Herbie0.4
\[\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.0188180482536784e+223 or -3.398689373478106e-305 < (* x y) < 8.7562734803604e-315

    1. Initial program 21.1

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

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

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

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

    if -1.0188180482536784e+223 < (* x y) < -3.398689373478106e-305 or 8.7562734803604e-315 < (* x y) < 8.577619011324073e+191

    1. Initial program 0.2

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

      \[\leadsto \color{blue}{\frac{1}{\frac{z}{x \cdot y}}}\]
    4. Taylor expanded around 0 0.2

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

    if 8.577619011324073e+191 < (* x y)

    1. Initial program 24.9

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \le -1.0188180482536784 \cdot 10^{223}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;x \cdot y \le -3.3986893734781059 \cdot 10^{-305}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;x \cdot y \le 8.7562734804 \cdot 10^{-315}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;x \cdot y \le 8.57761901132407323 \cdot 10^{191}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \end{array}\]

Reproduce

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