Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Adding math functions erf erfc rint round

11 views
Skip to first unread message

Mat Nieuwenhoven

unread,
Oct 27, 2011, 10:01:42 AM10/27/11
to
Hi,

For porting a program from GCC I needed erf() and erfc(). OW's math lib
doesn't include those. If I read right, these are required by C99. I found
a usable implementation on
http://www.velocityreviews.com/forums/t317358-erf-function-in-c.html ,
second posting (2004-02-14) , which lists source from Sun with a permissive
license.
For my ported program this seems to work, it behaves the same as when
compiled with GCC (for Windows). However, I know no tests to verify the
results of these functions.
Should I add the functions from the Sun source to the math lib? The
functions in the source from sun are erf(), erfc(), my source has also
rint() and round(), don't know where they came from. Is the license
acceptable to OW (that module would have a different license than the
rest).

Normally, we want to have those tested too, but I don't know how.
Thoughts please?

Mat Nieuwenhoven

PS prototypes:
double erf(double x);
double erfc(double x);
double rint(double x);
int round(double number);



Fred J. Tydeman

unread,
Oct 27, 2011, 7:04:11 PM10/27/11
to
On Thu, 27 Oct 2011 14:01:42 UTC, "Mat Nieuwenhoven" <mni...@dontincludethis.zap.a2000.nl> wrote:

> PS prototypes:
> double erf(double x);
> double erfc(double x);
> double rint(double x);

Those three are OK.

> int round(double number);

Wrong return type. Should be 'double'.
---
Fred J. Tydeman Tydeman Consulting
tyd...@tybor.com Testing, numerics, programming
+1 (775) 358-9748 Vice-chair of PL22.11 (ANSI "C")
Sample C99+FPCE tests: http://www.tybor.com
Savers sleep well, investors eat well, spenders work forever.

Roald Ribe

unread,
Oct 27, 2011, 8:45:13 PM10/27/11
to
On Thu, 27 Oct 2011 11:01:42 -0300, Mat Nieuwenhoven <mni...@dontincludethis.zap.a2000.nl> wrote:

...

> Should I add the functions from the Sun source to the math lib? The
> functions in the source from sun are erf(), erfc(), my source has also
> rint() and round(), don't know where they came from. Is the license
> acceptable to OW (that module would have a different license than the
> rest).

As long as the license is equally or more permissive than the OW license,
there should be no objections. We have previously included BSD licensed
implemetations in the source tree, but not to the core libraries I think.

Roald
0 new messages