Average Error: 7.0 → 0.4
Time: 32.7s
Precision: 64
$\sqrt{\frac{-4}{3} \cdot p} \cdot \cos \left(\frac{1}{3} \cdot \cos^{-1} \left(\frac{-q}{w} \cdot \sqrt{\frac{-27}{{p}^{3}}}\right)\right) - \frac{b}{3} \cdot a$
$\sqrt{\frac{-4}{3} \cdot p} \cdot \cos \left(\frac{1}{3} \cdot \cos^{-1} \left(\left(\frac{-\sqrt[3]{q} \cdot \sqrt[3]{q}}{\sqrt[3]{w} \cdot \sqrt[3]{w}} \cdot \left(\frac{\sqrt[3]{q}}{\sqrt[3]{w}} \cdot \left|\frac{\sqrt[3]{27}}{{\left(\sqrt[3]{p} \cdot \sqrt[3]{p}\right)}^{\left(\frac{3}{2}\right)}}\right|\right)\right) \cdot \sqrt{\frac{-\sqrt[3]{27}}{{\left(\sqrt[3]{p}\right)}^{3}}}\right)\right) - \frac{b}{3} \cdot a$
\sqrt{\frac{-4}{3} \cdot p} \cdot \cos \left(\frac{1}{3} \cdot \cos^{-1} \left(\frac{-q}{w} \cdot \sqrt{\frac{-27}{{p}^{3}}}\right)\right) - \frac{b}{3} \cdot a
\sqrt{\frac{-4}{3} \cdot p} \cdot \cos \left(\frac{1}{3} \cdot \cos^{-1} \left(\left(\frac{-\sqrt[3]{q} \cdot \sqrt[3]{q}}{\sqrt[3]{w} \cdot \sqrt[3]{w}} \cdot \left(\frac{\sqrt[3]{q}}{\sqrt[3]{w}} \cdot \left|\frac{\sqrt[3]{27}}{{\left(\sqrt[3]{p} \cdot \sqrt[3]{p}\right)}^{\left(\frac{3}{2}\right)}}\right|\right)\right) \cdot \sqrt{\frac{-\sqrt[3]{27}}{{\left(\sqrt[3]{p}\right)}^{3}}}\right)\right) - \frac{b}{3} \cdot a
double f(double p, double q, double w, double b, double a) {
double r2702189 = 4.0;
double r2702190 = -r2702189;
double r2702191 = 3.0;
double r2702192 = r2702190 / r2702191;
double r2702193 = p;
double r2702194 = r2702192 * r2702193;
double r2702195 = sqrt(r2702194);
double r2702196 = 1.0;
double r2702197 = r2702196 / r2702191;
double r2702198 = q;
double r2702199 = -r2702198;
double r2702200 = w;
double r2702201 = r2702199 / r2702200;
double r2702202 = 27.0;
double r2702203 = -r2702202;
double r2702204 = pow(r2702193, r2702191);
double r2702205 = r2702203 / r2702204;
double r2702206 = sqrt(r2702205);
double r2702207 = r2702201 * r2702206;
double r2702208 = acos(r2702207);
double r2702209 = r2702197 * r2702208;
double r2702210 = cos(r2702209);
double r2702211 = r2702195 * r2702210;
double r2702212 = b;
double r2702213 = r2702212 / r2702191;
double r2702214 = a;
double r2702215 = r2702213 * r2702214;
double r2702216 = r2702211 - r2702215;
return r2702216;
}


