Average Error: 5.9 → 2.4
Time: 5.5s
Precision: binary64
\[[x, y]=\mathsf{sort}([x, y])\]
\[\frac{x \cdot y}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y \leq -3.5670411781114046 \cdot 10^{-141} \lor \neg \left(x \cdot y \leq 9.134236070867421 \cdot 10^{-110}\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{x}{\frac{z}{y}}\\ \end{array}\]
\frac{x \cdot y}{z}
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -3.5670411781114046 \cdot 10^{-141} \lor \neg \left(x \cdot y \leq 9.134236070867421 \cdot 10^{-110}\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{x}{\frac{z}{y}}\\

\end{array}
(FPCore (x y z) :precision binary64 (/ (* x y) z))
(FPCore (x y z)
 :precision binary64
 (if (or (<= (* x y) -3.5670411781114046e-141)
         (not (<= (* x y) 9.134236070867421e-110)))
   (/
    (* (* y (/ (* (cbrt x) (cbrt x)) (cbrt z))) (/ (cbrt x) (cbrt z)))
    (cbrt z))
   (/ x (/ z y))))
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) <= -3.5670411781114046e-141) || !((x * y) <= 9.134236070867421e-110)) {
		tmp = ((y * ((cbrt(x) * cbrt(x)) / cbrt(z))) * (cbrt(x) / cbrt(z))) / cbrt(z);
	} else {
		tmp = x / (z / y);
	}
	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

Original5.9
Target6.3
Herbie2.4
\[\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) < -3.5670411781114046e-141 or 9.134236070867421e-110 < (*.f64 x y)

    1. Initial program 4.8

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

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

      \[\leadsto \color{blue}{\frac{\frac{x \cdot y}{\sqrt[3]{z} \cdot \sqrt[3]{z}}}{\sqrt[3]{z}}}\]
    5. Simplified7.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 add-cube-cbrt_binary64_212557.3

      \[\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_binary64_212267.3

      \[\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*_binary64_211602.9

      \[\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 -3.5670411781114046e-141 < (*.f64 x y) < 9.134236070867421e-110

    1. Initial program 7.6

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -3.5670411781114046 \cdot 10^{-141} \lor \neg \left(x \cdot y \leq 9.134236070867421 \cdot 10^{-110}\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{x}{\frac{z}{y}}\\ \end{array}\]

Reproduce

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