Average Error: 6.0 → 3.4
Time: 3.6s
Precision: binary64
\[\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}\]
\[\begin{array}{l} \mathbf{if}\;z \cdot z \leq 1.2927454047009987 \cdot 10^{+20}:\\ \;\;\;\;\frac{\frac{1}{x}}{y \cdot \left(1 + {z}^{6}\right)} \cdot \left(1 + \left(\left(z \cdot z\right) \cdot \left(z \cdot z\right) - z \cdot z\right)\right)\\ \mathbf{elif}\;z \cdot z \leq 2.085299800624733 \cdot 10^{+245}:\\ \;\;\;\;\frac{\sqrt[3]{\frac{1}{x}} \cdot \sqrt[3]{\frac{1}{x}}}{y} \cdot \left(\frac{\sqrt[3]{\frac{1}{x}}}{z} \cdot \left(\frac{1}{z} - \frac{1}{{z}^{3}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{x}}{y + z \cdot \left(z \cdot y\right)}\\ \end{array}\]
\frac{\frac{1}{x}}{y \cdot \left(1 + z \cdot z\right)}
\begin{array}{l}
\mathbf{if}\;z \cdot z \leq 1.2927454047009987 \cdot 10^{+20}:\\
\;\;\;\;\frac{\frac{1}{x}}{y \cdot \left(1 + {z}^{6}\right)} \cdot \left(1 + \left(\left(z \cdot z\right) \cdot \left(z \cdot z\right) - z \cdot z\right)\right)\\

\mathbf{elif}\;z \cdot z \leq 2.085299800624733 \cdot 10^{+245}:\\
\;\;\;\;\frac{\sqrt[3]{\frac{1}{x}} \cdot \sqrt[3]{\frac{1}{x}}}{y} \cdot \left(\frac{\sqrt[3]{\frac{1}{x}}}{z} \cdot \left(\frac{1}{z} - \frac{1}{{z}^{3}}\right)\right)\\

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

\end{array}
(FPCore (x y z) :precision binary64 (/ (/ 1.0 x) (* y (+ 1.0 (* z z)))))
(FPCore (x y z)
 :precision binary64
 (if (<= (* z z) 1.2927454047009987e+20)
   (*
    (/ (/ 1.0 x) (* y (+ 1.0 (pow z 6.0))))
    (+ 1.0 (- (* (* z z) (* z z)) (* z z))))
   (if (<= (* z z) 2.085299800624733e+245)
     (*
      (/ (* (cbrt (/ 1.0 x)) (cbrt (/ 1.0 x))) y)
      (* (/ (cbrt (/ 1.0 x)) z) (- (/ 1.0 z) (/ 1.0 (pow z 3.0)))))
     (/ (/ 1.0 x) (+ y (* z (* z y)))))))
double code(double x, double y, double z) {
	return (1.0 / x) / (y * (1.0 + (z * z)));
}
double code(double x, double y, double z) {
	double tmp;
	if ((z * z) <= 1.2927454047009987e+20) {
		tmp = ((1.0 / x) / (y * (1.0 + pow(z, 6.0)))) * (1.0 + (((z * z) * (z * z)) - (z * z)));
	} else if ((z * z) <= 2.085299800624733e+245) {
		tmp = ((cbrt(1.0 / x) * cbrt(1.0 / x)) / y) * ((cbrt(1.0 / x) / z) * ((1.0 / z) - (1.0 / pow(z, 3.0))));
	} else {
		tmp = (1.0 / x) / (y + (z * (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.0
Target5.3
Herbie3.4
\[\begin{array}{l} \mathbf{if}\;y \cdot \left(1 + z \cdot z\right) < -\infty:\\ \;\;\;\;\frac{\frac{1}{y}}{\left(1 + z \cdot z\right) \cdot x}\\ \mathbf{elif}\;y \cdot \left(1 + z \cdot z\right) < 8.680743250567252 \cdot 10^{+305}:\\ \;\;\;\;\frac{\frac{1}{x}}{\left(1 + z \cdot z\right) \cdot y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{y}}{\left(1 + z \cdot z\right) \cdot x}\\ \end{array}\]

Derivation

  1. Split input into 3 regimes
  2. if (*.f64 z z) < 129274540470099870000

    1. Initial program 0.3

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

      \[\leadsto \frac{\frac{1}{x}}{y \cdot \color{blue}{\frac{{1}^{3} + {\left(z \cdot z\right)}^{3}}{1 \cdot 1 + \left(\left(z \cdot z\right) \cdot \left(z \cdot z\right) - 1 \cdot \left(z \cdot z\right)\right)}}}\]
    4. Applied associate-*r/_binary640.3

      \[\leadsto \frac{\frac{1}{x}}{\color{blue}{\frac{y \cdot \left({1}^{3} + {\left(z \cdot z\right)}^{3}\right)}{1 \cdot 1 + \left(\left(z \cdot z\right) \cdot \left(z \cdot z\right) - 1 \cdot \left(z \cdot z\right)\right)}}}\]
    5. Applied associate-/r/_binary640.3

      \[\leadsto \color{blue}{\frac{\frac{1}{x}}{y \cdot \left({1}^{3} + {\left(z \cdot z\right)}^{3}\right)} \cdot \left(1 \cdot 1 + \left(\left(z \cdot z\right) \cdot \left(z \cdot z\right) - 1 \cdot \left(z \cdot z\right)\right)\right)}\]
    6. Simplified0.3

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

    if 129274540470099870000 < (*.f64 z z) < 2.0852998006247331e245

    1. Initial program 4.9

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

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

      \[\leadsto \color{blue}{\frac{\sqrt[3]{\frac{1}{x}} \cdot \sqrt[3]{\frac{1}{x}}}{y} \cdot \frac{\sqrt[3]{\frac{1}{x}}}{1 + z \cdot z}}\]
    5. Taylor expanded around inf 35.0

      \[\leadsto \frac{\sqrt[3]{\frac{1}{x}} \cdot \sqrt[3]{\frac{1}{x}}}{y} \cdot \color{blue}{\left({\left(\frac{1}{x}\right)}^{0.3333333333333333} \cdot \frac{1}{{z}^{2}} - {\left(\frac{1}{x}\right)}^{0.3333333333333333} \cdot \frac{1}{{z}^{4}}\right)}\]
    6. Simplified3.8

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

    if 2.0852998006247331e245 < (*.f64 z z)

    1. Initial program 15.2

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot z \leq 1.2927454047009987 \cdot 10^{+20}:\\ \;\;\;\;\frac{\frac{1}{x}}{y \cdot \left(1 + {z}^{6}\right)} \cdot \left(1 + \left(\left(z \cdot z\right) \cdot \left(z \cdot z\right) - z \cdot z\right)\right)\\ \mathbf{elif}\;z \cdot z \leq 2.085299800624733 \cdot 10^{+245}:\\ \;\;\;\;\frac{\sqrt[3]{\frac{1}{x}} \cdot \sqrt[3]{\frac{1}{x}}}{y} \cdot \left(\frac{\sqrt[3]{\frac{1}{x}}}{z} \cdot \left(\frac{1}{z} - \frac{1}{{z}^{3}}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{x}}{y + z \cdot \left(z \cdot y\right)}\\ \end{array}\]

Reproduce

herbie shell --seed 2020231 
(FPCore (x y z)
  :name "Statistics.Distribution.CauchyLorentz:$cdensity from math-functions-0.1.5.2"
  :precision binary64

  :herbie-target
  (if (< (* y (+ 1.0 (* z z))) (- INFINITY)) (/ (/ 1.0 y) (* (+ 1.0 (* z z)) x)) (if (< (* y (+ 1.0 (* z z))) 8.680743250567252e+305) (/ (/ 1.0 x) (* (+ 1.0 (* z z)) y)) (/ (/ 1.0 y) (* (+ 1.0 (* z z)) x))))

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