double f(double p, double q, double w, double b, double a) {
double r2702217 = 4.0;
double r2702218 = -r2702217;
double r2702219 = 3.0;
double r2702220 = r2702218 / r2702219;
double r2702221 = p;
double r2702222 = r2702220 * r2702221;
double r2702223 = sqrt(r2702222);
double r2702224 = 1.0;
double r2702225 = r2702224 / r2702219;
double r2702226 = q;
double r2702227 = cbrt(r2702226);
double r2702228 = r2702227 * r2702227;
double r2702229 = -r2702228;
double r2702230 = w;
double r2702231 = cbrt(r2702230);
double r2702232 = r2702231 * r2702231;
double r2702233 = r2702229 / r2702232;
double r2702234 = r2702227 / r2702231;
double r2702235 = 27.0;
double r2702236 = cbrt(r2702235);
double r2702237 = cbrt(r2702221);
double r2702238 = r2702237 * r2702237;
double r2702239 = 2.0;
double r2702240 = r2702219 / r2702239;
double r2702241 = pow(r2702238, r2702240);
double r2702242 = r2702236 / r2702241;
double r2702243 = fabs(r2702242);
double r2702244 = r2702234 * r2702243;
double r2702245 = r2702233 * r2702244;
double r2702246 = -r2702236;
double r2702247 = pow(r2702237, r2702219);
double r2702248 = r2702246 / r2702247;
double r2702249 = sqrt(r2702248);
double r2702250 = r2702245 * r2702249;
double r2702251 = acos(r2702250);
double r2702252 = r2702225 * r2702251;
double r2702253 = cos(r2702252);
double r2702254 = r2702223 * r2702253;
double r2702255 = b;
double r2702256 = r2702255 / r2702219;
double r2702257 = a;
double r2702258 = r2702256 * r2702257;
double r2702259 = r2702254 - r2702258;
return r2702259;
}



Try it out

Results

 In Out
Enter valid numbers for all inputs

Derivation

1. Initial program 7.0

$\sqrt{\frac{-4}{3} \cdot p} \cdot \cos \left(\frac{1}{3} \cdot \cos^{-1} \left(\frac{-q}{w} \cdot \sqrt{\frac{-27}{{p}^{3}}}\right)\right) - \frac{b}{3} \cdot a$
2. Using strategy rm

$\leadsto \sqrt{\frac{-4}{3} \cdot p} \cdot \cos \left(\frac{1}{3} \cdot \cos^{-1} \left(\frac{-q}{w} \cdot \sqrt{\frac{-27}{{\color{blue}{\left(\left(\sqrt[3]{p} \cdot \sqrt[3]{p}\right) \cdot \sqrt[3]{p}\right)}}^{3}}}\right)\right) - \frac{b}{3} \cdot a$
4. Applied unpow-prod-down7.0

$\leadsto \sqrt{\frac{-4}{3} \cdot p} \cdot \cos \left(\frac{1}{3} \cdot \cos^{-1} \left(\frac{-q}{w} \cdot \sqrt{\frac{-27}{\color{blue}{{\left(\sqrt[3]{p} \cdot \sqrt[3]{p}\right)}^{3} \cdot {\left(\sqrt[3]{p}\right)}^{3}}}}\right)\right) - \frac{b}{3} \cdot a$

$\leadsto \sqrt{\frac{-4}{3} \cdot p} \cdot \cos \left(\frac{1}{3} \cdot \cos^{-1} \left(\frac{-q}{w} \cdot \sqrt{\frac{-\color{blue}{\left(\sqrt[3]{27} \cdot \sqrt[3]{27}\right) \cdot \sqrt[3]{27}}}{{\left(\sqrt[3]{p} \cdot \sqrt[3]{p}\right)}^{3} \cdot {\left(\sqrt[3]{p}\right)}^{3}}}\right)\right) - \frac{b}{3} \cdot a$
6. Applied distribute-rgt-neg-in7.0

$\leadsto \sqrt{\frac{-4}{3} \cdot p} \cdot \cos \left(\frac{1}{3} \cdot \cos^{-1} \left(\frac{-q}{w} \cdot \sqrt{\frac{\color{blue}{\left(\sqrt[3]{27} \cdot \sqrt[3]{27}\right) \cdot \left(-\sqrt[3]{27}\right)}}{{\left(\sqrt[3]{p} \cdot \sqrt[3]{p}\right)}^{3} \cdot {\left(\sqrt[3]{p}\right)}^{3}}}\right)\right) - \frac{b}{3} \cdot a$
7. Applied times-frac7.0

