Average Error: 13.9 → 4.0
Time: 47.4s
Precision: 64
Internal Precision: 384
\[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1.0\right)}\]
\[\begin{array}{l} \mathbf{if}\;z \le -2.623960079892894 \cdot 10^{+119}:\\ \;\;\;\;\left(\frac{\frac{y}{z}}{z} \cdot x\right) \cdot \frac{1}{1.0 + z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y \cdot \frac{x}{z}}{z \cdot \left(z + 1.0\right)}\\ \end{array}\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

Original13.9
Target4.0
Herbie4.0
\[\begin{array}{l} \mathbf{if}\;z \lt 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 2 regimes
  2. if z < -2.623960079892894e+119

    1. Initial program 10.9

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1.0\right)}\]
    2. Taylor expanded around 0 56.3

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

      \[\leadsto \color{blue}{\frac{\frac{y}{z}}{z} \cdot \frac{x}{1.0 + z}}\]
    4. Using strategy rm
    5. Applied div-inv1.2

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

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

    if -2.623960079892894e+119 < z

    1. Initial program 14.7

      \[\frac{x \cdot y}{\left(z \cdot z\right) \cdot \left(z + 1.0\right)}\]
    2. Taylor expanded around 0 14.7

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

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

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

      \[\leadsto \color{blue}{\frac{y}{z} \cdot \left(\frac{1}{z} \cdot \frac{x}{1.0 + z}\right)}\]
    7. Applied simplify3.8

      \[\leadsto \frac{y}{z} \cdot \color{blue}{\frac{\frac{x}{z}}{z + 1.0}}\]
    8. Using strategy rm
    9. Applied frac-times4.8

      \[\leadsto \color{blue}{\frac{y \cdot \frac{x}{z}}{z \cdot \left(z + 1.0\right)}}\]
  3. Recombined 2 regimes into one program.
  4. Removed slow pow expressions.

Runtime

Time bar (total: 47.4s)Debug log

herbie shell --seed '#(1567391828 2030694642 2833800258 828025724 3004380912 3532991858)' +o setup:early-exit
(FPCore (x y z)
  :name "Statistics.Distribution.Beta:$cvariance from math-functions-0.1.5.2"

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

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