Average Error: 4.2 → 5.6
Time: 4.1s
Precision: 64
$x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)$
$\begin{array}{l} \mathbf{if}\;\frac{y}{z} - \frac{t}{1 - z} \le 2.6026198328523048 \cdot 10^{-57}:\\ \;\;\;\;x \cdot \frac{y}{z} + \left(x \cdot t\right) \cdot \left(-\frac{1}{\sqrt[3]{1 - z} \cdot \sqrt[3]{1 - z}} \cdot \frac{1}{\sqrt[3]{1 - z}}\right)\\ \mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le 8.72159814685539718 \cdot 10^{47}:\\ \;\;\;\;\frac{x \cdot \left(\frac{y}{z} \cdot \frac{y}{z} - \frac{t}{1 - z} \cdot \frac{t}{1 - z}\right)}{\frac{y}{z} + \frac{t}{1 - z}}\\ \mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le 4.4577045978562027 \cdot 10^{100}:\\ \;\;\;\;x \cdot \frac{y}{z} + \left(x \cdot t\right) \cdot \left(-\frac{1}{\sqrt[3]{1 - z} \cdot \sqrt[3]{1 - z}} \cdot \frac{1}{\sqrt[3]{1 - z}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot x\right) \cdot \frac{\sqrt[3]{y}}{z} + x \cdot \left(-\frac{t}{1 - z}\right)\\ \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} \le 2.6026198328523048 \cdot 10^{-57}:\\
\;\;\;\;x \cdot \frac{y}{z} + \left(x \cdot t\right) \cdot \left(-\frac{1}{\sqrt[3]{1 - z} \cdot \sqrt[3]{1 - z}} \cdot \frac{1}{\sqrt[3]{1 - z}}\right)\\

\mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le 8.72159814685539718 \cdot 10^{47}:\\
\;\;\;\;\frac{x \cdot \left(\frac{y}{z} \cdot \frac{y}{z} - \frac{t}{1 - z} \cdot \frac{t}{1 - z}\right)}{\frac{y}{z} + \frac{t}{1 - z}}\\

\mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le 4.4577045978562027 \cdot 10^{100}:\\
\;\;\;\;x \cdot \frac{y}{z} + \left(x \cdot t\right) \cdot \left(-\frac{1}{\sqrt[3]{1 - z} \cdot \sqrt[3]{1 - z}} \cdot \frac{1}{\sqrt[3]{1 - z}}\right)\\

\mathbf{else}:\\
\;\;\;\;\left(\left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot x\right) \cdot \frac{\sqrt[3]{y}}{z} + x \cdot \left(-\frac{t}{1 - z}\right)\\

\end{array}
double code(double x, double y, double z, double t) {
return (x * ((y / z) - (t / (1.0 - z))));
}

double code(double x, double y, double z, double t) {
double temp;
if ((((y / z) - (t / (1.0 - z))) <= 2.602619832852305e-57)) {
temp = ((x * (y / z)) + ((x * t) * -((1.0 / (cbrt((1.0 - z)) * cbrt((1.0 - z)))) * (1.0 / cbrt((1.0 - z))))));
} else {
double temp_1;
if ((((y / z) - (t / (1.0 - z))) <= 8.721598146855397e+47)) {
temp_1 = ((x * (((y / z) * (y / z)) - ((t / (1.0 - z)) * (t / (1.0 - z))))) / ((y / z) + (t / (1.0 - z))));
} else {
double temp_2;
if ((((y / z) - (t / (1.0 - z))) <= 4.457704597856203e+100)) {
temp_2 = ((x * (y / z)) + ((x * t) * -((1.0 / (cbrt((1.0 - z)) * cbrt((1.0 - z)))) * (1.0 / cbrt((1.0 - z))))));
} else {
temp_2 = ((((cbrt(y) * cbrt(y)) * x) * (cbrt(y) / z)) + (x * -(t / (1.0 - z))));
}
temp_1 = temp_2;
}
temp = temp_1;
}
return temp;
}


# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Target

 Original 4.2 4.1 5.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 3 regimes
