This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
On 02/18/2016 11:53 AM, Yaakov Selkowitz wrote:
...
diff --git a/newlib/libm/complex/clog10f.c b/newlib/libm/complex/clog10f.c
new file mode 100644
index 0000000..98cf606
--- /dev/null
+++ b/newlib/libm/complex/clog10f.c
@@ -0,0 +1,15 @@
+#include <complex.h>
+#include <math.h>
+
+float complex
+clog10f(float complex z)
+{
+ float complex w;
+ float p, rr;
+
+ rr = cabsf(z);
+ p = log10f(rr);
+ rr = atan2f(cimagf(z), crealf(z)) * M_IVLN10;
+ w = p + rr * I;
+ return w;
+}
...
The rr calculation needs a cast for the constant, otherwise it will use double
for the multiply:
rr = atan2f(cimagf(z), crealf(z)) * (float) M_IVLN10; Craig
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |