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]

Re: [PATCH] libm/complex: add clog10, clog10f


Hi Yaakov,

On Feb 18 10:53, Yaakov Selkowitz wrote:
> 	newlib/
> 	* libc/include/complex.h (clog10, clog10f): Declare.
> 	* libm/complex/Makefile.am (src): Add clog10.c.
> 	(fsrc): Add clog10f.c.
> 	(CHEWOUT_FILES): Add clog10.def.
> 	* libm/complex/Makefile.in: Regenerate.
> 	* libm/complex/clog10.c: New file.
> 	* libm/complex/clog10f.c: New file.
> 	* libm/complex/complex.tex: Add references to clog10 docs.
> 
> Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
> ---
> [...]
> +#include <complex.h>
> +#include <math.h>
> +
> +double complex
> +clog10(double complex z)
> +{
> +	double complex w;
> +	double p, rr;
> +
> +	rr = cabs(z);
> +	p = log10(rr);
> +	rr = atan2(cimag(z), creal(z)) * M_IVLN10;
> +	w = p + rr * I;
> +	return w;
> +}
> 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;
> +}

Did you write these functions by yourself or did you fetch them from
some upstream?  If so, where from?

My complex math is next to inexistent, but I took a look into the glibc
man page.  The man page says "clog10(z) is equivalent to clog(z)/log(10)".
The above is equivalent, I take it?


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat

Attachment: signature.asc
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]