Average Error: 4.2 → 0.2
Time: 23.8s
Precision: 64
• ## could not determine a ground truth for program body (more)

1. x = 1.3100436170095025e+65
$x \ne 0.0$
$\sqrt{\frac{e^{2 \cdot x} - 1}{e^{x} - 1}}$
$\begin{array}{l} \mathbf{if}\;x \le -2.495939381172648062067083440940251648499 \cdot 10^{-5}:\\ \;\;\;\;\sqrt{\frac{\frac{e^{x \cdot 2} \cdot \sqrt{e^{x \cdot 2}} + 1 \cdot \sqrt{1}}{\left(1 + e^{x \cdot 2}\right) - \sqrt{1} \cdot \sqrt{e^{x \cdot 2}}}}{\frac{e^{x} - 1}{\sqrt{e^{x \cdot 2}} - \sqrt{1}}}}\\ \mathbf{elif}\;x \le 4.268371931984620044007255158314065313085 \cdot 10^{-10}:\\ \;\;\;\;\sqrt{x \cdot \left(1 + 0.5 \cdot x\right) + 2}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{\sqrt{1} + \sqrt{e^{x \cdot 2}}}{\frac{\sqrt{e^{x}} - \sqrt{1}}{\sqrt{\sqrt{e^{x \cdot 2}}} - \sqrt{\sqrt{1}}}}} \cdot \sqrt{\frac{1}{\frac{\sqrt{e^{x}} + \sqrt{1}}{\sqrt{\sqrt{e^{x \cdot 2}}} + \sqrt{\sqrt{1}}}}}\\ \end{array}$
\sqrt{\frac{e^{2 \cdot x} - 1}{e^{x} - 1}}
\begin{array}{l}
\mathbf{if}\;x \le -2.495939381172648062067083440940251648499 \cdot 10^{-5}:\\
\;\;\;\;\sqrt{\frac{\frac{e^{x \cdot 2} \cdot \sqrt{e^{x \cdot 2}} + 1 \cdot \sqrt{1}}{\left(1 + e^{x \cdot 2}\right) - \sqrt{1} \cdot \sqrt{e^{x \cdot 2}}}}{\frac{e^{x} - 1}{\sqrt{e^{x \cdot 2}} - \sqrt{1}}}}\\

\mathbf{elif}\;x \le 4.268371931984620044007255158314065313085 \cdot 10^{-10}:\\
\;\;\;\;\sqrt{x \cdot \left(1 + 0.5 \cdot x\right) + 2}\\

\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{\sqrt{1} + \sqrt{e^{x \cdot 2}}}{\frac{\sqrt{e^{x}} - \sqrt{1}}{\sqrt{\sqrt{e^{x \cdot 2}}} - \sqrt{\sqrt{1}}}}} \cdot \sqrt{\frac{1}{\frac{\sqrt{e^{x}} + \sqrt{1}}{\sqrt{\sqrt{e^{x \cdot 2}}} + \sqrt{\sqrt{1}}}}}\\

\end{array}
double f(double x) {
double r30962231 = 2.0;
double r30962232 = x;
double r30962233 = r30962231 * r30962232;
double r30962234 = exp(r30962233);
double r30962235 = 1.0;
double r30962236 = r30962234 - r30962235;
double r30962237 = exp(r30962232);
double r30962238 = r30962237 - r30962235;
double r30962239 = r30962236 / r30962238;
double r30962240 = sqrt(r30962239);
return r30962240;
}