$\leadsto \sqrt{\frac{-4}{3} \cdot p} \cdot \cos \left(\frac{1}{3} \cdot \cos^{-1} \left(\frac{-q}{w} \cdot \sqrt{\color{blue}{\frac{\sqrt[3]{27} \cdot \sqrt[3]{27}}{{\left(\sqrt[3]{p} \cdot \sqrt[3]{p}\right)}^{3}} \cdot \frac{-\sqrt[3]{27}}{{\left(\sqrt[3]{p}\right)}^{3}}}}\right)\right) - \frac{b}{3} \cdot a$
8. Applied sqrt-prod4.6

$\leadsto \sqrt{\frac{-4}{3} \cdot p} \cdot \cos \left(\frac{1}{3} \cdot \cos^{-1} \left(\frac{-q}{w} \cdot \color{blue}{\left(\sqrt{\frac{\sqrt[3]{27} \cdot \sqrt[3]{27}}{{\left(\sqrt[3]{p} \cdot \sqrt[3]{p}\right)}^{3}}} \cdot \sqrt{\frac{-\sqrt[3]{27}}{{\left(\sqrt[3]{p}\right)}^{3}}}\right)}\right)\right) - \frac{b}{3} \cdot a$
9. Applied associate-*r*4.6

$\leadsto \sqrt{\frac{-4}{3} \cdot p} \cdot \cos \left(\frac{1}{3} \cdot \cos^{-1} \color{blue}{\left(\left(\frac{-q}{w} \cdot \sqrt{\frac{\sqrt[3]{27} \cdot \sqrt[3]{27}}{{\left(\sqrt[3]{p} \cdot \sqrt[3]{p}\right)}^{3}}}\right) \cdot \sqrt{\frac{-\sqrt[3]{27}}{{\left(\sqrt[3]{p}\right)}^{3}}}\right)}\right) - \frac{b}{3} \cdot a$
10. Using strategy rm

$\leadsto \sqrt{\frac{-4}{3} \cdot p} \cdot \cos \left(\frac{1}{3} \cdot \cos^{-1} \left(\left(\frac{-q}{\color{blue}{\left(\sqrt[3]{w} \cdot \sqrt[3]{w}\right) \cdot \sqrt[3]{w}}} \cdot \sqrt{\frac{\sqrt[3]{27} \cdot \sqrt[3]{27}}{{\left(\sqrt[3]{p} \cdot \sqrt[3]{p}\right)}^{3}}}\right) \cdot \sqrt{\frac{-\sqrt[3]{27}}{{\left(\sqrt[3]{p}\right)}^{3}}}\right)\right) - \frac{b}{3} \cdot a$

$\leadsto \sqrt{\frac{-4}{3} \cdot p} \cdot \cos \left(\frac{1}{3} \cdot \cos^{-1} \left(\left(\frac{-\color{blue}{\left(\sqrt[3]{q} \cdot \sqrt[3]{q}\right) \cdot \sqrt[3]{q}}}{\left(\sqrt[3]{w} \cdot \sqrt[3]{w}\right) \cdot \sqrt[3]{w}} \cdot \sqrt{\frac{\sqrt[3]{27} \cdot \sqrt[3]{27}}{{\left(\sqrt[3]{p} \cdot \sqrt[3]{p}\right)}^{3}}}\right) \cdot \sqrt{\frac{-\sqrt[3]{27}}{{\left(\sqrt[3]{p}\right)}^{3}}}\right)\right) - \frac{b}{3} \cdot a$
13. Applied distribute-lft-neg-in4.6

$\leadsto \sqrt{\frac{-4}{3} \cdot p} \cdot \cos \left(\frac{1}{3} \cdot \cos^{-1} \left(\left(\frac{\color{blue}{\left(-\sqrt[3]{q} \cdot \sqrt[3]{q}\right) \cdot \sqrt[3]{q}}}{\left(\sqrt[3]{w} \cdot \sqrt[3]{w}\right) \cdot \sqrt[3]{w}} \cdot \sqrt{\frac{\sqrt[3]{27} \cdot \sqrt[3]{27}}{{\left(\sqrt[3]{p} \cdot \sqrt[3]{p}\right)}^{3}}}\right) \cdot \sqrt{\frac{-\sqrt[3]{27}}{{\left(\sqrt[3]{p}\right)}^{3}}}\right)\right) - \frac{b}{3} \cdot a$
14. Applied times-frac4.6

