Average Error: 4.6 → 1.6
Time: 6.2s
Precision: binary64
\[x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\]
\[\begin{array}{l} \mathbf{if}\;\frac{y}{z} - \frac{t}{1 - z} = -inf.0 \lor \neg \left(\frac{y}{z} - \frac{t}{1 - z} \le 5.91880007899829161 \cdot 10^{179}\right):\\ \;\;\;\;\left(y \cdot x\right) \cdot \frac{1}{z} - \frac{t}{1 - z} \cdot x\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{z}{y}} - \frac{t}{1 - z} \cdot x\\ \end{array}\]
x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)
\begin{array}{l}
\mathbf{if}\;\frac{y}{z} - \frac{t}{1 - z} = -inf.0 \lor \neg \left(\frac{y}{z} - \frac{t}{1 - z} \le 5.91880007899829161 \cdot 10^{179}\right):\\
\;\;\;\;\left(y \cdot x\right) \cdot \frac{1}{z} - \frac{t}{1 - z} \cdot x\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{y}} - \frac{t}{1 - z} \cdot x\\

\end{array}
double code(double x, double y, double z, double t) {
	return ((double) (x * ((double) (((double) (y / z)) - ((double) (t / ((double) (1.0 - z))))))));
}
double code(double x, double y, double z, double t) {
	double VAR;
	if (((((double) (((double) (y / z)) - ((double) (t / ((double) (1.0 - z)))))) <= -inf.0) || !(((double) (((double) (y / z)) - ((double) (t / ((double) (1.0 - z)))))) <= 5.918800078998292e+179))) {
		VAR = ((double) (((double) (((double) (y * x)) * ((double) (1.0 / z)))) - ((double) (((double) (t / ((double) (1.0 - z)))) * x))));
	} else {
		VAR = ((double) (((double) (x / ((double) (z / y)))) - ((double) (((double) (t / ((double) (1.0 - z)))) * x))));
	}
	return VAR;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original4.6
Target4.3
Herbie1.6
\[\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 2 regimes
  2. if (- (/ y z) (/ t (- 1.0 z))) < -inf.0 or 5.91880007899829161e179 < (- (/ y z) (/ t (- 1.0 z)))

    1. Initial program 25.2

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

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

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

      \[\leadsto x \cdot \frac{y}{z} + \color{blue}{x \cdot \frac{-t}{1 - z}}\]
    6. Using strategy rm
    7. Applied div-inv25.2

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

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

    if -inf.0 < (- (/ y z) (/ t (- 1.0 z))) < 5.91880007899829161e179

    1. Initial program 1.5

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

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

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

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

      \[\leadsto x \cdot \frac{y}{\color{blue}{1 \cdot z}} + x \cdot \frac{-t}{1 - z}\]
    8. Applied add-cube-cbrt2.0

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

      \[\leadsto x \cdot \color{blue}{\left(\frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{1} \cdot \frac{\sqrt[3]{y}}{z}\right)} + x \cdot \frac{-t}{1 - z}\]
    10. Applied associate-*r*4.7

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

      \[\leadsto \color{blue}{\left(x \cdot \left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right)\right)} \cdot \frac{\sqrt[3]{y}}{z} + x \cdot \frac{-t}{1 - z}\]
    12. Using strategy rm
    13. Applied add-cube-cbrt4.8

      \[\leadsto \left(x \cdot \left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right)\right) \cdot \frac{\sqrt[3]{y}}{\color{blue}{\left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right) \cdot \sqrt[3]{z}}} + x \cdot \frac{-t}{1 - z}\]
    14. Applied add-cube-cbrt4.8

      \[\leadsto \left(x \cdot \left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right)\right) \cdot \frac{\sqrt[3]{\color{blue}{\left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot \sqrt[3]{y}}}}{\left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right) \cdot \sqrt[3]{z}} + x \cdot \frac{-t}{1 - z}\]
    15. Applied cbrt-prod4.8

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

      \[\leadsto \left(x \cdot \left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right)\right) \cdot \color{blue}{\left(\frac{\sqrt[3]{\sqrt[3]{y} \cdot \sqrt[3]{y}}}{\sqrt[3]{z} \cdot \sqrt[3]{z}} \cdot \frac{\sqrt[3]{\sqrt[3]{y}}}{\sqrt[3]{z}}\right)} + x \cdot \frac{-t}{1 - z}\]
    17. Applied associate-*r*4.7

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

      \[\leadsto \color{blue}{\left(x \cdot \left({\left(\sqrt[3]{y}\right)}^{2} \cdot \frac{\sqrt[3]{{\left(\sqrt[3]{y}\right)}^{2}}}{\sqrt[3]{z} \cdot \sqrt[3]{z}}\right)\right)} \cdot \frac{\sqrt[3]{\sqrt[3]{y}}}{\sqrt[3]{z}} + x \cdot \frac{-t}{1 - z}\]
    19. Taylor expanded around 0 6.4

      \[\leadsto \color{blue}{\frac{x \cdot y}{z}} + x \cdot \frac{-t}{1 - z}\]
    20. Simplified1.6

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{y}}} + x \cdot \frac{-t}{1 - z}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification1.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y}{z} - \frac{t}{1 - z} = -inf.0 \lor \neg \left(\frac{y}{z} - \frac{t}{1 - z} \le 5.91880007899829161 \cdot 10^{179}\right):\\ \;\;\;\;\left(y \cdot x\right) \cdot \frac{1}{z} - \frac{t}{1 - z} \cdot x\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{z}{y}} - \frac{t}{1 - z} \cdot x\\ \end{array}\]

Reproduce

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