Average Error: 6.2 → 1.1
Time: 5.2s
Precision: binary64
\[[x, y]=\mathsf{sort}([x, y])\]
\[\frac{x \cdot y}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y \leq -2.882304771437299 \cdot 10^{+93}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;x \cdot y \leq -7.344780174854295 \cdot 10^{-186}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;x \cdot y \leq 1.3111738487107896 \cdot 10^{-283}:\\ \;\;\;\;\frac{y}{\frac{z}{x}}\\ \mathbf{elif}\;x \cdot y \leq 3.652997212110425 \cdot 10^{+139}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \end{array}\]
\frac{x \cdot y}{z}
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2.882304771437299 \cdot 10^{+93}:\\
\;\;\;\;y \cdot \frac{x}{z}\\

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

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

\mathbf{elif}\;x \cdot y \leq 3.652997212110425 \cdot 10^{+139}:\\
\;\;\;\;\frac{x \cdot y}{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 (<= (* x y) -2.882304771437299e+93)
   (* y (/ x z))
   (if (<= (* x y) -7.344780174854295e-186)
     (/ (* x y) z)
     (if (<= (* x y) 1.3111738487107896e-283)
       (/ y (/ z x))
       (if (<= (* x y) 3.652997212110425e+139) (/ (* x y) 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) <= -2.882304771437299e+93) {
		tmp = y * (x / z);
	} else if ((x * y) <= -7.344780174854295e-186) {
		tmp = (x * y) / z;
	} else if ((x * y) <= 1.3111738487107896e-283) {
		tmp = y / (z / x);
	} else if ((x * y) <= 3.652997212110425e+139) {
		tmp = (x * y) / 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

Original6.2
Target6.3
Herbie1.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 4 regimes
  2. if (*.f64 x y) < -2.8823047714372988e93

    1. Initial program 12.4

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

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

      \[\leadsto \color{blue}{\frac{\frac{x \cdot y}{\sqrt[3]{z} \cdot \sqrt[3]{z}}}{\sqrt[3]{z}}}\]
    5. Simplified5.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 *-un-lft-identity_binary64_178105.9

      \[\leadsto \frac{y \cdot \frac{x}{\sqrt[3]{z} \cdot \sqrt[3]{z}}}{\color{blue}{1 \cdot \sqrt[3]{z}}}\]
    8. Applied times-frac_binary64_178165.1

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

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

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

    if -2.8823047714372988e93 < (*.f64 x y) < -7.3447801748542952e-186 or 1.31117384871078956e-283 < (*.f64 x y) < 3.6529972121104252e139

    1. Initial program 0.2

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

    if -7.3447801748542952e-186 < (*.f64 x y) < 1.31117384871078956e-283

    1. Initial program 12.0

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

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

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

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

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

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

    if 3.6529972121104252e139 < (*.f64 x y)

    1. Initial program 18.5

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq -2.882304771437299 \cdot 10^{+93}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;x \cdot y \leq -7.344780174854295 \cdot 10^{-186}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;x \cdot y \leq 1.3111738487107896 \cdot 10^{-283}:\\ \;\;\;\;\frac{y}{\frac{z}{x}}\\ \mathbf{elif}\;x \cdot y \leq 3.652997212110425 \cdot 10^{+139}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \end{array}\]

Reproduce

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