Average Error: 45.1 → 9.6
Time: 28.4s
Precision: 64
$n \gt 0.0 \cdot n \land 0.0 \cdot n \lt 10^{3} \cdot x \land 10^{3} \cdot x \gt 0.0 \cdot x \land 0.0 \cdot x \lt 1$
$1 - {\left(1 - x\right)}^{n}$
$\begin{array}{l} \mathbf{if}\;n \le 5.477105991593080235544065094031957892845 \cdot 10^{89} \lor \neg \left(n \le 1.293818980868116938995181877832909195406 \cdot 10^{113}\right) \land n \le 6.564970957175116047502442630080887132923 \cdot 10^{166}:\\ \;\;\;\;n \cdot \left(1 \cdot x - \log 1\right) + \log \left({\left({1}^{\left(\log 1\right)}\right)}^{\left({n}^{2}\right)}\right) \cdot \frac{-1}{2}\\ \mathbf{else}:\\ \;\;\;\;1 - {\left(\frac{-1}{x}\right)}^{\left(-n\right)}\\ \end{array}$
1 - {\left(1 - x\right)}^{n}
\begin{array}{l}
\mathbf{if}\;n \le 5.477105991593080235544065094031957892845 \cdot 10^{89} \lor \neg \left(n \le 1.293818980868116938995181877832909195406 \cdot 10^{113}\right) \land n \le 6.564970957175116047502442630080887132923 \cdot 10^{166}:\\
\;\;\;\;n \cdot \left(1 \cdot x - \log 1\right) + \log \left({\left({1}^{\left(\log 1\right)}\right)}^{\left({n}^{2}\right)}\right) \cdot \frac{-1}{2}\\

\mathbf{else}:\\
\;\;\;\;1 - {\left(\frac{-1}{x}\right)}^{\left(-n\right)}\\

\end{array}
double f(double x, double n) {
double r619131 = 1.0;
double r619132 = x;
double r619133 = r619131 - r619132;
double r619134 = n;
double r619135 = pow(r619133, r619134);
double r619136 = r619131 - r619135;
return r619136;
}


double f(double x, double n) {
double r619137 = n;
double r619138 = 5.47710599159308e+89;
bool r619139 = r619137 <= r619138;
double r619140 = 1.293818980868117e+113;
bool r619141 = r619137 <= r619140;
double r619142 = !r619141;
double r619143 = 6.564970957175116e+166;
bool r619144 = r619137 <= r619143;
bool r619145 = r619142 && r619144;
bool r619146 = r619139 || r619145;
double r619147 = 1.0;
double r619148 = x;
double r619149 = r619147 * r619148;
double r619150 = log(r619147);
double r619151 = r619149 - r619150;
double r619152 = r619137 * r619151;
double r619153 = pow(r619147, r619150);
double r619154 = 2.0;
double r619155 = pow(r619137, r619154);
double r619156 = pow(r619153, r619155);
double r619157 = log(r619156);
double r619158 = -0.5;
double r619159 = r619157 * r619158;
double r619160 = r619152 + r619159;
double r619161 = -1.0;
double r619162 = r619161 / r619148;
double r619163 = -r619137;
double r619164 = pow(r619162, r619163);
double r619165 = r619147 - r619164;
double r619166 = r619146 ? r619160 : r619165;
return r619166;
}



Try it out

Results

 In Out
Enter valid numbers for all inputs

Derivation

1. Split input into 2 regimes
2. if n < 5.47710599159308e+89 or 1.293818980868117e+113 < n < 6.564970957175116e+166

1. Initial program 40.2

$1 - {\left(1 - x\right)}^{n}$
2. Taylor expanded around 0 7.3

$\leadsto \color{blue}{1 \cdot \left(x \cdot n\right) - \left(\frac{1}{2} \cdot \left({n}^{2} \cdot {\left(\log 1\right)}^{2}\right) + n \cdot \log 1\right)}$
3. Simplified7.3

$\leadsto \color{blue}{n \cdot \left(1 \cdot x - \log 1\right) + \left({n}^{2} \cdot {\left(\log 1\right)}^{2}\right) \cdot \frac{-1}{2}}$
4. Using strategy rm

$\leadsto n \cdot \left(1 \cdot x - \log 1\right) + \color{blue}{\log \left(e^{{n}^{2} \cdot {\left(\log 1\right)}^{2}}\right)} \cdot \frac{-1}{2}$
6. Simplified6.3

$\leadsto n \cdot \left(1 \cdot x - \log 1\right) + \log \color{blue}{\left({\left({1}^{\left(\log 1\right)}\right)}^{\left({n}^{2}\right)}\right)} \cdot \frac{-1}{2}$

if 5.47710599159308e+89 < n < 1.293818980868117e+113 or 6.564970957175116e+166 < n

1. Initial program 58.4

$1 - {\left(1 - x\right)}^{n}$
2. Taylor expanded around -inf 64.0

$\leadsto 1 - \color{blue}{e^{-1 \cdot \left(\log \left(\frac{-1}{x}\right) \cdot n\right)}}$
3. Simplified18.8

$\leadsto 1 - \color{blue}{{\left(\frac{-1}{x}\right)}^{\left(-n\right)}}$
3. Recombined 2 regimes into one program.
4. Final simplification9.6

$\leadsto \begin{array}{l} \mathbf{if}\;n \le 5.477105991593080235544065094031957892845 \cdot 10^{89} \lor \neg \left(n \le 1.293818980868116938995181877832909195406 \cdot 10^{113}\right) \land n \le 6.564970957175116047502442630080887132923 \cdot 10^{166}:\\ \;\;\;\;n \cdot \left(1 \cdot x - \log 1\right) + \log \left({\left({1}^{\left(\log 1\right)}\right)}^{\left({n}^{2}\right)}\right) \cdot \frac{-1}{2}\\ \mathbf{else}:\\ \;\;\;\;1 - {\left(\frac{-1}{x}\right)}^{\left(-n\right)}\\ \end{array}$

Reproduce

herbie shell --seed 1
(FPCore (x n)
:name "1 - pow(1 - x, n)"
:precision binary64
:pre (and (> n (* 0.0 n)) (< (* 0.0 n) (* 1e3 x)) (> (* 1e3 x) (* 0.0 x)) (< (* 0.0 x) 1))
(- 1 (pow (- 1 x) n)))