Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Sep 2010 14:01:38 -0400
From:      David Schultz <das@FreeBSD.ORG>
To:        =?iso-8859-1?Q?P=C1LI_G=E1bor_J=E1nos?= <pgj@elte.hu>
Cc:        hackers@FreeBSD.ORG
Subject:   Re: clogf(3) (complex.h)
Message-ID:  <20100928180138.GA76574@zim.MIT.EDU>
In-Reply-To: <4CA0FF2C.9010108@elte.hu>
References:  <4CA0FF2C.9010108@elte.hu>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Sep 27, 2010, PÁLI Gábor János wrote:
>  Hello,
> 
> I would like to use the clogf(3) function from complex.h, but it seems
> there is no such function implemented on FreeBSD (8.1-STABLE).  Am I
> missing something or is there any way to work this around?

A simple workaround is something like:

    logf(cabs(z)) + i * cargf(z)

There are a few special cases, e.g., when creal(z) < 0, you have to add
i * copysign(M_PI, cimag(z)), and when creal(z) == 0, it's M_PI/2...



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100928180138.GA76574>