Average Error: 6.1 → 0.4
Time: 2.1s
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 r799195 = x;
        double r799196 = y;
        double r799197 = r799195 * r799196;
        double r799198 = z;
        double r799199 = r799197 / r799198;
        return r799199;
}

double f(double x, double y, double z) {
        double r799200 = x;
        double r799201 = y;
        double r799202 = r799200 * r799201;
        double r799203 = -1.0188180482536784e+223;
        bool r799204 = r799202 <= r799203;
        double r799205 = z;
        double r799206 = r799201 / r799205;
        double r799207 = r799200 * r799206;
        double r799208 = -3.398689373478106e-305;
        bool r799209 = r799202 <= r799208;
        double r799210 = r799202 / r799205;
        double r799211 = 8.7562734803604e-315;
        bool r799212 = r799202 <= r799211;
        double r799213 = 8.577619011324073e+191;
        bool r799214 = r799202 <= r799213;
        double r799215 = r799205 / r799201;
        double r799216 = r799200 / r799215;
        double r799217 = r799214 ? r799210 : r799216;
        double r799218 = r799212 ? r799207 : r799217;
        double r799219 = r799209 ? r799210 : r799218;
        double r799220 = r799204 ? r799207 : r799219;
        return r799220;
}

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 +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))