Average Error: 45.2 → 26.2
Time: 35.2s
Precision: 64
$\frac{\left(\left(\left(27 \cdot \left({a}^{2} \cdot {d}^{2}\right) + 4 \cdot \left({b}^{3} \cdot d\right)\right) - 18 \cdot abcd\right) + 4 \cdot {ac}^{3}\right) - {b}^{2} \cdot {c}^{2}}{108} \cdot {a}^{4}$
$\begin{array}{l} \mathbf{if}\;a \le -7.973314533750296483312966544799002168631 \cdot 10^{-79} \lor \neg \left(a \le 1.300428542477650047332728922740117441134 \cdot 10^{-72}\right):\\ \;\;\;\;\frac{\left(\left(\left(27 \cdot \left({a}^{2} \cdot {d}^{2}\right) + 4 \cdot \left({b}^{3} \cdot d\right)\right) - 18 \cdot abcd\right) + 4 \cdot {ac}^{3}\right) - \left({b}^{\left(\frac{2}{2}\right)} \cdot {c}^{\left(\frac{2}{2}\right)}\right) \cdot \left({b}^{\left(\frac{2}{2}\right)} \cdot {c}^{\left(\frac{2}{2}\right)}\right)}{108} \cdot {a}^{4}\\ \mathbf{else}:\\ \;\;\;\;-0.1666666666666666574148081281236954964697 \cdot \left({a}^{2} \cdot \left({a}^{2} \cdot abcd\right)\right)\\ \end{array}$
\frac{\left(\left(\left(27 \cdot \left({a}^{2} \cdot {d}^{2}\right) + 4 \cdot \left({b}^{3} \cdot d\right)\right) - 18 \cdot abcd\right) + 4 \cdot {ac}^{3}\right) - {b}^{2} \cdot {c}^{2}}{108} \cdot {a}^{4}
\begin{array}{l}
\mathbf{if}\;a \le -7.973314533750296483312966544799002168631 \cdot 10^{-79} \lor \neg \left(a \le 1.300428542477650047332728922740117441134 \cdot 10^{-72}\right):\\
\;\;\;\;\frac{\left(\left(\left(27 \cdot \left({a}^{2} \cdot {d}^{2}\right) + 4 \cdot \left({b}^{3} \cdot d\right)\right) - 18 \cdot abcd\right) + 4 \cdot {ac}^{3}\right) - \left({b}^{\left(\frac{2}{2}\right)} \cdot {c}^{\left(\frac{2}{2}\right)}\right) \cdot \left({b}^{\left(\frac{2}{2}\right)} \cdot {c}^{\left(\frac{2}{2}\right)}\right)}{108} \cdot {a}^{4}\\

\mathbf{else}:\\
\;\;\;\;-0.1666666666666666574148081281236954964697 \cdot \left({a}^{2} \cdot \left({a}^{2} \cdot abcd\right)\right)\\

\end{array}
double f(double a, double d, double b, double abcd, double ac, double c) {
double r3008328 = 27.0;
double r3008329 = a;
double r3008330 = 2.0;
double r3008331 = pow(r3008329, r3008330);
double r3008332 = d;
double r3008333 = pow(r3008332, r3008330);
double r3008334 = r3008331 * r3008333;
double r3008335 = r3008328 * r3008334;
double r3008336 = 4.0;
double r3008337 = b;
double r3008338 = 3.0;
double r3008339 = pow(r3008337, r3008338);
double r3008340 = r3008339 * r3008332;
double r3008341 = r3008336 * r3008340;
double r3008342 = r3008335 + r3008341;
double r3008343 = 18.0;
double r3008344 = abcd;
double r3008345 = r3008343 * r3008344;
double r3008346 = r3008342 - r3008345;
double r3008347 = ac;
double r3008348 = pow(r3008347, r3008338);
double r3008349 = r3008336 * r3008348;
double r3008350 = r3008346 + r3008349;
double r3008351 = pow(r3008337, r3008330);
double r3008352 = c;
double r3008353 = pow(r3008352, r3008330);
double r3008354 = r3008351 * r3008353;
double r3008355 = r3008350 - r3008354;
double r3008356 = 108.0;
double r3008357 = r3008355 / r3008356;
double r3008358 = pow(r3008329, r3008336);
double r3008359 = r3008357 * r3008358;
return r3008359;
}


