how to generate pi in c

Polytropon freebsd at edvax.de
Fri Nov 5 18:14:02 UTC 2010


On Fri, 5 Nov 2010 13:39:05 -0400, Alejandro Imass <ait at p2ee.org> wrote:
> This is how I do it in perl
> use constant PI => 4 * atan2(1, 1);
> 
> In C it owuld probably be (using math.h):
> 
> pi = 4.0*atan(1.0);

Or use M_PI from /usr/include/math.h, as we already #include'd
it. :-) 

#define M_PI            3.14159265358979323846



-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...


More information about the freebsd-questions mailing list