Average Error: 4.8 → 3.9
Time: 4.4s
Precision: binary64
\[x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\]
\[\begin{array}{l} \mathbf{if}\;x \le -3.15719388282883367 \cdot 10^{134}:\\ \;\;\;\;\frac{x}{\frac{z}{y}} + \left(-x\right) \cdot \frac{t}{1 - z}\\ \mathbf{elif}\;x \le 1.410373802069244 \cdot 10^{-160}:\\ \;\;\;\;\frac{1}{\frac{z}{x \cdot y}} + \left(-x\right) \cdot \frac{t}{1 - z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\\ \end{array}\]

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

Original4.8
Target4.4
Herbie3.9
\[\begin{array}{l} \mathbf{if}\;x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right) \lt -7.62322630331204244 \cdot 10^{-196}:\\ \;\;\;\;x \cdot \left(\frac{y}{z} - t \cdot \frac{1}{1 - z}\right)\\ \mathbf{elif}\;x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right) \lt 1.41339449277023022 \cdot 10^{-211}:\\ \;\;\;\;\frac{y \cdot x}{z} + \left(-\frac{t \cdot x}{1 - z}\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\frac{y}{z} - t \cdot \frac{1}{1 - z}\right)\\ \end{array}\]

Derivation

  1. Split input into 3 regimes
  2. if x < -3.15719388282883367e134

    1. Initial program 5.4

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

      \[\leadsto \color{blue}{\left(\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \sqrt[3]{x}\right)} \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\]
    4. Applied associate-*l*6.4

      \[\leadsto \color{blue}{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \left(\sqrt[3]{x} \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\right)}\]
    5. Using strategy rm
    6. Applied sub-neg6.4

      \[\leadsto \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \left(\sqrt[3]{x} \cdot \color{blue}{\left(\frac{y}{z} + \left(-\frac{t}{1 - z}\right)\right)}\right)\]
    7. Applied distribute-lft-in6.4

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

      \[\leadsto \color{blue}{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \left(\sqrt[3]{x} \cdot \frac{y}{z}\right) + \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \left(\sqrt[3]{x} \cdot \left(-\frac{t}{1 - z}\right)\right)}\]
    9. Simplified14.4

      \[\leadsto \color{blue}{\frac{x \cdot y}{z}} + \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \left(\sqrt[3]{x} \cdot \left(-\frac{t}{1 - z}\right)\right)\]
    10. Simplified14.0

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

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

    if -3.15719388282883367e134 < x < 1.410373802069244e-160

    1. Initial program 5.5

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

      \[\leadsto \color{blue}{\left(\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \sqrt[3]{x}\right)} \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\]
    4. Applied associate-*l*6.4

      \[\leadsto \color{blue}{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \left(\sqrt[3]{x} \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\right)}\]
    5. Using strategy rm
    6. Applied sub-neg6.4

      \[\leadsto \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \left(\sqrt[3]{x} \cdot \color{blue}{\left(\frac{y}{z} + \left(-\frac{t}{1 - z}\right)\right)}\right)\]
    7. Applied distribute-lft-in6.4

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

      \[\leadsto \color{blue}{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \left(\sqrt[3]{x} \cdot \frac{y}{z}\right) + \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \left(\sqrt[3]{x} \cdot \left(-\frac{t}{1 - z}\right)\right)}\]
    9. Simplified4.1

      \[\leadsto \color{blue}{\frac{x \cdot y}{z}} + \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \left(\sqrt[3]{x} \cdot \left(-\frac{t}{1 - z}\right)\right)\]
    10. Simplified3.7

      \[\leadsto \frac{x \cdot y}{z} + \color{blue}{\left(-x\right) \cdot \frac{t}{1 - z}}\]
    11. Using strategy rm
    12. Applied clear-num3.9

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

    if 1.410373802069244e-160 < x

    1. Initial program 3.6

      \[x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\]
  3. Recombined 3 regimes into one program.
  4. Final simplification3.9

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -3.15719388282883367 \cdot 10^{134}:\\ \;\;\;\;\frac{x}{\frac{z}{y}} + \left(-x\right) \cdot \frac{t}{1 - z}\\ \mathbf{elif}\;x \le 1.410373802069244 \cdot 10^{-160}:\\ \;\;\;\;\frac{1}{\frac{z}{x \cdot y}} + \left(-x\right) \cdot \frac{t}{1 - z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2020162 
(FPCore (x y z t)
  :name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, C"
  :precision binary64

  :herbie-target
  (if (< (* x (- (/ y z) (/ t (- 1.0 z)))) -7.623226303312042e-196) (* x (- (/ y z) (* t (/ 1.0 (- 1.0 z))))) (if (< (* x (- (/ y z) (/ t (- 1.0 z)))) 1.4133944927702302e-211) (+ (/ (* y x) z) (neg (/ (* t x) (- 1.0 z)))) (* x (- (/ y z) (* t (/ 1.0 (- 1.0 z)))))))

  (* x (- (/ y z) (/ t (- 1.0 z)))))