[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#171851: More missing math.h prototypes



On Mon, Dec 30, 2002 at 11:19:32AM -0500, H. S. Teoh wrote:
> On Mon, Dec 30, 2002 at 10:57:47AM -0500, Daniel Jacobowitz wrote:
> > On Mon, Dec 30, 2002 at 10:23:16AM -0500, H. S. Teoh wrote:
> > > Hi, I just confirmed that trunc() is missing from /usr/include/math.h.
> > > Furthermore, the following are also missing (referenced from the manpage
> > > of trunc()):
> > > - lrint
> > > - nearbyint
> > > - round
> > > 
> > > Oddly, these functions do *not* appear in the libc info pages. 
> > > Nevertheless, they are definitely in libm: 
> > 
> > How did you confirm that they were not in <math.h>?  Judging from your
> > previous messages, by using cpp or building a test program.  I always
> > recommend actually grepping around in /usr/include for them; it can be
> > enlightening.
> > 
> > Consider this case:
> > #ifdef __USE_ISOC99
> [snip]
> 
> Aha. That explains it. So these functions are only defined for ISO C99?

Yes.  Declaring something named "round" when it isn't part of the
relevant language standard is a bit much, don't you think? :)

> > They are only declared in C99 mode.  I believe that is correct.
> 
> Is this indicated in the docs, though? As far as I can tell, the info
> pages do not indicate that C99 mode is needed to use these functions.

Hmm, I don't see it either.

> > > This is on libc6 2.3.1-8. I'm not sure I understand why they are in the
> > > .so but not in any header files nor in the info docs. Are there some
> > > standard compliance issues here that I'm not aware of?
> > 
> > They're in my copy of the info docs.  Try:
> >   "info libc Arithmetic Arithmetic\ Functions Rounding\ Functions"
> 
> Yeah, I must've been doing something silly when I searched the info pages
> (like using 'n' to find the next match, thinking it's vi. :-P)
> 
> Anyway, this bug now looks like a documentation bug/deficiency. The
> manpages should add #define _ISO_SOURCE (or whatever the proper name was,
> I forgot) for these functions, and the info pages should indicate the C99
> prerequisite as well.

Either -D_GNU_SOURCE or -D_ISOC99_SOURCE (or _ISOC9X_SOURCE or
__STDC_VERSION__=199901L).


-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer



Reply to: