This took me embarrassingly long to figure out. It turns out that the function roundf doesn't appear in the system header files. The man pages clearly state that it's in math.h, but grepping around in /usr/include and subdirs turns up nothing, and compiling to get preprocessor output shows that it isn't defined anywhere in anything included by math.h. gcc -v Reading specs from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.4/specs Configured with: /var/tmp/portage/gcc-3.3.4-r1/work/gcc-3.3.4/configure --prefix=/usr --bindir=/usr/i686-pc-linux-gnu/gcc-bin/3.3 --includedir=/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.4/include --datadir=/usr/share/gcc-data/i686-pc-linux-gnu/3.3 --mandir=/usr/share/gcc-data/i686-pc-linux-gnu/3.3/man --infodir=/usr/share/gcc-data/i686-pc-linux-gnu/3.3/info --enable-shared --host=i686-pc-linux-gnu --target=i686-pc-linux-gnu --with-system-zlib --enable-languages=c,c++,f77,java --enable-threads=posix --enable-long-long --disable-checking --disable-libunwind-exceptions --enable-cstdio=stdio --enable-version-specific-runtime-libs --with-gxx-include-dir=/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.4/include/g++-v3 --with-local-prefix=/usr/local --enable-shared --enable-nls --without-included-gettext --x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib --enable-interpreter --enable-java-awt=xlib --with-x --disable-multilib --enable-__cxa_atexit --enable-clocale=generic Thread model: posix gcc version 3.3.4 20040623 (Gentoo Linux 3.3.4-r1, ssp-3.3.2-2, pie-8.7.6) (I would have set the severity to "minor", except it was so frustrating that I decided to leave it at "normal". If someone else wishes to change it, please feel free to do so.) Reproducible: Always Steps to Reproduce: emerge info Portage 2.0.51-r3 (default-x86-2004.2, gcc-3.3.4, glibc-2.3.4.20040808-r1, 2.6.9-gentoo-r1 i686) ================================================================= System uname: 2.6.9-gentoo-r1 i686 Intel(R) Pentium(R) 4 CPU 1.80GHz Gentoo Base System version 1.4.16 distcc 2.16 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [enabled] Autoconf: sys-devel/autoconf-2.59-r5 Automake: sys-devel/automake-1.8.5-r1 Binutils: sys-devel/binutils-2.14.90.0.8-r1 Headers: sys-kernel/linux-headers-2.4.21-r1 Libtools: sys-devel/libtool-1.5.2-r5 ACCEPT_KEYWORDS="x86" AUTOCLEAN="yes" CFLAGS="-O3 -march=pentium4 -mmmx -msse -msse2 -mfpmath=sse -fprefetch-loop-arrays -fforce-addr -fomit-frame-pointer -pipe" CHOST="i686-pc-linux-gnu" COMPILER="" CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config /usr/kde/3.3/env /usr/kde/3.3/share/config /usr/kde/3.3/shutdown /usr/kde/3/share/config /usr/lib/mozilla/defaults/pref /usr/share/config /var/qmail/control" CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d" CXXFLAGS="-O3 -march=pentium4 -mmmx -msse -msse2 -mfpmath=sse -fprefetch-loop-arrays -fforce-addr -fomit-frame-pointer -pipe" DISTDIR="/usr/portage/distfiles" FEATURES="autoaddcvs ccache distcc distlocks sandbox" GENTOO_MIRRORS="http://gentoo.binarycompass.org http://gentoo.mirror.sdv.fr http://www.gigaload.org/gentoo.org/ http://ftp.easynet.nl/mirror/gentoo/" MAKEOPTS="-j4" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="" SYNC="rsync://rsync.gentoo.org/gentoo-portage" USE="X Xaw3d aalib acpi aim alsa apache2 apm arts audiofile avi bash-completion berkdb bitmap-fonts bmp bonobo bzlib calendar cdr crypt cups dga dio directfb divx4linux doc emacs emacs-w3 encode esd evo f77 f90 fbcon foomaticdb fortran ftpgb gcj gd gdbm ggi gif gnome gpm gtk gtk2 gtkhtml icq imagemagick imlib innodb jabber java jpeg kde ldap lesstif libg++libgda libwww mad mikmod mime mmap mmx motif mozilla mpeg mpi msn msqli mysql ncurses nls offensive oggvorbis openal opengl oss pam pcre pdflib perl php pie png postgres ppds python qt quicktime readline ruby scanner sdl session shared sharedmem slang sockets spell spl sse ssl svg svga tcltk tcpd theora tiff truetype unicode usb wxwindows x86 xml xml2 xmms xslt xv xvid yahoo zlib"
I'm pretty sure it's defined by the macros in bits/mathcalls.h, which is included by math.h What's the error you have?
There is no roundf defined in bits/mathcalls.h on my system. Someone else I was talking to reported the same problem with Debian (Or was it Mandrake? I forget.), just FYI. I don't know whether the headers come from GCC or some other package, so I don't know whom to blame. :) I don't get any errors. The program simply produces incorrect output. If I declare my own roundf prototype, then everything works correctly, so we're simply missing the prototype from the header file.
Please use -D_GNU_SOURCE to get this prototype from math.h. fex: gcc -D_GNU_SOURCE -E /usr/include/math.h|grep roundf
I wouldn't be so hasty to close the bug. It appears, perhaps, that the bug isn't in the header files but rather in the man pages which neglect to mention that you have to define _GNU_SOURCE in order to get access to that prototype. Who deals with "man page bugs"?
it depends ... is the manpage part of glibc or sys-apps/man-pages
Is this an acceptable fix for you? diff -ur man-pages-2.00/man3/round.3 man-pages-2.00.new/man3/round.3 --- man-pages-2.00/man3/round.3 2004-11-16 11:01:14.000000000 +0000 +++ man-pages-2.00.new/man3/round.3 2005-01-05 17:43:28.937566536 +0000 @@ -28,7 +28,11 @@ .B #include <math.h> .sp .BI "double round(double " x ); -.br +.sp 2 +.B #define _GNU_SOURCE +.sp +.B #include <math.h> +.sp .BI "float roundf(float " x ); .br .BI "long double roundl(long double " x );
added to 2.01 w/out rev bump thanks guys