Average Error: 6.5 → 2.1
Time: 3.3s
Precision: binary64
\[[x, y]=\mathsf{sort}([x, y])\]
\[\frac{x \cdot y}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y \leq -6.188455075910293 \cdot 10^{-153} \lor \neg \left(x \cdot y \leq 3.775274464953522 \cdot 10^{-137}\right):\\ \;\;\;\;\frac{\left(y \cdot \frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\sqrt[3]{z}}\right) \cdot \frac{\sqrt[3]{x}}{\sqrt[3]{z}}}{\sqrt[3]{z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{\frac{z}{x}}\\ \end{array}\]
\frac{x \cdot y}{z}
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -6.188455075910293 \cdot 10^{-153} \lor \neg \left(x \cdot y \leq 3.775274464953522 \cdot 10^{-137}\right):\\
\;\;\;\;\frac{\left(y \cdot \frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\sqrt[3]{z}}\right) \cdot \frac{\sqrt[3]{x}}{\sqrt[3]{z}}}{\sqrt[3]{z}}\\

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

\end{array}
(FPCore (x y z) :precision binary64 (/ (* x y) z))
(FPCore (x y z)
 :precision binary64
 (if (or (<= (* x y) -6.188455075910293e-153)
         (not (<= (* x y) 3.775274464953522e-137)))
   (/
    (* (* y (/ (* (cbrt x) (cbrt x)) (cbrt z))) (/ (cbrt x) (cbrt z)))
    (cbrt z))
   (/ y (/ z x))))
double code(double x, double y, double z) {
	return (x * y) / z;
}
double code(double x, double y, double z) {
	double tmp;
	if (((x * y) <= -6.188455075910293e-153) || !((x * y) <= 3.775274464953522e-137)) {
		tmp = ((y * ((cbrt(x) * cbrt(x)) / cbrt(z))) * (cbrt(x) / cbrt(z))) / cbrt(z);
	} else {
		tmp = y / (z / x);
	}
	return tmp;
}

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.5
Target6.2
Herbie2.1
\[\begin{array}{l} \mathbf{if}\;z < -4.262230790519429 \cdot 10^{-138}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;z < 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 (*.f64 x y) < -6.1884550759102927e-153 or 3.7752744649535218e-137 < (*.f64 x y)

    1. Initial program 5.1

      \[\frac{x \cdot y}{z}\]
    2. Using strategy rm
    3. Applied add-cube-cbrt_binary646.1

      \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right) \cdot \sqrt[3]{z}}}\]
    4. Applied associate-/r*_binary646.1

      \[\leadsto \color{blue}{\frac{\frac{x \cdot y}{\sqrt[3]{z} \cdot \sqrt[3]{z}}}{\sqrt[3]{z}}}\]
    5. Simplified6.9

      \[\leadsto \frac{\color{blue}{y \cdot \frac{x}{\sqrt[3]{z} \cdot \sqrt[3]{z}}}}{\sqrt[3]{z}}\]
    6. Using strategy rm
    7. Applied add-cube-cbrt_binary647.1

      \[\leadsto \frac{y \cdot \frac{\color{blue}{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \sqrt[3]{x}}}{\sqrt[3]{z} \cdot \sqrt[3]{z}}}{\sqrt[3]{z}}\]
    8. Applied times-frac_binary647.1

      \[\leadsto \frac{y \cdot \color{blue}{\left(\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\sqrt[3]{z}} \cdot \frac{\sqrt[3]{x}}{\sqrt[3]{z}}\right)}}{\sqrt[3]{z}}\]
    9. Applied associate-*r*_binary642.5

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

    if -6.1884550759102927e-153 < (*.f64 x y) < 3.7752744649535218e-137

    1. Initial program 9.0

      \[\frac{x \cdot y}{z}\]
    2. Using strategy rm
    3. Applied add-cube-cbrt_binary649.5

      \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right) \cdot \sqrt[3]{z}}}\]
    4. Applied associate-/r*_binary649.5

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

      \[\leadsto \frac{\color{blue}{y \cdot \frac{x}{\sqrt[3]{z} \cdot \sqrt[3]{z}}}}{\sqrt[3]{z}}\]
    6. Using strategy rm
    7. Applied associate-/l*_binary641.9

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -6.188455075910293 \cdot 10^{-153} \lor \neg \left(x \cdot y \leq 3.775274464953522 \cdot 10^{-137}\right):\\ \;\;\;\;\frac{\left(y \cdot \frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\sqrt[3]{z}}\right) \cdot \frac{\sqrt[3]{x}}{\sqrt[3]{z}}}{\sqrt[3]{z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{\frac{z}{x}}\\ \end{array}\]

Reproduce

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