[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Usage of rint() in gui
From: |
Nicola Pero |
Subject: |
Re: Usage of rint() in gui |
Date: |
Thu, 11 Apr 2002 23:20:48 +0100 (BST) |
> >>> Or as this becomes more common now, we could move the replacement
> >>
> >> definition of rint() up into the config.h file itself. Any ideas on
> >> this solution?
> >>
> >
> > Done.
>
>
> Sorry, perhaps my idea wasnt that good. I now did get a compile error,
> because of different difinitions of rint(). This is caused by config.h
> not being protrected againet multiple includes and also by math.h being
> included after config.h. To work around this I did exetent the
> definition of rint in config.h.bot to
> #ifndef HAVE_RINT
> extern double floor(double a);
>
> static double rint(double a)
> {
> return (floor(a+0.5));
> }
> #define HAVE_RINT
> #endif
>
> This now works for me, but results still in a lot of compiler warnings
> as config.h is included into files where rint() is not used, so it is an
> unused variable.
What about simply replacing everywhere rint (x) with floor (x + 0.5) ?