2. ## if (- (/ y z) (/ t (- 1.0 z))) < 2.602619832852305e-57 or 8.721598146855397e+47 < (- (/ y z) (/ t (- 1.0 z))) < 4.457704597856203e+100

1. Initial program 3.6

$x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)$
2. Using strategy rm
3. Applied sub-neg3.6

$\leadsto x \cdot \color{blue}{\left(\frac{y}{z} + \left(-\frac{t}{1 - z}\right)\right)}$
4. Applied distribute-lft-in3.6

$\leadsto \color{blue}{x \cdot \frac{y}{z} + x \cdot \left(-\frac{t}{1 - z}\right)}$
5. Using strategy rm
6. Applied div-inv3.6

$\leadsto x \cdot \frac{y}{z} + x \cdot \left(-\color{blue}{t \cdot \frac{1}{1 - z}}\right)$
7. Applied distribute-rgt-neg-in3.6

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

$\leadsto x \cdot \frac{y}{z} + \color{blue}{\left(x \cdot t\right) \cdot \left(-\frac{1}{1 - z}\right)}$
9. Using strategy rm

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

$\leadsto x \cdot \frac{y}{z} + \left(x \cdot t\right) \cdot \left(-\frac{\color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \sqrt[3]{1}}}{\left(\sqrt[3]{1 - z} \cdot \sqrt[3]{1 - z}\right) \cdot \sqrt[3]{1 - z}}\right)$
12. Applied times-frac6.6

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

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

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

## if 2.602619832852305e-57 < (- (/ y z) (/ t (- 1.0 z))) < 8.721598146855397e+47

1. Initial program 0.3

$x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)$
2. Using strategy rm
3. Applied flip--0.3

$\leadsto x \cdot \color{blue}{\frac{\frac{y}{z} \cdot \frac{y}{z} - \frac{t}{1 - z} \cdot \frac{t}{1 - z}}{\frac{y}{z} + \frac{t}{1 - z}}}$
4. Applied associate-*r/3.0

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

## if 4.457704597856203e+100 < (- (/ y z) (/ t (- 1.0 z)))

1. Initial program 9.1

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

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

$\leadsto \color{blue}{x \cdot \frac{y}{z} + x \cdot \left(-\frac{t}{1 - z}\right)}$
5. Using strategy rm
6. Applied *-un-lft-identity9.1

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

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

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

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

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

$\leadsto \begin{array}{l} \mathbf{if}\;\frac{y}{z} - \frac{t}{1 - z} \le 2.6026198328523048 \cdot 10^{-57}:\\ \;\;\;\;x \cdot \frac{y}{z} + \left(x \cdot t\right) \cdot \left(-\frac{1}{\sqrt[3]{1 - z} \cdot \sqrt[3]{1 - z}} \cdot \frac{1}{\sqrt[3]{1 - z}}\right)\\ \mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le 8.72159814685539718 \cdot 10^{47}:\\ \;\;\;\;\frac{x \cdot \left(\frac{y}{z} \cdot \frac{y}{z} - \frac{t}{1 - z} \cdot \frac{t}{1 - z}\right)}{\frac{y}{z} + \frac{t}{1 - z}}\\ \mathbf{elif}\;\frac{y}{z} - \frac{t}{1 - z} \le 4.4577045978562027 \cdot 10^{100}:\\ \;\;\;\;x \cdot \frac{y}{z} + \left(x \cdot t\right) \cdot \left(-\frac{1}{\sqrt[3]{1 - z} \cdot \sqrt[3]{1 - z}} \cdot \frac{1}{\sqrt[3]{1 - z}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot x\right) \cdot \frac{\sqrt[3]{y}}{z} + x \cdot \left(-\frac{t}{1 - z}\right)\\ \end{array}$

# Reproduce

herbie shell --seed 2020049
(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 z)))) -7.623226303312042e-196) (* x (- (/ y z) (* t (/ 1 (- 1 z))))) (if (< (* x (- (/ y z) (/ t (- 1 z)))) 1.4133944927702302e-211) (+ (/ (* y x) z) (- (/ (* t x) (- 1 z)))) (* x (- (/ y z) (* t (/ 1 (- 1 z)))))))

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