math: avoid runtime conversions of floating-point constants
[musl] / src / complex / cacoshf.c
index 37ff880..8bd8058 100644 (file)
@@ -1,7 +1,10 @@
-#include "libm.h"
+#include "complex_impl.h"
 
 float complex cacoshf(float complex z)
 {
+       int zineg = signbit(cimagf(z));
+
        z = cacosf(z);
-       return cpackf(-cimagf(z), crealf(z));
+       if (zineg) return CMPLXF(cimagf(z), -crealf(z));
+       else       return CMPLXF(-cimagf(z), crealf(z));
 }