Project

General

Profile

Actions

Bug #632

closed

update libm for improved C99 compatibility

Added by c.turner almost 17 years ago. Updated over 16 years ago.

Status:
Closed
Priority:
Low
Assignee:
Category:
-
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:

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

Actions

Also available in: Atom PDF