Average Error: 14.8 → 2.8
Time: 3.3s
Precision: binary64
\[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y \leq 6.638278301525652 \cdot 10^{-131}:\\ \;\;\;\;\frac{x}{z} \cdot \frac{\frac{y}{z}}{z + 1}\\ \mathbf{elif}\;x \cdot y \leq 3.184511130325532 \cdot 10^{+168}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z \cdot \left(z \cdot \left(z + 1\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{z}}{\left(z + 1\right) \cdot \frac{z}{y}}\\ \end{array}\]
\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)}
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq 6.638278301525652 \cdot 10^{-131}:\\
\;\;\;\;\frac{x}{z} \cdot \frac{\frac{y}{z}}{z + 1}\\

\mathbf{elif}\;x \cdot y \leq 3.184511130325532 \cdot 10^{+168}:\\
\;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z \cdot \left(z \cdot \left(z + 1\right)\right)}\\

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

\end{array}
(FPCore (x y z) :precision binary64 (/ (* x y) (* (* z z) (+ z 1.0))))
(FPCore (x y z)
 :precision binary64
 (if (<= (* x y) 6.638278301525652e-131)
   (* (/ x z) (/ (/ y z) (+ z 1.0)))
   (if (<= (* x y) 3.184511130325532e+168)
     (* (* x y) (/ 1.0 (* z (* z (+ z 1.0)))))
     (/ (/ x z) (* (+ z 1.0) (/ z y))))))
double code(double x, double y, double z) {
	return (((double) (x * y)) / ((double) (((double) (z * z)) * ((double) (z + 1.0)))));
}
double code(double x, double y, double z) {
	double tmp;
	if ((((double) (x * y)) <= 6.638278301525652e-131)) {
		tmp = ((double) ((x / z) * ((y / z) / ((double) (z + 1.0)))));
	} else {
		double tmp_1;
		if ((((double) (x * y)) <= 3.184511130325532e+168)) {
			tmp_1 = ((double) (((double) (x * y)) * (1.0 / ((double) (z * ((double) (z * ((double) (z + 1.0)))))))));
		} else {
			tmp_1 = ((x / z) / ((double) (((double) (z + 1.0)) * (z / y))));
		}
		tmp = tmp_1;
	}
	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

Original14.8
Target4.0
Herbie2.8
\[\begin{array}{l} \mathbf{if}\;z < 249.6182814532307:\\ \;\;\;\;\frac{y \cdot \frac{x}{z}}{z + z \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{y}{z}}{1 + z} \cdot x}{z}\\ \end{array}\]

Derivation

  1. Split input into 3 regimes
  2. if (* x y) < 6.6382783015256524e-131

    1. Initial program Error: 15.7 bits

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)}\]
    2. SimplifiedError: 13.9 bits

      \[\leadsto \color{blue}{x \cdot \frac{y}{z \cdot \left(z \cdot \left(z + 1\right)\right)}}\]
    3. Using strategy rm
    4. Applied *-un-lft-identityError: 13.9 bits

      \[\leadsto x \cdot \frac{\color{blue}{1 \cdot y}}{z \cdot \left(z \cdot \left(z + 1\right)\right)}\]
    5. Applied times-fracError: 8.1 bits

      \[\leadsto x \cdot \color{blue}{\left(\frac{1}{z} \cdot \frac{y}{z \cdot \left(z + 1\right)}\right)}\]
    6. Applied associate-*r*Error: 3.9 bits

      \[\leadsto \color{blue}{\left(x \cdot \frac{1}{z}\right) \cdot \frac{y}{z \cdot \left(z + 1\right)}}\]
    7. SimplifiedError: 3.8 bits

      \[\leadsto \color{blue}{\frac{x}{z}} \cdot \frac{y}{z \cdot \left(z + 1\right)}\]
    8. Using strategy rm
    9. Applied associate-/r*Error: 2.6 bits

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

    if 6.6382783015256524e-131 < (* x y) < 3.184511130325532e168

    1. Initial program Error: 3.6 bits

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)}\]
    2. SimplifiedError: 9.7 bits

      \[\leadsto \color{blue}{x \cdot \frac{y}{z \cdot \left(z \cdot \left(z + 1\right)\right)}}\]
    3. Using strategy rm
    4. Applied div-invError: 9.8 bits

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

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

    if 3.184511130325532e168 < (* x y)

    1. Initial program Error: 33.9 bits

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)}\]
    2. SimplifiedError: 22.8 bits

      \[\leadsto \color{blue}{x \cdot \frac{y}{z \cdot \left(z \cdot \left(z + 1\right)\right)}}\]
    3. Using strategy rm
    4. Applied *-un-lft-identityError: 22.8 bits

      \[\leadsto x \cdot \frac{\color{blue}{1 \cdot y}}{z \cdot \left(z \cdot \left(z + 1\right)\right)}\]
    5. Applied times-fracError: 14.3 bits

      \[\leadsto x \cdot \color{blue}{\left(\frac{1}{z} \cdot \frac{y}{z \cdot \left(z + 1\right)}\right)}\]
    6. Applied associate-*r*Error: 11.9 bits

      \[\leadsto \color{blue}{\left(x \cdot \frac{1}{z}\right) \cdot \frac{y}{z \cdot \left(z + 1\right)}}\]
    7. SimplifiedError: 11.9 bits

      \[\leadsto \color{blue}{\frac{x}{z}} \cdot \frac{y}{z \cdot \left(z + 1\right)}\]
    8. Using strategy rm
    9. Applied clear-numError: 11.9 bits

      \[\leadsto \frac{x}{z} \cdot \color{blue}{\frac{1}{\frac{z \cdot \left(z + 1\right)}{y}}}\]
    10. SimplifiedError: 2.7 bits

      \[\leadsto \frac{x}{z} \cdot \frac{1}{\color{blue}{\left(z + 1\right) \cdot \frac{z}{y}}}\]
    11. Using strategy rm
    12. Applied un-div-invError: 2.6 bits

      \[\leadsto \color{blue}{\frac{\frac{x}{z}}{\left(z + 1\right) \cdot \frac{z}{y}}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplificationError: 2.8 bits

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \leq 6.638278301525652 \cdot 10^{-131}:\\ \;\;\;\;\frac{x}{z} \cdot \frac{\frac{y}{z}}{z + 1}\\ \mathbf{elif}\;x \cdot y \leq 3.184511130325532 \cdot 10^{+168}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z \cdot \left(z \cdot \left(z + 1\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{z}}{\left(z + 1\right) \cdot \frac{z}{y}}\\ \end{array}\]

Reproduce

herbie shell --seed 2020204 
(FPCore (x y z)
  :name "Statistics.Distribution.Beta:$cvariance from math-functions-0.1.5.2"
  :precision binary64

  :herbie-target
  (if (< z 249.6182814532307) (/ (* y (/ x z)) (+ z (* z z))) (/ (* (/ (/ y z) (+ 1.0 z)) x) z))

  (/ (* x y) (* (* z z) (+ z 1.0))))