Average Error: 15.2 → 4.0
Time: 3.0s
Precision: binary64
\[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)}\]
\[\begin{array}{l} \mathbf{if}\;\left(z \cdot z\right) \cdot \left(z + 1\right) \le -3.0921613456996715 \cdot 10^{119}:\\ \;\;\;\;\frac{1}{z} \cdot \frac{x \cdot \frac{y}{z + 1}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{z}}{\frac{z \cdot \left(z + 1\right)}{y}}\\ \end{array}\]
\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)}
\begin{array}{l}
\mathbf{if}\;\left(z \cdot z\right) \cdot \left(z + 1\right) \le -3.0921613456996715 \cdot 10^{119}:\\
\;\;\;\;\frac{1}{z} \cdot \frac{x \cdot \frac{y}{z + 1}}{z}\\

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

\end{array}
double code(double x, double y, double z) {
	return ((double) (((double) (x * y)) / ((double) (((double) (z * z)) * ((double) (z + 1.0))))));
}
double code(double x, double y, double z) {
	double VAR;
	if ((((double) (((double) (z * z)) * ((double) (z + 1.0)))) <= -3.0921613456996715e+119)) {
		VAR = ((double) (((double) (1.0 / z)) * ((double) (((double) (x * ((double) (y / ((double) (z + 1.0)))))) / z))));
	} else {
		VAR = ((double) (((double) (x / z)) / ((double) (((double) (z * ((double) (z + 1.0)))) / y))));
	}
	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

Original15.2
Target4.1
Herbie4.0
\[\begin{array}{l} \mathbf{if}\;z \lt 249.618281453230708:\\ \;\;\;\;\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 2 regimes
  2. if (* (* z z) (+ z 1.0)) < -3.0921613456996715e119

    1. Initial program 12.4

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)}\]
    2. Using strategy rm
    3. Applied times-frac5.3

      \[\leadsto \color{blue}{\frac{x}{z \cdot z} \cdot \frac{y}{z + 1}}\]
    4. Using strategy rm
    5. Applied *-un-lft-identity5.3

      \[\leadsto \frac{\color{blue}{1 \cdot x}}{z \cdot z} \cdot \frac{y}{z + 1}\]
    6. Applied times-frac2.2

      \[\leadsto \color{blue}{\left(\frac{1}{z} \cdot \frac{x}{z}\right)} \cdot \frac{y}{z + 1}\]
    7. Applied associate-*l*1.2

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

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

    if -3.0921613456996715e119 < (* (* z z) (+ z 1.0))

    1. Initial program 16.3

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1\right)}\]
    2. Using strategy rm
    3. Applied times-frac13.5

      \[\leadsto \color{blue}{\frac{x}{z \cdot z} \cdot \frac{y}{z + 1}}\]
    4. Using strategy rm
    5. Applied *-un-lft-identity13.5

      \[\leadsto \frac{\color{blue}{1 \cdot x}}{z \cdot z} \cdot \frac{y}{z + 1}\]
    6. Applied times-frac7.5

      \[\leadsto \color{blue}{\left(\frac{1}{z} \cdot \frac{x}{z}\right)} \cdot \frac{y}{z + 1}\]
    7. Applied associate-*l*3.3

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

      \[\leadsto \frac{1}{z} \cdot \color{blue}{\frac{\frac{x}{z} \cdot y}{z + 1}}\]
    10. Applied frac-times5.0

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

      \[\leadsto \frac{\color{blue}{\frac{x}{z} \cdot y}}{z \cdot \left(z + 1\right)}\]
    12. Using strategy rm
    13. Applied associate-/l*4.7

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(z \cdot z\right) \cdot \left(z + 1\right) \le -3.0921613456996715 \cdot 10^{119}:\\ \;\;\;\;\frac{1}{z} \cdot \frac{x \cdot \frac{y}{z + 1}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{z}}{\frac{z \cdot \left(z + 1\right)}{y}}\\ \end{array}\]

Reproduce

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