double f(double a, double d, double b, double abcd, double ac, double c) {
double r3008360 = a;
double r3008361 = -7.973314533750296e-79;
bool r3008362 = r3008360 <= r3008361;
double r3008363 = 1.30042854247765e-72;
bool r3008364 = r3008360 <= r3008363;
double r3008365 = !r3008364;
bool r3008366 = r3008362 || r3008365;
double r3008367 = 27.0;
double r3008368 = 2.0;
double r3008369 = pow(r3008360, r3008368);
double r3008370 = d;
double r3008371 = pow(r3008370, r3008368);
double r3008372 = r3008369 * r3008371;
double r3008373 = r3008367 * r3008372;
double r3008374 = 4.0;
double r3008375 = b;
double r3008376 = 3.0;
double r3008377 = pow(r3008375, r3008376);
double r3008378 = r3008377 * r3008370;
double r3008379 = r3008374 * r3008378;
double r3008380 = r3008373 + r3008379;
double r3008381 = 18.0;
double r3008382 = abcd;
double r3008383 = r3008381 * r3008382;
double r3008384 = r3008380 - r3008383;
double r3008385 = ac;
double r3008386 = pow(r3008385, r3008376);
double r3008387 = r3008374 * r3008386;
double r3008388 = r3008384 + r3008387;
double r3008389 = 2.0;
double r3008390 = r3008368 / r3008389;
double r3008391 = pow(r3008375, r3008390);
double r3008392 = c;
double r3008393 = pow(r3008392, r3008390);
double r3008394 = r3008391 * r3008393;
double r3008395 = r3008394 * r3008394;
double r3008396 = r3008388 - r3008395;
double r3008397 = 108.0;
double r3008398 = r3008396 / r3008397;
double r3008399 = pow(r3008360, r3008374);
double r3008400 = r3008398 * r3008399;
double r3008401 = -0.16666666666666666;
double r3008402 = pow(r3008360, r3008389);
double r3008403 = r3008402 * r3008382;
double r3008404 = r3008402 * r3008403;
double r3008405 = r3008401 * r3008404;
double r3008406 = r3008366 ? r3008400 : r3008405;
return r3008406;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Split input into 2 regimes
2. ## if a < -7.973314533750296e-79 or 1.30042854247765e-72 < a

1. Initial program 28.9

$\frac{\left(\left(\left(27 \cdot \left({a}^{2} \cdot {d}^{2}\right) + 4 \cdot \left({b}^{3} \cdot d\right)\right) - 18 \cdot abcd\right) + 4 \cdot {ac}^{3}\right) - {b}^{2} \cdot {c}^{2}}{108} \cdot {a}^{4}$
2. Using strategy rm
3. Applied sqr-pow28.9

$\leadsto \frac{\left(\left(\left(27 \cdot \left({a}^{2} \cdot {d}^{2}\right) + 4 \cdot \left({b}^{3} \cdot d\right)\right) - 18 \cdot abcd\right) + 4 \cdot {ac}^{3}\right) - {b}^{2} \cdot \color{blue}{\left({c}^{\left(\frac{2}{2}\right)} \cdot {c}^{\left(\frac{2}{2}\right)}\right)}}{108} \cdot {a}^{4}$
4. Applied sqr-pow28.9

$\leadsto \frac{\left(\left(\left(27 \cdot \left({a}^{2} \cdot {d}^{2}\right) + 4 \cdot \left({b}^{3} \cdot d\right)\right) - 18 \cdot abcd\right) + 4 \cdot {ac}^{3}\right) - \color{blue}{\left({b}^{\left(\frac{2}{2}\right)} \cdot {b}^{\left(\frac{2}{2}\right)}\right)} \cdot \left({c}^{\left(\frac{2}{2}\right)} \cdot {c}^{\left(\frac{2}{2}\right)}\right)}{108} \cdot {a}^{4}$
5. Applied unswap-sqr22.4

$\leadsto \frac{\left(\left(\left(27 \cdot \left({a}^{2} \cdot {d}^{2}\right) + 4 \cdot \left({b}^{3} \cdot d\right)\right) - 18 \cdot abcd\right) + 4 \cdot {ac}^{3}\right) - \color{blue}{\left({b}^{\left(\frac{2}{2}\right)} \cdot {c}^{\left(\frac{2}{2}\right)}\right) \cdot \left({b}^{\left(\frac{2}{2}\right)} \cdot {c}^{\left(\frac{2}{2}\right)}\right)}}{108} \cdot {a}^{4}$

## if -7.973314533750296e-79 < a < 1.30042854247765e-72

1. Initial program 48.9

$\frac{\left(\left(\left(27 \cdot \left({a}^{2} \cdot {d}^{2}\right) + 4 \cdot \left({b}^{3} \cdot d\right)\right) - 18 \cdot abcd\right) + 4 \cdot {ac}^{3}\right) - {b}^{2} \cdot {c}^{2}}{108} \cdot {a}^{4}$
2. Taylor expanded around 0 28.6

$\leadsto \color{blue}{-0.1666666666666666574148081281236954964697 \cdot \left({a}^{4} \cdot abcd\right)}$
3. Using strategy rm
4. Applied sqr-pow28.6

$\leadsto -0.1666666666666666574148081281236954964697 \cdot \left(\color{blue}{\left({a}^{\left(\frac{4}{2}\right)} \cdot {a}^{\left(\frac{4}{2}\right)}\right)} \cdot abcd\right)$
5. Applied associate-*l*27.0

$\leadsto -0.1666666666666666574148081281236954964697 \cdot \color{blue}{\left({a}^{\left(\frac{4}{2}\right)} \cdot \left({a}^{\left(\frac{4}{2}\right)} \cdot abcd\right)\right)}$
6. Simplified27.0

$\leadsto -0.1666666666666666574148081281236954964697 \cdot \left({a}^{\left(\frac{4}{2}\right)} \cdot \color{blue}{\left({a}^{2} \cdot abcd\right)}\right)$
3. Recombined 2 regimes into one program.
4. Final simplification26.2

$\leadsto \begin{array}{l} \mathbf{if}\;a \le -7.973314533750296483312966544799002168631 \cdot 10^{-79} \lor \neg \left(a \le 1.300428542477650047332728922740117441134 \cdot 10^{-72}\right):\\ \;\;\;\;\frac{\left(\left(\left(27 \cdot \left({a}^{2} \cdot {d}^{2}\right) + 4 \cdot \left({b}^{3} \cdot d\right)\right) - 18 \cdot abcd\right) + 4 \cdot {ac}^{3}\right) - \left({b}^{\left(\frac{2}{2}\right)} \cdot {c}^{\left(\frac{2}{2}\right)}\right) \cdot \left({b}^{\left(\frac{2}{2}\right)} \cdot {c}^{\left(\frac{2}{2}\right)}\right)}{108} \cdot {a}^{4}\\ \mathbf{else}:\\ \;\;\;\;-0.1666666666666666574148081281236954964697 \cdot \left({a}^{2} \cdot \left({a}^{2} \cdot abcd\right)\right)\\ \end{array}$

# Reproduce

herbie shell --seed 1
(FPCore (a d b abcd ac c)
:name "(27a^2d^2+4b^3d-18abcd+4ac^3-b^2c^2)/108a^4"
:precision binary64
(* (/ (- (+ (- (+ (* 27 (* (pow a 2) (pow d 2))) (* 4 (* (pow b 3) d))) (* 18 abcd)) (* 4 (pow ac 3))) (* (pow b 2) (pow c 2))) 108) (pow a 4)))