Average Error: 1.0 → 0.1
Time: 19.7s
Precision: 64
\[2 \cdot \cos \left(\frac{2 \cdot \pi}{3} + \frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}\right)\]
\[2 \cdot \left(\sqrt[3]{\cos \left(\frac{\cos^{-1} \left(\frac{-g}{h}\right) \cdot \frac{3}{2} + 3 \cdot \pi}{\frac{9}{2}}\right) \cdot \cos \left(\frac{\cos^{-1} \left(\frac{-g}{h}\right) \cdot \frac{3}{2} + 3 \cdot \pi}{\frac{9}{2}}\right)} \cdot \sqrt[3]{\cos \left(\frac{\cos^{-1} \left(\frac{-g}{h}\right) \cdot \frac{3}{2} + 3 \cdot \pi}{\frac{9}{2}}\right)}\right)\]
2 \cdot \cos \left(\frac{2 \cdot \pi}{3} + \frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}\right)
2 \cdot \left(\sqrt[3]{\cos \left(\frac{\cos^{-1} \left(\frac{-g}{h}\right) \cdot \frac{3}{2} + 3 \cdot \pi}{\frac{9}{2}}\right) \cdot \cos \left(\frac{\cos^{-1} \left(\frac{-g}{h}\right) \cdot \frac{3}{2} + 3 \cdot \pi}{\frac{9}{2}}\right)} \cdot \sqrt[3]{\cos \left(\frac{\cos^{-1} \left(\frac{-g}{h}\right) \cdot \frac{3}{2} + 3 \cdot \pi}{\frac{9}{2}}\right)}\right)
double f(double g, double h) {
        double r4318251 = 2.0;
        double r4318252 = atan2(1.0, 0.0);
        double r4318253 = r4318251 * r4318252;
        double r4318254 = 3.0;
        double r4318255 = r4318253 / r4318254;
        double r4318256 = g;
        double r4318257 = -r4318256;
        double r4318258 = h;
        double r4318259 = r4318257 / r4318258;
        double r4318260 = acos(r4318259);
        double r4318261 = r4318260 / r4318254;
        double r4318262 = r4318255 + r4318261;
        double r4318263 = cos(r4318262);
        double r4318264 = r4318251 * r4318263;
        return r4318264;
}

double f(double g, double h) {
        double r4318265 = 2.0;
        double r4318266 = g;
        double r4318267 = -r4318266;
        double r4318268 = h;
        double r4318269 = r4318267 / r4318268;
        double r4318270 = acos(r4318269);
        double r4318271 = 1.5;
        double r4318272 = r4318270 * r4318271;
        double r4318273 = 3.0;
        double r4318274 = atan2(1.0, 0.0);
        double r4318275 = r4318273 * r4318274;
        double r4318276 = r4318272 + r4318275;
        double r4318277 = 4.5;
        double r4318278 = r4318276 / r4318277;
        double r4318279 = cos(r4318278);
        double r4318280 = r4318279 * r4318279;
        double r4318281 = cbrt(r4318280);
        double r4318282 = cbrt(r4318279);
        double r4318283 = r4318281 * r4318282;
        double r4318284 = r4318265 * r4318283;
        return r4318284;
}

Error

Bits error versus g

Bits error versus h

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 1.0

    \[2 \cdot \cos \left(\frac{2 \cdot \pi}{3} + \frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}\right)\]
  2. Simplified1.0

    \[\leadsto \color{blue}{\cos \left(\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3} + \frac{\pi}{\frac{3}{2}}\right) \cdot 2}\]
  3. Using strategy rm
  4. Applied frac-add1.0

    \[\leadsto \cos \color{blue}{\left(\frac{\cos^{-1} \left(\frac{-g}{h}\right) \cdot \frac{3}{2} + 3 \cdot \pi}{3 \cdot \frac{3}{2}}\right)} \cdot 2\]
  5. Simplified1.0

    \[\leadsto \cos \left(\frac{\cos^{-1} \left(\frac{-g}{h}\right) \cdot \frac{3}{2} + 3 \cdot \pi}{\color{blue}{\frac{9}{2}}}\right) \cdot 2\]
  6. Using strategy rm
  7. Applied add-cbrt-cube1.5

    \[\leadsto \color{blue}{\sqrt[3]{\left(\cos \left(\frac{\cos^{-1} \left(\frac{-g}{h}\right) \cdot \frac{3}{2} + 3 \cdot \pi}{\frac{9}{2}}\right) \cdot \cos \left(\frac{\cos^{-1} \left(\frac{-g}{h}\right) \cdot \frac{3}{2} + 3 \cdot \pi}{\frac{9}{2}}\right)\right) \cdot \cos \left(\frac{\cos^{-1} \left(\frac{-g}{h}\right) \cdot \frac{3}{2} + 3 \cdot \pi}{\frac{9}{2}}\right)}} \cdot 2\]
  8. Using strategy rm
  9. Applied cbrt-prod0.1

    \[\leadsto \color{blue}{\left(\sqrt[3]{\cos \left(\frac{\cos^{-1} \left(\frac{-g}{h}\right) \cdot \frac{3}{2} + 3 \cdot \pi}{\frac{9}{2}}\right) \cdot \cos \left(\frac{\cos^{-1} \left(\frac{-g}{h}\right) \cdot \frac{3}{2} + 3 \cdot \pi}{\frac{9}{2}}\right)} \cdot \sqrt[3]{\cos \left(\frac{\cos^{-1} \left(\frac{-g}{h}\right) \cdot \frac{3}{2} + 3 \cdot \pi}{\frac{9}{2}}\right)}\right)} \cdot 2\]
  10. Final simplification0.1

    \[\leadsto 2 \cdot \left(\sqrt[3]{\cos \left(\frac{\cos^{-1} \left(\frac{-g}{h}\right) \cdot \frac{3}{2} + 3 \cdot \pi}{\frac{9}{2}}\right) \cdot \cos \left(\frac{\cos^{-1} \left(\frac{-g}{h}\right) \cdot \frac{3}{2} + 3 \cdot \pi}{\frac{9}{2}}\right)} \cdot \sqrt[3]{\cos \left(\frac{\cos^{-1} \left(\frac{-g}{h}\right) \cdot \frac{3}{2} + 3 \cdot \pi}{\frac{9}{2}}\right)}\right)\]

Reproduce

herbie shell --seed 2019151 
(FPCore (g h)
  :name "2-ancestry mixing, negative discriminant"
  (* 2 (cos (+ (/ (* 2 PI) 3) (/ (acos (/ (- g) h)) 3)))))