Average Error: 0.0 → 0.0
Time: 8.4s
Precision: 64
${a}^{2} - {b}^{2}$
$\left({a}^{\left(\frac{2}{2}\right)} + \sqrt{{b}^{2}}\right) \cdot \left({a}^{\left(\frac{2}{2}\right)} - \sqrt{{b}^{2}}\right)$
{a}^{2} - {b}^{2}
\left({a}^{\left(\frac{2}{2}\right)} + \sqrt{{b}^{2}}\right) \cdot \left({a}^{\left(\frac{2}{2}\right)} - \sqrt{{b}^{2}}\right)
double f(double a, double b) {
double r3576848 = a;
double r3576849 = 2.0;
double r3576850 = pow(r3576848, r3576849);
double r3576851 = b;
double r3576852 = pow(r3576851, r3576849);
double r3576853 = r3576850 - r3576852;
return r3576853;
}


double f(double a, double b) {
double r3576854 = a;
double r3576855 = 2.0;
double r3576856 = 2.0;
double r3576857 = r3576855 / r3576856;
double r3576858 = pow(r3576854, r3576857);
double r3576859 = b;
double r3576860 = pow(r3576859, r3576855);
double r3576861 = sqrt(r3576860);
double r3576862 = r3576858 + r3576861;
double r3576863 = r3576858 - r3576861;
double r3576864 = r3576862 * r3576863;
return r3576864;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Initial program 0.0

${a}^{2} - {b}^{2}$
2. Using strategy rm

$\leadsto {a}^{2} - \color{blue}{\sqrt{{b}^{2}} \cdot \sqrt{{b}^{2}}}$
4. Applied sqr-pow0.0

$\leadsto \color{blue}{{a}^{\left(\frac{2}{2}\right)} \cdot {a}^{\left(\frac{2}{2}\right)}} - \sqrt{{b}^{2}} \cdot \sqrt{{b}^{2}}$
5. Applied difference-of-squares0.0

$\leadsto \color{blue}{\left({a}^{\left(\frac{2}{2}\right)} + \sqrt{{b}^{2}}\right) \cdot \left({a}^{\left(\frac{2}{2}\right)} - \sqrt{{b}^{2}}\right)}$
6. Final simplification0.0

$\leadsto \left({a}^{\left(\frac{2}{2}\right)} + \sqrt{{b}^{2}}\right) \cdot \left({a}^{\left(\frac{2}{2}\right)} - \sqrt{{b}^{2}}\right)$

# Reproduce

herbie shell --seed 1
(FPCore (a b)
:name "a^2-b^2"
:precision binary64
(- (pow a 2) (pow b 2)))