Average Error: 6.0 → 6.5
Time: 6.2s
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 r425690 = x;
        double r425691 = y;
        double r425692 = r425690 * r425691;
        double r425693 = z;
        double r425694 = r425692 / r425693;
        return r425694;
}

double f(double x, double y, double z) {
        double r425695 = x;
        double r425696 = y;
        double r425697 = z;
        double r425698 = r425696 / r425697;
        double r425699 = r425695 * r425698;
        return r425699;
}

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.0
Target6.0
Herbie6.5
\[\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 4 regimes
  2. if (* x y) < -5.357495374115059e+281

    1. Initial program 52.5

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

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

    if -5.357495374115059e+281 < (* x y) < -5.499425698847349e-297 or 3.914580834875209e-253 < (* x y) < 1.404435848755823e+159

    1. Initial program 0.2

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

    if -5.499425698847349e-297 < (* x y) < 3.914580834875209e-253

    1. Initial program 16.0

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

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

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

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

    if 1.404435848755823e+159 < (* x y)

    1. Initial program 19.0

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

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

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

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

Reproduce

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