$\leadsto \sqrt{\frac{-4}{3} \cdot p} \cdot \cos \left(\frac{1}{3} \cdot \cos^{-1} \left(\left(\color{blue}{\left(\frac{-\sqrt[3]{q} \cdot \sqrt[3]{q}}{\sqrt[3]{w} \cdot \sqrt[3]{w}} \cdot \frac{\sqrt[3]{q}}{\sqrt[3]{w}}\right)} \cdot \sqrt{\frac{\sqrt[3]{27} \cdot \sqrt[3]{27}}{{\left(\sqrt[3]{p} \cdot \sqrt[3]{p}\right)}^{3}}}\right) \cdot \sqrt{\frac{-\sqrt[3]{27}}{{\left(\sqrt[3]{p}\right)}^{3}}}\right)\right) - \frac{b}{3} \cdot a$
15. Applied associate-*l*3.5

$\leadsto \sqrt{\frac{-4}{3} \cdot p} \cdot \cos \left(\frac{1}{3} \cdot \cos^{-1} \left(\color{blue}{\left(\frac{-\sqrt[3]{q} \cdot \sqrt[3]{q}}{\sqrt[3]{w} \cdot \sqrt[3]{w}} \cdot \left(\frac{\sqrt[3]{q}}{\sqrt[3]{w}} \cdot \sqrt{\frac{\sqrt[3]{27} \cdot \sqrt[3]{27}}{{\left(\sqrt[3]{p} \cdot \sqrt[3]{p}\right)}^{3}}}\right)\right)} \cdot \sqrt{\frac{-\sqrt[3]{27}}{{\left(\sqrt[3]{p}\right)}^{3}}}\right)\right) - \frac{b}{3} \cdot a$
16. Simplified0.4

$\leadsto \sqrt{\frac{-4}{3} \cdot p} \cdot \cos \left(\frac{1}{3} \cdot \cos^{-1} \left(\left(\frac{-\sqrt[3]{q} \cdot \sqrt[3]{q}}{\sqrt[3]{w} \cdot \sqrt[3]{w}} \cdot \color{blue}{\left(\frac{\sqrt[3]{q}}{\sqrt[3]{w}} \cdot \left|\frac{\sqrt[3]{27}}{{\left(\sqrt[3]{p} \cdot \sqrt[3]{p}\right)}^{\left(\frac{3}{2}\right)}}\right|\right)}\right) \cdot \sqrt{\frac{-\sqrt[3]{27}}{{\left(\sqrt[3]{p}\right)}^{3}}}\right)\right) - \frac{b}{3} \cdot a$
17. Final simplification0.4

$\leadsto \sqrt{\frac{-4}{3} \cdot p} \cdot \cos \left(\frac{1}{3} \cdot \cos^{-1} \left(\left(\frac{-\sqrt[3]{q} \cdot \sqrt[3]{q}}{\sqrt[3]{w} \cdot \sqrt[3]{w}} \cdot \left(\frac{\sqrt[3]{q}}{\sqrt[3]{w}} \cdot \left|\frac{\sqrt[3]{27}}{{\left(\sqrt[3]{p} \cdot \sqrt[3]{p}\right)}^{\left(\frac{3}{2}\right)}}\right|\right)\right) \cdot \sqrt{\frac{-\sqrt[3]{27}}{{\left(\sqrt[3]{p}\right)}^{3}}}\right)\right) - \frac{b}{3} \cdot a$

Reproduce

herbie shell --seed 1
(FPCore (p q w b a)
:name "sqrt(-4/3*p)*cos(1/3*acos(-q/w*sqrt(-27/p^3)))-b/3a"
:precision binary64
(- (* (sqrt (* (/ (- 4) 3) p)) (cos (* (/ 1 3) (acos (* (/ (- q) w) (sqrt (/ (- 27) (pow p 3)))))))) (* (/ b 3) a)))