Average Error: 6.4 → 0.8
Time: 2.4s
Precision: binary64
\[\frac{x \cdot y}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y \le -1.03503849399067314 \cdot 10^{267}:\\ \;\;\;\;1 \cdot \frac{y}{\frac{z}{x}}\\ \mathbf{elif}\;x \cdot y \le -9.866142668864628 \cdot 10^{-166}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\ \mathbf{elif}\;x \cdot y \le 7.5555636571463154 \cdot 10^{-196}:\\ \;\;\;\;\frac{x}{z} \cdot y\\ \mathbf{elif}\;x \cdot y \le 2.3243808469123401 \cdot 10^{120}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \end{array}\]
\frac{x \cdot y}{z}
\begin{array}{l}
\mathbf{if}\;x \cdot y \le -1.03503849399067314 \cdot 10^{267}:\\
\;\;\;\;1 \cdot \frac{y}{\frac{z}{x}}\\

\mathbf{elif}\;x \cdot y \le -9.866142668864628 \cdot 10^{-166}:\\
\;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\

\mathbf{elif}\;x \cdot y \le 7.5555636571463154 \cdot 10^{-196}:\\
\;\;\;\;\frac{x}{z} \cdot y\\

\mathbf{elif}\;x \cdot y \le 2.3243808469123401 \cdot 10^{120}:\\
\;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\

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

\end{array}
double code(double x, double y, double z) {
	return ((double) (((double) (x * y)) / z));
}
double code(double x, double y, double z) {
	double VAR;
	if ((((double) (x * y)) <= -1.0350384939906731e+267)) {
		VAR = ((double) (1.0 * ((double) (y / ((double) (z / x))))));
	} else {
		double VAR_1;
		if ((((double) (x * y)) <= -9.866142668864628e-166)) {
			VAR_1 = ((double) (((double) (x * y)) * ((double) (1.0 / z))));
		} else {
			double VAR_2;
			if ((((double) (x * y)) <= 7.555563657146315e-196)) {
				VAR_2 = ((double) (((double) (x / z)) * y));
			} else {
				double VAR_3;
				if ((((double) (x * y)) <= 2.32438084691234e+120)) {
					VAR_3 = ((double) (((double) (x * y)) * ((double) (1.0 / z))));
				} else {
					VAR_3 = ((double) (x * ((double) (y / z))));
				}
				VAR_2 = VAR_3;
			}
			VAR_1 = VAR_2;
		}
		VAR = VAR_1;
	}
	return VAR;
}

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.4
Target6.3
Herbie0.8
\[\begin{array}{l} \mathbf{if}\;z \lt -4.262230790519429 \cdot 10^{-138}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;z \lt 1.70421306606504721 \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) < -1.03503849399067314e267

    1. Initial program 46.6

      \[\frac{x \cdot y}{z}\]
    2. Using strategy rm
    3. Applied clear-num46.6

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

      \[\leadsto \frac{1}{\color{blue}{\frac{\frac{z}{x}}{y}}}\]
    6. Using strategy rm
    7. Applied *-un-lft-identity0.6

      \[\leadsto \frac{1}{\frac{\frac{z}{x}}{\color{blue}{1 \cdot y}}}\]
    8. Applied *-un-lft-identity0.6

      \[\leadsto \frac{1}{\frac{\frac{z}{\color{blue}{1 \cdot x}}}{1 \cdot y}}\]
    9. Applied *-un-lft-identity0.6

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

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

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

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

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

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

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

    if -1.03503849399067314e267 < (* x y) < -9.866142668864628e-166 or 7.5555636571463154e-196 < (* x y) < 2.3243808469123401e120

    1. Initial program 0.2

      \[\frac{x \cdot y}{z}\]
    2. Using strategy rm
    3. Applied div-inv0.3

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

    if -9.866142668864628e-166 < (* x y) < 7.5555636571463154e-196

    1. Initial program 9.9

      \[\frac{x \cdot y}{z}\]
    2. Using strategy rm
    3. Applied clear-num10.3

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

      \[\leadsto \frac{1}{\color{blue}{\frac{\frac{z}{x}}{y}}}\]
    6. Using strategy rm
    7. Applied div-inv1.6

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

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

      \[\leadsto \color{blue}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\frac{z}{x}} \cdot \frac{\sqrt[3]{1}}{\frac{1}{y}}}\]
    10. Simplified0.9

      \[\leadsto \color{blue}{\frac{x}{z}} \cdot \frac{\sqrt[3]{1}}{\frac{1}{y}}\]
    11. Simplified0.9

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

    if 2.3243808469123401e120 < (* x y)

    1. Initial program 15.1

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \le -1.03503849399067314 \cdot 10^{267}:\\ \;\;\;\;1 \cdot \frac{y}{\frac{z}{x}}\\ \mathbf{elif}\;x \cdot y \le -9.866142668864628 \cdot 10^{-166}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\ \mathbf{elif}\;x \cdot y \le 7.5555636571463154 \cdot 10^{-196}:\\ \;\;\;\;\frac{x}{z} \cdot y\\ \mathbf{elif}\;x \cdot y \le 2.3243808469123401 \cdot 10^{120}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \end{array}\]

Reproduce

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