Average Error: 6.3 → 0.7
Time: 7.1s
Precision: 64
\[\frac{x \cdot y}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y \le -1.00913018527108544 \cdot 10^{193}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{elif}\;x \cdot y \le -6.28788729122934697 \cdot 10^{-143}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\ \mathbf{elif}\;x \cdot y \le 1.5244214612354576 \cdot 10^{-284}:\\ \;\;\;\;\frac{x}{z} \cdot y\\ \mathbf{elif}\;x \cdot y \le 9.81129541249854884 \cdot 10^{171}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \end{array}\]
\frac{x \cdot y}{z}
\begin{array}{l}
\mathbf{if}\;x \cdot y \le -1.00913018527108544 \cdot 10^{193}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\

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

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

\mathbf{elif}\;x \cdot y \le 9.81129541249854884 \cdot 10^{171}:\\
\;\;\;\;\frac{x \cdot y}{z}\\

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

\end{array}
double f(double x, double y, double z) {
        double r739219 = x;
        double r739220 = y;
        double r739221 = r739219 * r739220;
        double r739222 = z;
        double r739223 = r739221 / r739222;
        return r739223;
}

double f(double x, double y, double z) {
        double r739224 = x;
        double r739225 = y;
        double r739226 = r739224 * r739225;
        double r739227 = -1.0091301852710854e+193;
        bool r739228 = r739226 <= r739227;
        double r739229 = z;
        double r739230 = r739229 / r739225;
        double r739231 = r739224 / r739230;
        double r739232 = -6.287887291229347e-143;
        bool r739233 = r739226 <= r739232;
        double r739234 = 1.0;
        double r739235 = r739234 / r739229;
        double r739236 = r739226 * r739235;
        double r739237 = 1.5244214612354576e-284;
        bool r739238 = r739226 <= r739237;
        double r739239 = r739224 / r739229;
        double r739240 = r739239 * r739225;
        double r739241 = 9.811295412498549e+171;
        bool r739242 = r739226 <= r739241;
        double r739243 = r739226 / r739229;
        double r739244 = r739225 / r739229;
        double r739245 = r739224 * r739244;
        double r739246 = r739242 ? r739243 : r739245;
        double r739247 = r739238 ? r739240 : r739246;
        double r739248 = r739233 ? r739236 : r739247;
        double r739249 = r739228 ? r739231 : r739248;
        return r739249;
}

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.2
Herbie0.7
\[\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 5 regimes
  2. if (* x y) < -1.0091301852710854e+193

    1. Initial program 24.7

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

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

    if -1.0091301852710854e+193 < (* x y) < -6.287887291229347e-143

    1. Initial program 0.3

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

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

    if -6.287887291229347e-143 < (* x y) < 1.5244214612354576e-284

    1. Initial program 11.1

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

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{y}}}\]
    4. Using strategy rm
    5. Applied associate-/r/1.1

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

    if 1.5244214612354576e-284 < (* x y) < 9.811295412498549e+171

    1. Initial program 0.2

      \[\frac{x \cdot y}{z}\]

    if 9.811295412498549e+171 < (* x y)

    1. Initial program 22.4

      \[\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 *-un-lft-identity1.7

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

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

      \[\leadsto \frac{x}{\color{blue}{\frac{1}{1} \cdot \frac{z}{y}}}\]
    8. Applied *-un-lft-identity1.7

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

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

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

      \[\leadsto 1 \cdot \color{blue}{\left(x \cdot \frac{y}{z}\right)}\]
  3. Recombined 5 regimes into one program.
  4. Final simplification0.7

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \le -1.00913018527108544 \cdot 10^{193}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{elif}\;x \cdot y \le -6.28788729122934697 \cdot 10^{-143}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\ \mathbf{elif}\;x \cdot y \le 1.5244214612354576 \cdot 10^{-284}:\\ \;\;\;\;\frac{x}{z} \cdot y\\ \mathbf{elif}\;x \cdot y \le 9.81129541249854884 \cdot 10^{171}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \end{array}\]

Reproduce

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