Average Error: 1.0 → 1.0
Time: 24.1s
Precision: 64
\[2 \cdot \cos \left(\frac{2 \cdot \pi}{3} + \frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}\right)\]
\[2 \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\cos \left(\mathsf{fma}\left(\frac{2}{3}, \pi, \left(\left(\sqrt[3]{\frac{\cos^{-1} \left(-\frac{g}{h}\right)}{\sqrt{3}}} \cdot \sqrt[3]{\frac{\cos^{-1} \left(-\frac{g}{h}\right)}{\sqrt{3}}}\right) \cdot \left(\sqrt[3]{\frac{1}{\sqrt{3}}} \cdot \sqrt[3]{\frac{1}{\sqrt{3}}}\right)\right) \cdot \sqrt[3]{\frac{\cos^{-1} \left(-\frac{g}{h}\right)}{3}}\right)\right)\right)\right)\]
2 \cdot \cos \left(\frac{2 \cdot \pi}{3} + \frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}\right)
2 \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\cos \left(\mathsf{fma}\left(\frac{2}{3}, \pi, \left(\left(\sqrt[3]{\frac{\cos^{-1} \left(-\frac{g}{h}\right)}{\sqrt{3}}} \cdot \sqrt[3]{\frac{\cos^{-1} \left(-\frac{g}{h}\right)}{\sqrt{3}}}\right) \cdot \left(\sqrt[3]{\frac{1}{\sqrt{3}}} \cdot \sqrt[3]{\frac{1}{\sqrt{3}}}\right)\right) \cdot \sqrt[3]{\frac{\cos^{-1} \left(-\frac{g}{h}\right)}{3}}\right)\right)\right)\right)
double f(double g, double h) {
        double r3940542 = 2.0;
        double r3940543 = atan2(1.0, 0.0);
        double r3940544 = r3940542 * r3940543;
        double r3940545 = 3.0;
        double r3940546 = r3940544 / r3940545;
        double r3940547 = g;
        double r3940548 = -r3940547;
        double r3940549 = h;
        double r3940550 = r3940548 / r3940549;
        double r3940551 = acos(r3940550);
        double r3940552 = r3940551 / r3940545;
        double r3940553 = r3940546 + r3940552;
        double r3940554 = cos(r3940553);
        double r3940555 = r3940542 * r3940554;
        return r3940555;
}

double f(double g, double h) {
        double r3940556 = 2.0;
        double r3940557 = 0.6666666666666666;
        double r3940558 = atan2(1.0, 0.0);
        double r3940559 = g;
        double r3940560 = h;
        double r3940561 = r3940559 / r3940560;
        double r3940562 = -r3940561;
        double r3940563 = acos(r3940562);
        double r3940564 = 3.0;
        double r3940565 = sqrt(r3940564);
        double r3940566 = r3940563 / r3940565;
        double r3940567 = cbrt(r3940566);
        double r3940568 = r3940567 * r3940567;
        double r3940569 = 1.0;
        double r3940570 = r3940569 / r3940565;
        double r3940571 = cbrt(r3940570);
        double r3940572 = r3940571 * r3940571;
        double r3940573 = r3940568 * r3940572;
        double r3940574 = r3940563 / r3940564;
        double r3940575 = cbrt(r3940574);
        double r3940576 = r3940573 * r3940575;
        double r3940577 = fma(r3940557, r3940558, r3940576);
        double r3940578 = cos(r3940577);
        double r3940579 = expm1(r3940578);
        double r3940580 = log1p(r3940579);
        double r3940581 = r3940556 * r3940580;
        return r3940581;
}

Error

Bits error versus g

