[Libreoffice] [PATCH] Remove duplicated constant F_PI and friends

Michaël Lefèvre lefevre00 at yahoo.fr
Wed Mar 16 02:47:56 PDT 2011


Actually not tested :(
Just keep compiling.

Solar.h
#define F_PI 3.14159265358979323846

And ftools.h
#define F_PI M_PI

M_PI defined in OdgExporter.cxx as
#define M_PI 3.14159265358979323846

Same values.

The value changed in the other constants F_PI*. In solar.h, these are
fixed, where in ftools.h, they are compute.

By the way, don't know yet how to test it. Just started to hack on LO.
Any advice more than welcome.

Michaël

On Wed, Mar 16, 2011 at 10:04 AM, Cedric Bosdonnat
<cedric.bosdonnat.ooo at free.fr> wrote:
> Hi Michael,
>
> Did you test that your patches didn't introduce a regression? As the two
> F_PI constants don't have the same value, some bugs can be introduced by
> using a more precise value.
>
> I'll try to have a look at it before the end of the week, many thanks
> for your patches!
>
> On Tue, 2011-03-15 at 23:43 +0100, Michael Lefevre wrote:
>> Easy hack, constants already defined in libs-gui/basegfx/inc/basegfx/numeric/ftools.hxx
>> ---
>>  tools/inc/tools/solar.h |   26 --------------------------
>>  1 files changed, 0 insertions(+), 26 deletions(-)
>>
>> diff --git a/tools/inc/tools/solar.h b/tools/inc/tools/solar.h
>> index 1c1c6ab..e8034b0 100644
>> --- a/tools/inc/tools/solar.h
>> +++ b/tools/inc/tools/solar.h
>> @@ -177,32 +177,6 @@ inline void      DoubleToSVBT64( double n, SVBT64 p ) { p[0] = ((BYTE*)&n)[7];
>>  #endif
>>  #endif
>>
>> -
>> -/*** standard floating point definitions *******************************/
>> -
>> -#ifndef F_PI
>> -#define F_PI         3.14159265358979323846
>> -#endif
>> -#ifndef F_PI2
>> -#define F_PI2                1.57079632679489661923
>> -#endif
>> -#ifndef F_PI4
>> -#define F_PI4                0.785398163397448309616
>> -#endif
>> -#ifndef F_PI180
>> -#define F_PI180      0.01745329251994
>> -#endif
>> -#ifndef F_PI1800
>> -#define F_PI1800     0.001745329251994
>> -#endif
>> -#ifndef F_PI18000
>> -#define F_PI18000    0.0001745329251994
>> -#endif
>> -#ifndef F_2PI
>> -#define F_2PI                6.28318530717958647694
>> -#endif
>> -
>> -
>>  /*** standard macros *****************************************/
>>
>>  #define SWAPSHORT(x) ((((x) >> 8) & 0x00FF) | (((x) & 0x00FF) << 8))
>
> --
> Cédric Bosdonnat
> LibreOffice hacker
> http://documentfoundation.org
> OOo Eclipse Integration developer
> http://cedric.bosdonnat.free.fr
>
>


More information about the LibreOffice mailing list