Average Error: 14.8 → 2.5
Time: 35.9s
Precision: 64
Internal precision: 128
\[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1.0\right)}\]
\[\frac{\frac{\frac{x}{z}}{\frac{z}{y}}}{z + 1.0}\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

Original14.8
Comparison3.9
Herbie2.5
\[ \begin{array}{l} \mathbf{if}\;z \lt 249.6182814532307:\\ \;\;\;\;\frac{y \cdot \frac{x}{z}}{z + {z}^2}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{y}{z}}{1 + z} \cdot x}{z}\\ \end{array} \]

Derivation

  1. Initial program 14.8

    \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1.0\right)}\]
  2. Applied taylor 23.6

    \[\leadsto \frac{x \cdot y}{{z}^{3} + 1.0 \cdot {z}^2}\]
  3. Taylor expanded around 0 23.6

    \[\leadsto \frac{x \cdot y}{\color{blue}{{z}^{3} + 1.0 \cdot {z}^2}}\]
  4. Applied simplify 3.0

    \[\leadsto \color{blue}{\frac{\frac{x}{z}}{z + 1.0} \cdot \frac{y}{z}}\]
  5. Using strategy rm
  6. Applied div-inv 3.1

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

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

    \[\leadsto \color{blue}{\frac{\frac{x}{z} \cdot y}{z + 1.0}} \cdot \frac{1}{z}\]
  10. Applied associate-*l/ 3.1

    \[\leadsto \color{blue}{\frac{\left(\frac{x}{z} \cdot y\right) \cdot \frac{1}{z}}{z + 1.0}}\]
  11. Applied simplify 2.5

    \[\leadsto \frac{\color{blue}{\frac{\frac{x}{z}}{\frac{z}{y}}}}{z + 1.0}\]
  12. Removed slow pow expressions

Runtime

Time bar (total: 35.9s) Debug log

Please include this information when filing a bug report:

herbie --seed '#(1672165388 3389922832 1199748983 2037031888 14726405 70910112)'
(FPCore (x y z)
  :name "Statistics.Distribution.Beta:$cvariance from math-functions-0.1.5.2"

  :target
  (if (< z 249.6182814532307) (/ (* y (/ x z)) (+ z (sqr z))) (/ (* (/ (/ y z) (+ 1 z)) x) z))

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