Average Error: 6.2 → 6.2
Time: 4.4s
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 r490055 = x;
        double r490056 = y;
        double r490057 = r490055 * r490056;
        double r490058 = z;
        double r490059 = r490057 / r490058;
        return r490059;
}

double f(double x, double y, double z) {
        double r490060 = x;
        double r490061 = y;
        double r490062 = z;
        double r490063 = r490061 / r490062;
        double r490064 = r490060 * r490063;
        return r490064;
}

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.2
Target6.3
Herbie6.2
\[\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) < -inf.0 or -9.822128397102382e-148 < (* x y) < 2.0432590348299073e-242

    1. Initial program 14.3

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

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

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

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

    if -inf.0 < (* x y) < -9.822128397102382e-148 or 2.0432590348299073e-242 < (* x y) < 3.183191360702753e+226

    1. Initial program 0.2

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

    if 3.183191360702753e+226 < (* x y)

    1. Initial program 32.6

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

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

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

Reproduce

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