double f(double x) {
double r30962241 = x;
double r30962242 = -2.495939381172648e-05;
bool r30962243 = r30962241 <= r30962242;
double r30962244 = 2.0;
double r30962245 = r30962241 * r30962244;
double r30962246 = exp(r30962245);
double r30962247 = sqrt(r30962246);
double r30962248 = r30962246 * r30962247;
double r30962249 = 1.0;
double r30962250 = sqrt(r30962249);
double r30962251 = r30962249 * r30962250;
double r30962252 = r30962248 + r30962251;
double r30962253 = r30962249 + r30962246;
double r30962254 = r30962250 * r30962247;
double r30962255 = r30962253 - r30962254;
double r30962256 = r30962252 / r30962255;
double r30962257 = exp(r30962241);
double r30962258 = r30962257 - r30962249;
double r30962259 = r30962247 - r30962250;
double r30962260 = r30962258 / r30962259;
double r30962261 = r30962256 / r30962260;
double r30962262 = sqrt(r30962261);
double r30962263 = 4.26837193198462e-10;
bool r30962264 = r30962241 <= r30962263;
double r30962265 = 0.5;
double r30962266 = r30962265 * r30962241;
double r30962267 = r30962249 + r30962266;
double r30962268 = r30962241 * r30962267;
double r30962269 = r30962268 + r30962244;
double r30962270 = sqrt(r30962269);
double r30962271 = r30962250 + r30962247;
double r30962272 = sqrt(r30962257);
double r30962273 = r30962272 - r30962250;
double r30962274 = sqrt(r30962247);
double r30962275 = sqrt(r30962250);
double r30962276 = r30962274 - r30962275;
double r30962277 = r30962273 / r30962276;
double r30962278 = r30962271 / r30962277;
double r30962279 = sqrt(r30962278);
double r30962280 = 1.0;
double r30962281 = r30962272 + r30962250;
double r30962282 = r30962274 + r30962275;
double r30962283 = r30962281 / r30962282;
double r30962284 = r30962280 / r30962283;
double r30962285 = sqrt(r30962284);
double r30962286 = r30962279 * r30962285;
double r30962287 = r30962264 ? r30962270 : r30962286;
double r30962288 = r30962243 ? r30962262 : r30962287;
return r30962288;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Split input into 3 regimes
2. ## if x < -2.495939381172648e-05

1. Initial program 0.1

$\sqrt{\frac{e^{2 \cdot x} - 1}{e^{x} - 1}}$
2. Using strategy rm

$\leadsto \sqrt{\frac{e^{2 \cdot x} - \color{blue}{\sqrt{1} \cdot \sqrt{1}}}{e^{x} - 1}}$

$\leadsto \sqrt{\frac{\color{blue}{\sqrt{e^{2 \cdot x}} \cdot \sqrt{e^{2 \cdot x}}} - \sqrt{1} \cdot \sqrt{1}}{e^{x} - 1}}$
5. Applied difference-of-squares0.0

$\leadsto \sqrt{\frac{\color{blue}{\left(\sqrt{e^{2 \cdot x}} + \sqrt{1}\right) \cdot \left(\sqrt{e^{2 \cdot x}} - \sqrt{1}\right)}}{e^{x} - 1}}$
6. Applied associate-/l*0.0

$\leadsto \sqrt{\color{blue}{\frac{\sqrt{e^{2 \cdot x}} + \sqrt{1}}{\frac{e^{x} - 1}{\sqrt{e^{2 \cdot x}} - \sqrt{1}}}}}$
7. Using strategy rm
8. Applied flip3-+0.0

$\leadsto \sqrt{\frac{\color{blue}{\frac{{\left(\sqrt{e^{2 \cdot x}}\right)}^{3} + {\left(\sqrt{1}\right)}^{3}}{\sqrt{e^{2 \cdot x}} \cdot \sqrt{e^{2 \cdot x}} + \left(\sqrt{1} \cdot \sqrt{1} - \sqrt{e^{2 \cdot x}} \cdot \sqrt{1}\right)}}}{\frac{e^{x} - 1}{\sqrt{e^{2 \cdot x}} - \sqrt{1}}}}$
9. Simplified0.0

$\leadsto \sqrt{\frac{\frac{\color{blue}{1 \cdot \sqrt{1} + e^{x \cdot 2} \cdot \sqrt{e^{x \cdot 2}}}}{\sqrt{e^{2 \cdot x}} \cdot \sqrt{e^{2 \cdot x}} + \left(\sqrt{1} \cdot \sqrt{1} - \sqrt{e^{2 \cdot x}} \cdot \sqrt{1}\right)}}{\frac{e^{x} - 1}{\sqrt{e^{2 \cdot x}} - \sqrt{1}}}}$
10. Simplified0.0

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

## if -2.495939381172648e-05 < x < 4.26837193198462e-10

1. Initial program 41.8

$\sqrt{\frac{e^{2 \cdot x} - 1}{e^{x} - 1}}$
2. Taylor expanded around 0 0.1

$\leadsto \sqrt{\color{blue}{0.5 \cdot {x}^{2} + \left(1 \cdot x + 2\right)}}$
3. Simplified0.1

$\leadsto \sqrt{\color{blue}{2 + x \cdot \left(x \cdot 0.5 + 1\right)}}$

## if 4.26837193198462e-10 < x

1. Initial program 13.2

$\sqrt{\frac{e^{2 \cdot x} - 1}{e^{x} - 1}}$
2. Using strategy rm

$\leadsto \sqrt{\frac{e^{2 \cdot x} - \color{blue}{\sqrt{1} \cdot \sqrt{1}}}{e^{x} - 1}}$

$\leadsto \sqrt{\frac{\color{blue}{\sqrt{e^{2 \cdot x}} \cdot \sqrt{e^{2 \cdot x}}} - \sqrt{1} \cdot \sqrt{1}}{e^{x} - 1}}$
5. Applied difference-of-squares5.5

$\leadsto \sqrt{\frac{\color{blue}{\left(\sqrt{e^{2 \cdot x}} + \sqrt{1}\right) \cdot \left(\sqrt{e^{2 \cdot x}} - \sqrt{1}\right)}}{e^{x} - 1}}$
6. Applied associate-/l*5.5

$\leadsto \sqrt{\color{blue}{\frac{\sqrt{e^{2 \cdot x}} + \sqrt{1}}{\frac{e^{x} - 1}{\sqrt{e^{2 \cdot x}} - \sqrt{1}}}}}$
7. Using strategy rm

$\leadsto \sqrt{\frac{\sqrt{e^{2 \cdot x}} + \sqrt{1}}{\frac{e^{x} - 1}{\sqrt{e^{2 \cdot x}} - \sqrt{\color{blue}{\sqrt{1} \cdot \sqrt{1}}}}}}$
9. Applied sqrt-prod5.5

$\leadsto \sqrt{\frac{\sqrt{e^{2 \cdot x}} + \sqrt{1}}{\frac{e^{x} - 1}{\sqrt{e^{2 \cdot x}} - \color{blue}{\sqrt{\sqrt{1}} \cdot \sqrt{\sqrt{1}}}}}}$

$\leadsto \sqrt{\frac{\sqrt{e^{2 \cdot x}} + \sqrt{1}}{\frac{e^{x} - 1}{\sqrt{\color{blue}{\sqrt{e^{2 \cdot x}} \cdot \sqrt{e^{2 \cdot x}}}} - \sqrt{\sqrt{1}} \cdot \sqrt{\sqrt{1}}}}}$
11. Applied sqrt-prod10.3

$\leadsto \sqrt{\frac{\sqrt{e^{2 \cdot x}} + \sqrt{1}}{\frac{e^{x} - 1}{\color{blue}{\sqrt{\sqrt{e^{2 \cdot x}}} \cdot \sqrt{\sqrt{e^{2 \cdot x}}}} - \sqrt{\sqrt{1}} \cdot \sqrt{\sqrt{1}}}}}$
12. Applied difference-of-squares13.9

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

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

$\leadsto \sqrt{\frac{\sqrt{e^{2 \cdot x}} + \sqrt{1}}{\frac{\color{blue}{\sqrt{e^{x}} \cdot \sqrt{e^{x}}} - \sqrt{1} \cdot \sqrt{1}}{\left(\sqrt{\sqrt{e^{2 \cdot x}}} + \sqrt{\sqrt{1}}\right) \cdot \left(\sqrt{\sqrt{e^{2 \cdot x}}} - \sqrt{\sqrt{1}}\right)}}}$
15. Applied difference-of-squares5.0

$\leadsto \sqrt{\frac{\sqrt{e^{2 \cdot x}} + \sqrt{1}}{\frac{\color{blue}{\left(\sqrt{e^{x}} + \sqrt{1}\right) \cdot \left(\sqrt{e^{x}} - \sqrt{1}\right)}}{\left(\sqrt{\sqrt{e^{2 \cdot x}}} + \sqrt{\sqrt{1}}\right) \cdot \left(\sqrt{\sqrt{e^{2 \cdot x}}} - \sqrt{\sqrt{1}}\right)}}}$
16. Applied times-frac5.1

$\leadsto \sqrt{\frac{\sqrt{e^{2 \cdot x}} + \sqrt{1}}{\color{blue}{\frac{\sqrt{e^{x}} + \sqrt{1}}{\sqrt{\sqrt{e^{2 \cdot x}}} + \sqrt{\sqrt{1}}} \cdot \frac{\sqrt{e^{x}} - \sqrt{1}}{\sqrt{\sqrt{e^{2 \cdot x}}} - \sqrt{\sqrt{1}}}}}}$
17. Applied *-un-lft-identity5.1

$\leadsto \sqrt{\frac{\color{blue}{1 \cdot \left(\sqrt{e^{2 \cdot x}} + \sqrt{1}\right)}}{\frac{\sqrt{e^{x}} + \sqrt{1}}{\sqrt{\sqrt{e^{2 \cdot x}}} + \sqrt{\sqrt{1}}} \cdot \frac{\sqrt{e^{x}} - \sqrt{1}}{\sqrt{\sqrt{e^{2 \cdot x}}} - \sqrt{\sqrt{1}}}}}$
18. Applied times-frac5.1

$\leadsto \sqrt{\color{blue}{\frac{1}{\frac{\sqrt{e^{x}} + \sqrt{1}}{\sqrt{\sqrt{e^{2 \cdot x}}} + \sqrt{\sqrt{1}}}} \cdot \frac{\sqrt{e^{2 \cdot x}} + \sqrt{1}}{\frac{\sqrt{e^{x}} - \sqrt{1}}{\sqrt{\sqrt{e^{2 \cdot x}}} - \sqrt{\sqrt{1}}}}}}$
19. Applied sqrt-prod5.0

$\leadsto \color{blue}{\sqrt{\frac{1}{\frac{\sqrt{e^{x}} + \sqrt{1}}{\sqrt{\sqrt{e^{2 \cdot x}}} + \sqrt{\sqrt{1}}}}} \cdot \sqrt{\frac{\sqrt{e^{2 \cdot x}} + \sqrt{1}}{\frac{\sqrt{e^{x}} - \sqrt{1}}{\sqrt{\sqrt{e^{2 \cdot x}}} - \sqrt{\sqrt{1}}}}}}$
3. Recombined 3 regimes into one program.
4. Final simplification0.2

$\leadsto \begin{array}{l} \mathbf{if}\;x \le -2.495939381172648062067083440940251648499 \cdot 10^{-5}:\\ \;\;\;\;\sqrt{\frac{\frac{e^{x \cdot 2} \cdot \sqrt{e^{x \cdot 2}} + 1 \cdot \sqrt{1}}{\left(1 + e^{x \cdot 2}\right) - \sqrt{1} \cdot \sqrt{e^{x \cdot 2}}}}{\frac{e^{x} - 1}{\sqrt{e^{x \cdot 2}} - \sqrt{1}}}}\\ \mathbf{elif}\;x \le 4.268371931984620044007255158314065313085 \cdot 10^{-10}:\\ \;\;\;\;\sqrt{x \cdot \left(1 + 0.5 \cdot x\right) + 2}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{\sqrt{1} + \sqrt{e^{x \cdot 2}}}{\frac{\sqrt{e^{x}} - \sqrt{1}}{\sqrt{\sqrt{e^{x \cdot 2}}} - \sqrt{\sqrt{1}}}}} \cdot \sqrt{\frac{1}{\frac{\sqrt{e^{x}} + \sqrt{1}}{\sqrt{\sqrt{e^{x \cdot 2}}} + \sqrt{\sqrt{1}}}}}\\ \end{array}$

# Reproduce

herbie shell --seed 1
(FPCore (x)
:name "NMSE problem 3.4.4"
:pre (!= x 0.0)
(sqrt (/ (- (exp (* 2.0 x)) 1.0) (- (exp x) 1.0))))