Bug #632
closedupdate libm for improved C99 compatibility
0%
Description
Based on various research into C99 & various libm implementations,
it seems that the dragonfly libm is missing a few functions available
elsewhere, including but not limited to:
- trunc, truncf
- nan, nanf, nanl
- log2 log2f
...
Discussion started based on missing trunc() function,
noted to be in C99 section 7.12.9.8:
"The trunc functions round their argument to the integer value, in
floating format, nearest to but no larger in magnitude than the argument."
The functions listed above were added to NetBSD's library
since the DragonFly copy was merged, as of the versions
below:
http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libm/shlib_version
(available, $NetBSD$ v1.8)
although based on a quick glance at:
http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libm/src/s_floor.c
(available, $NetBSD$ v1.11)
http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libm/src/s_trunc.c
(available, $NetBSD$ v1.2)
http://www.netlib.org/fdlibm/fdlibm.h
(not-available, /* @(#)fdlibm.h 1.5 04/04/22 */ )
and
http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/msun/src/s_trunc.c
(available, $FreeBSD$ v1.1)
It looks like trunc() was a fresh implementeation for FBSD 5 using
a similar structure (and misnamed header) from the s_floor.c
which was subsequently brought in to netbsd since 3.x release
According to Matt, Gnu seems to have a clean 4-line
implementation done in 2005:
http://gcc.gnu.org/ml/fortran/2005-05/msg00227.html
Ideally the 'fix' would implement most or all of C99's math
functions, perhaps more realistically implementing a subset and
documenting the current level of coverage
Updated by pavalos over 17 years ago
log2: http://leaf.dragonflybsd.org/mailarchive/commits/2007-06/msg00159.html
trunc: http://leaf.dragonflybsd.org/mailarchive/commits/2007-06/msg00178.html
nan: http://leaf.dragonflybsd.org/mailarchive/commits/2007-06/msg00197.html
I'm not saying that we are C99 compliant in libm, but we're at least up-to-
date with NetBSD.
Updated by c.turner over 17 years ago
Good stuff - I hadn't got around to another audio-apps build attempt, so
it hadn't bugged me again yet :)
Perhaps now some more things will build ..
Thanks,
- Chris
Updated by dillon over 17 years ago
:Peter Avalos wrote:
:> I'm not saying that we are C99 compliant in libm, but we're at least up-to-
:> date with NetBSD.
:
:Good stuff - I hadn't got around to another audio-apps build attempt, so
:it hadn't bugged me again yet :)
:
:Perhaps now some more things will build ..
:
:Thanks,
:
:- Chris
A lot of the work on the code base winds up being 'maintainance' like
this. It does make our jobs a lot easier down the road when we decide
to take that final step to actual conformance.
It's also a good way to break up a large coding job into smaller more
easily handled pieces. Once you get rid of all the easy-to-do
low-hanging fruit the hard bits will seem less hard.
-Matt
Matthew Dillon
<dillon@backplane.com>
Updated by c.turner over 17 years ago
Peter Avalos wrote:
Can't quite remember at this point.. I believe it was 'chuck':
http://chuck.cs.princeton.edu/
like I said, need to make another pass at the sound apps,
didn't mean to imply your commit broke anything, haven't updated yet
myself :)
Thanks,
- Chris