Average Error: 1.0 → 0.1
Time: 16.9s
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 r2504193 = 2.0;
        double r2504194 = atan2(1.0, 0.0);
        double r2504195 = r2504193 * r2504194;
        double r2504196 = 3.0;
        double r2504197 = r2504195 / r2504196;
        double r2504198 = g;
        double r2504199 = -r2504198;
        double r2504200 = h;
        double r2504201 = r2504199 / r2504200;
        double r2504202 = acos(r2504201);
        double r2504203 = r2504202 / r2504196;
        double r2504204 = r2504197 + r2504203;
        double r2504205 = cos(r2504204);
        double r2504206 = r2504193 * r2504205;
        return r2504206;
}

double f(double g, double h) {
        double r2504207 = 2.0;
        double r2504208 = g;
        double r2504209 = -r2504208;
        double r2504210 = h;
        double r2504211 = r2504209 / r2504210;
        double r2504212 = acos(r2504211);
        double r2504213 = 1.5;
        double r2504214 = r2504212 * r2504213;
        double r2504215 = 3.0;
        double r2504216 = atan2(1.0, 0.0);
        double r2504217 = r2504215 * r2504216;
        double r2504218 = r2504214 + r2504217;
        double r2504219 = 4.5;
        double r2504220 = r2504218 / r2504219;
        double r2504221 = cos(r2504220);
        double r2504222 = r2504221 * r2504221;
        double r2504223 = cbrt(r2504222);
        double r2504224 = cbrt(r2504221);
        double r2504225 = r2504223 * r2504224;
        double r2504226 = r2504207 * r2504225;
        return r2504226;
}

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)))))