Average Error: 5.9 → 6.6
Time: 2.5s
Precision: 64
\[\frac{x \cdot y}{z}\]
\[x \cdot \frac{y}{z}\]
\frac{x \cdot y}{z}
x \cdot \frac{y}{z}
double f(double x, double y, double z) {
        double r499618 = x;
        double r499619 = y;
        double r499620 = r499618 * r499619;
        double r499621 = z;
        double r499622 = r499620 / r499621;
        return r499622;
}

double f(double x, double y, double z) {
        double r499623 = x;
        double r499624 = y;
        double r499625 = z;
        double r499626 = r499624 / r499625;
        double r499627 = r499623 * r499626;
        return r499627;
}

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.9
Target6.3
Herbie6.6
\[\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) < -4.091021436327941e+243

    1. Initial program 36.6

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

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

    if -4.091021436327941e+243 < (* x y) < -1.8190585865820965e-194 or 7.3024493326939e-200 < (* x y) < 3.0601772089715925e+243

    1. Initial program 0.2

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

    if -1.8190585865820965e-194 < (* x y) < 7.3024493326939e-200 or 3.0601772089715925e+243 < (* x y)

    1. Initial program 13.4

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

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

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

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

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

Reproduce

herbie shell --seed 1978988140 
(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.70421306606504721e-164) (/ x (/ z y)) (* (/ x z) y)))

  (/ (* x y) z))