Average Error: 6.4 → 0.5
Time: 2.9s
Precision: binary64
\[\frac{x \cdot y}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y \leq -1.3223259751325834 \cdot 10^{+220}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;x \cdot y \leq -5.368407950621961 \cdot 10^{-169}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;x \cdot y \leq 5.4838713756939765 \cdot 10^{-233} \lor \neg \left(x \cdot y \leq 1.413306160411407 \cdot 10^{+170}\right):\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\ \end{array}\]
\frac{x \cdot y}{z}
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1.3223259751325834 \cdot 10^{+220}:\\
\;\;\;\;y \cdot \frac{x}{z}\\

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

\mathbf{elif}\;x \cdot y \leq 5.4838713756939765 \cdot 10^{-233} \lor \neg \left(x \cdot y \leq 1.413306160411407 \cdot 10^{+170}\right):\\
\;\;\;\;x \cdot \frac{y}{z}\\

\mathbf{else}:\\
\;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\

\end{array}
double code(double x, double y, double z) {
	return (((double) (x * y)) / z);
}
double code(double x, double y, double z) {
	double VAR;
	if ((((double) (x * y)) <= -1.3223259751325834e+220)) {
		VAR = ((double) (y * (x / z)));
	} else {
		double VAR_1;
		if ((((double) (x * y)) <= -5.368407950621961e-169)) {
			VAR_1 = (((double) (x * y)) / z);
		} else {
			double VAR_2;
			if (((((double) (x * y)) <= 5.4838713756939765e-233) || !(((double) (x * y)) <= 1.413306160411407e+170))) {
				VAR_2 = ((double) (x * (y / z)));
			} else {
				VAR_2 = ((double) (((double) (x * y)) * (1.0 / z)));
			}
			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.0
Herbie0.5
\[\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 4 regimes
  2. if (* x y) < -1.32232597513258336e220

    1. Initial program 31.4

      \[\frac{x \cdot y}{z}\]
    2. Simplified0.8

      \[\leadsto \color{blue}{x \cdot \frac{y}{z}}\]
    3. Using strategy rm
    4. Applied add-cube-cbrt1.9

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

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

      \[\leadsto \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \color{blue}{\left(y \cdot \frac{\sqrt[3]{x}}{z}\right)}\]
    7. Taylor expanded around 0 31.4

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

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

    if -1.32232597513258336e220 < (* x y) < -5.368407950621961e-169

    1. Initial program 0.2

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

    if -5.368407950621961e-169 < (* x y) < 5.4838713756939765e-233 or 1.413306160411407e170 < (* x y)

    1. Initial program 13.1

      \[\frac{x \cdot y}{z}\]
    2. Simplified0.8

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

    if 5.4838713756939765e-233 < (* x y) < 1.413306160411407e170

    1. Initial program 0.2

      \[\frac{x \cdot y}{z}\]
    2. Simplified9.3

      \[\leadsto \color{blue}{x \cdot \frac{y}{z}}\]
    3. Using strategy rm
    4. Applied div-inv9.4

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

      \[\leadsto \color{blue}{\left(x \cdot y\right) \cdot \frac{1}{z}}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification0.5

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -1.3223259751325834 \cdot 10^{+220}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;x \cdot y \leq -5.368407950621961 \cdot 10^{-169}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;x \cdot y \leq 5.4838713756939765 \cdot 10^{-233} \lor \neg \left(x \cdot y \leq 1.413306160411407 \cdot 10^{+170}\right):\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\ \end{array}\]

Reproduce

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