This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: improve math.h


Patrick Mansfield <patmans <at> us.ibm.com> writes:

> 
> On Wed, May 16, 2007 at 06:31:06AM -0600, Eric Blake wrote:
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> > 
> > I still don't have frexpl working, but thought I would ask if I can commit
> > this in the meantime.
> > 
> > 2007-05-16  Eric Blake  <ebb9 <at> byu.net>
> > 
> > 	* libc/include/math.h (INFINITY, NAN, FP_ILOGB0, FP_ILOGBNAN)
> > 	(MATH_ERRNO, MATH_ERREXCEPT, math_errhandling): Add macros
> > 	required by POSIX.
> 
> Are you going to add usage of FP_ILOGB in s_ilogb.c and sf_ilogb.c?

I actually set the value of those macros based on reading the current 
implementation of s*ilogb.c.  I wasn't planning on changing the implementation, 
so much as documenting the behavior that it already has.

> > - #ifndef HUGE_VAL
> > -  #define HUGE_VAL (__builtin_huge_val())
> > - #endif
> > +# ifndef HUGE_VAL
> > +#  define HUGE_VAL (__builtin_huge_val())
> > +# endif
> 
> Is the white space "#<space>directive" intentional (above and below)?

Yes.  My understanding is that strict C89 compliance requires the # be in the 
leading column, and not indented, so the above portion of the hunk is 
technically a bug fix.  Just because most preprocessors accept whitespace prior 
to # doesn't mean we should make a habit of it.  Meanwhile, the spacing between 
# and the preprocessor token is standards-compliant, so I have picked up on the 
GNU coding standard style of using that whitespace for indentation purposes, to 
make it easier to spot the extent of conditional blocks when reading nested 
ifdef'd code.

> I
> don't see that anywhere else in math.h. I am not sure what coding standard
> is supposed to be followed in newlib, and don't care as long as we are
> consistent.

I agree that newlib is a hodgepodge of styles, and I generally try to follow 
the existing style of a file when it makes sense.

-- 
Eric Blake




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]