← Back to team overview

kicad-developers team mailing list archive

Re: Too many slices of pi.

 

I found yet another slice of pi courtesy of wxWidgets found in <wx/math.h>:

#include <math.h>

#ifndef M_PI
    #define M_PI 3.1415926535897932384626433832795
#endif

This gets pulled in anywhere <wx/wx.h> is included which is just about everywhere. So I'm changing my proposal to removing KiCad's definition of M_PI in <include/fctsys.h> and use the one in <wx/math.h> unless we need more precision. I also verified that this goes back all the way back to the 2.6 branch wxWidgets so we should be safe as far as that's concerned.

Wayne

On 10/16/2012 11:03 AM, Wayne Stambaugh wrote:
This bug:

https://bugs.launchpad.net/bugs/1066194

is both comical and embarrassing.  I'm willing to reduce our slices pi
to two (the one in boost/polygon/polygon_set_data.hpp is defined as part
of an inline function so it has to stay).  If there are no objections, I
suggest we either use the definition of M_PI in math.h if it's defined
on a given platform and add the definition of M_PI in config.h it if it
is not.  If we need more precision than definition of M_PI in math.h (on
MinGW: #define M_PI 3.14159265358979323846), then I suggest we define
our own high precision value of pi (let's say #define KICAD_PI
SOME_RIDICULOUSLY_PRECISE_VERSION_OF_PI_LIKE_BOOST) and use it
everywhere.  Please let me know what you think and I will make the changes.

Regards,

Wayne

_______________________________________________
Mailing list: https://launchpad.net/~kicad-developers
Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp




Follow ups

References