Average Error: 6.5 → 1.6
Time: 2.6s
Precision: binary64
\[[x, y]=\mathsf{sort}([x, y])\]
\[\frac{x \cdot y}{z} \]
\[\begin{array}{l} \mathbf{if}\;x \cdot y \leq -\infty:\\ \;\;\;\;\frac{1}{\frac{\frac{z}{y}}{x}}\\ \mathbf{elif}\;x \cdot y \leq -2.929739868498803 \cdot 10^{-293}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\sqrt[3]{z} \cdot \sqrt[3]{z}} \cdot \frac{\sqrt[3]{x}}{\frac{\sqrt[3]{z}}{y}}\\ \end{array} \]
\frac{x \cdot y}{z}
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -\infty:\\
\;\;\;\;\frac{1}{\frac{\frac{z}{y}}{x}}\\

\mathbf{elif}\;x \cdot y \leq -2.929739868498803 \cdot 10^{-293}:\\
\;\;\;\;\frac{x \cdot y}{z}\\

\mathbf{else}:\\
\;\;\;\;\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\sqrt[3]{z} \cdot \sqrt[3]{z}} \cdot \frac{\sqrt[3]{x}}{\frac{\sqrt[3]{z}}{y}}\\


\end{array}
(FPCore (x y z) :precision binary64 (/ (* x y) z))
(FPCore (x y z)
 :precision binary64
 (if (<= (* x y) (- INFINITY))
   (/ 1.0 (/ (/ z y) x))
   (if (<= (* x y) -2.929739868498803e-293)
     (/ (* x y) z)
     (*
      (/ (* (cbrt x) (cbrt x)) (* (cbrt z) (cbrt z)))
      (/ (cbrt x) (/ (cbrt 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) <= -((double) INFINITY)) {
		tmp = 1.0 / ((z / y) / x);
	} else if ((x * y) <= -2.929739868498803e-293) {
		tmp = (x * y) / z;
	} else {
		tmp = ((cbrt(x) * cbrt(x)) / (cbrt(z) * cbrt(z))) * (cbrt(x) / (cbrt(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

Original6.5
Target6.5
Herbie1.6
\[\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 3 regimes
  2. if (*.f64 x y) < -inf.0

    1. Initial program 64.0

      \[\frac{x \cdot y}{z} \]
    2. Applied associate-/l*_binary640.3

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{y}}} \]
    3. Applied clear-num_binary640.4

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

    if -inf.0 < (*.f64 x y) < -2.9297398684988028e-293

    1. Initial program 0.2

      \[\frac{x \cdot y}{z} \]
    2. Applied *-un-lft-identity_binary640.2

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

      \[\leadsto \color{blue}{\frac{x}{1} \cdot \frac{y}{z}} \]
    4. Simplified7.4

      \[\leadsto \color{blue}{x} \cdot \frac{y}{z} \]
    5. Taylor expanded in x around 0 0.2

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

    if -2.9297398684988028e-293 < (*.f64 x y)

    1. Initial program 8.1

      \[\frac{x \cdot y}{z} \]
    2. Applied associate-/l*_binary645.9

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{y}}} \]
    3. Applied *-un-lft-identity_binary645.9

      \[\leadsto \frac{x}{\frac{z}{\color{blue}{1 \cdot y}}} \]
    4. Applied add-cube-cbrt_binary646.6

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

      \[\leadsto \frac{x}{\color{blue}{\frac{\sqrt[3]{z} \cdot \sqrt[3]{z}}{1} \cdot \frac{\sqrt[3]{z}}{y}}} \]
    6. Applied add-cube-cbrt_binary646.8

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -\infty:\\ \;\;\;\;\frac{1}{\frac{\frac{z}{y}}{x}}\\ \mathbf{elif}\;x \cdot y \leq -2.929739868498803 \cdot 10^{-293}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\sqrt[3]{z} \cdot \sqrt[3]{z}} \cdot \frac{\sqrt[3]{x}}{\frac{\sqrt[3]{z}}{y}}\\ \end{array} \]

Reproduce

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