Average Error: 5.8 → 0.6
Time: 1.4m
Precision: 64
\[\frac{x \cdot y}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y \le -1.833851608776524 \cdot 10^{+306}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;x \cdot y \le -2.3839015942083366 \cdot 10^{-250}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;x \cdot y \le -0.0:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;x \cdot y \le 2.306354764114607 \cdot 10^{+117}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \end{array}\]
\frac{x \cdot y}{z}
\begin{array}{l}
\mathbf{if}\;x \cdot y \le -1.833851608776524 \cdot 10^{+306}:\\
\;\;\;\;y \cdot \frac{x}{z}\\

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

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

\mathbf{elif}\;x \cdot y \le 2.306354764114607 \cdot 10^{+117}:\\
\;\;\;\;\frac{x \cdot y}{z}\\

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

\end{array}
double f(double x, double y, double z) {
        double r34242216 = x;
        double r34242217 = y;
        double r34242218 = r34242216 * r34242217;
        double r34242219 = z;
        double r34242220 = r34242218 / r34242219;
        return r34242220;
}

double f(double x, double y, double z) {
        double r34242221 = x;
        double r34242222 = y;
        double r34242223 = r34242221 * r34242222;
        double r34242224 = -1.833851608776524e+306;
        bool r34242225 = r34242223 <= r34242224;
        double r34242226 = z;
        double r34242227 = r34242221 / r34242226;
        double r34242228 = r34242222 * r34242227;
        double r34242229 = -2.3839015942083366e-250;
        bool r34242230 = r34242223 <= r34242229;
        double r34242231 = r34242223 / r34242226;
        double r34242232 = -0.0;
        bool r34242233 = r34242223 <= r34242232;
        double r34242234 = 2.306354764114607e+117;
        bool r34242235 = r34242223 <= r34242234;
        double r34242236 = r34242235 ? r34242231 : r34242228;
        double r34242237 = r34242233 ? r34242228 : r34242236;
        double r34242238 = r34242230 ? r34242231 : r34242237;
        double r34242239 = r34242225 ? r34242228 : r34242238;
        return r34242239;
}

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

Original5.8
Target5.9
Herbie0.6
\[\begin{array}{l} \mathbf{if}\;z \lt -4.262230790519429 \cdot 10^{-138}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;z \lt 1.7042130660650472 \cdot 10^{-164}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} \cdot y\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if (* x y) < -1.833851608776524e+306 or -2.3839015942083366e-250 < (* x y) < -0.0 or 2.306354764114607e+117 < (* x y)

    1. Initial program 18.5

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

      \[\leadsto \color{blue}{\frac{1}{\frac{z}{x \cdot y}}}\]
    4. Using strategy rm
    5. Applied div-inv19.2

      \[\leadsto \frac{1}{\color{blue}{z \cdot \frac{1}{x \cdot y}}}\]
    6. Using strategy rm
    7. Applied div-inv19.2

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

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

    if -1.833851608776524e+306 < (* x y) < -2.3839015942083366e-250 or -0.0 < (* x y) < 2.306354764114607e+117

    1. Initial program 0.4

      \[\frac{x \cdot y}{z}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \le -1.833851608776524 \cdot 10^{+306}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;x \cdot y \le -2.3839015942083366 \cdot 10^{-250}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;x \cdot y \le -0.0:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;x \cdot y \le 2.306354764114607 \cdot 10^{+117}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \end{array}\]

Reproduce

herbie shell --seed 2019158 +o rules:numerics
(FPCore (x y z)
  :name "Diagrams.Solve.Tridiagonal:solveCyclicTriDiagonal from diagrams-solve-0.1, A"

  :herbie-target
  (if (< z -4.262230790519429e-138) (/ (* x y) z) (if (< z 1.7042130660650472e-164) (/ x (/ z y)) (* (/ x z) y)))

  (/ (* x y) z))