Bits error versus h

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(\mathsf{fma}\left(\frac{2}{3}, \pi, \frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}\right)\right) \cdot 2}\]
  3. Using strategy rm
  4. Applied log1p-expm1-u1.0

    \[\leadsto \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\cos \left(\mathsf{fma}\left(\frac{2}{3}, \pi, \frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}\right)\right)\right)\right)} \cdot 2\]
  5. Using strategy rm
  6. Applied add-cube-cbrt1.0

    \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\cos \left(\mathsf{fma}\left(\frac{2}{3}, \pi, \color{blue}{\left(\sqrt[3]{\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}} \cdot \sqrt[3]{\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}}\right) \cdot \sqrt[3]{\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}}}\right)\right)\right)\right) \cdot 2\]
  7. Using strategy rm
  8. Applied add-sqr-sqrt1.0

    \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\cos \left(\mathsf{fma}\left(\frac{2}{3}, \pi, \left(\sqrt[3]{\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}} \cdot \sqrt[3]{\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{\color{blue}{\sqrt{3} \cdot \sqrt{3}}}}\right) \cdot \sqrt[3]{\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}}\right)\right)\right)\right) \cdot 2\]
  9. Applied *-un-lft-identity1.0

    \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\cos \left(\mathsf{fma}\left(\frac{2}{3}, \pi, \left(\sqrt[3]{\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}} \cdot \sqrt[3]{\frac{\color{blue}{1 \cdot \cos^{-1} \left(\frac{-g}{h}\right)}}{\sqrt{3} \cdot \sqrt{3}}}\right) \cdot \sqrt[3]{\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}}\right)\right)\right)\right) \cdot 2\]
  10. Applied times-frac1.0

    \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\cos \left(\mathsf{fma}\left(\frac{2}{3}, \pi, \left(\sqrt[3]{\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}} \cdot \sqrt[3]{\color{blue}{\frac{1}{\sqrt{3}} \cdot \frac{\cos^{-1} \left(\frac{-g}{h}\right)}{\sqrt{3}}}}\right) \cdot \sqrt[3]{\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}}\right)\right)\right)\right) \cdot 2\]
  11. Applied cbrt-prod1.0

    \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\cos \left(\mathsf{fma}\left(\frac{2}{3}, \pi, \left(\sqrt[3]{\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}} \cdot \color{blue}{\left(\sqrt[3]{\frac{1}{\sqrt{3}}} \cdot \sqrt[3]{\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{\sqrt{3}}}\right)}\right) \cdot \sqrt[3]{\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}}\right)\right)\right)\right) \cdot 2\]
  12. Applied add-sqr-sqrt1.0

    \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\cos \left(\mathsf{fma}\left(\frac{2}{3}, \pi, \left(\sqrt[3]{\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{\color{blue}{\sqrt{3} \cdot \sqrt{3}}}} \cdot \left(\sqrt[3]{\frac{1}{\sqrt{3}}} \cdot \sqrt[3]{\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{\sqrt{3}}}\right)\right) \cdot \sqrt[3]{\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}}\right)\right)\right)\right) \cdot 2\]
  13. Applied *-un-lft-identity1.0

    \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\cos \left(\mathsf{fma}\left(\frac{2}{3}, \pi, \left(\sqrt[3]{\frac{\color{blue}{1 \cdot \cos^{-1} \left(\frac{-g}{h}\right)}}{\sqrt{3} \cdot \sqrt{3}}} \cdot \left(\sqrt[3]{\frac{1}{\sqrt{3}}} \cdot \sqrt[3]{\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{\sqrt{3}}}\right)\right) \cdot \sqrt[3]{\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}}\right)\right)\right)\right) \cdot 2\]
  14. Applied times-frac1.0

    \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\cos \left(\mathsf{fma}\left(\frac{2}{3}, \pi, \left(\sqrt[3]{\color{blue}{\frac{1}{\sqrt{3}} \cdot \frac{\cos^{-1} \left(\frac{-g}{h}\right)}{\sqrt{3}}}} \cdot \left(\sqrt[3]{\frac{1}{\sqrt{3}}} \cdot \sqrt[3]{\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{\sqrt{3}}}\right)\right) \cdot \sqrt[3]{\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}}\right)\right)\right)\right) \cdot 2\]
  15. Applied cbrt-prod1.0

    \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\cos \left(\mathsf{fma}\left(\frac{2}{3}, \pi, \left(\color{blue}{\left(\sqrt[3]{\frac{1}{\sqrt{3}}} \cdot \sqrt[3]{\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{\sqrt{3}}}\right)} \cdot \left(\sqrt[3]{\frac{1}{\sqrt{3}}} \cdot \sqrt[3]{\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{\sqrt{3}}}\right)\right) \cdot \sqrt[3]{\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}}\right)\right)\right)\right) \cdot 2\]
  16. Applied swap-sqr1.0

    \[\leadsto \mathsf{log1p}\left(\mathsf{expm1}\left(\cos \left(\mathsf{fma}\left(\frac{2}{3}, \pi, \color{blue}{\left(\left(\sqrt[3]{\frac{1}{\sqrt{3}}} \cdot \sqrt[3]{\frac{1}{\sqrt{3}}}\right) \cdot \left(\sqrt[3]{\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{\sqrt{3}}} \cdot \sqrt[3]{\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{\sqrt{3}}}\right)\right)} \cdot \sqrt[3]{\frac{\cos^{-1} \left(\frac{-g}{h}\right)}{3}}\right)\right)\right)\right) \cdot 2\]
  17. Final simplification1.0

    \[\leadsto 2 \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\cos \left(\mathsf{fma}\left(\frac{2}{3}, \pi, \left(\left(\sqrt[3]{\frac{\cos^{-1} \left(-\frac{g}{h}\right)}{\sqrt{3}}} \cdot \sqrt[3]{\frac{\cos^{-1} \left(-\frac{g}{h}\right)}{\sqrt{3}}}\right) \cdot \left(\sqrt[3]{\frac{1}{\sqrt{3}}} \cdot \sqrt[3]{\frac{1}{\sqrt{3}}}\right)\right) \cdot \sqrt[3]{\frac{\cos^{-1} \left(-\frac{g}{h}\right)}{3}}\right)\right)\right)\right)\]

Reproduce

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