[lug] mishaps with the glibc libraries

George Sexton gsexton at mhsoftware.com
Wed Sep 22 15:15:36 MDT 1999


A lot of the C Standard says that many things are "implementation defined"
which means that a behavior that works correctly with many other machines
will not necessarily work on all machines. Implementations can differ on
these issues and still be compliant with the C Standard.

An example of this would be the fmod() function defined in math.h. The
standard says:

double fmod(double x, double y);

If y is zero, whether a domain error occurs or the fmod function returns
zerio is implementation defined.

Another example is log(double x)

A domain error occurs if the argument is negative. A range error may occur
if the argument is zero.

My advice would be to determine what function is generating the error, along
with the precise inputs to that function and then compare the behavior to
that dictated by the C Standard. A good reference is PJ Plauger's The
Standard C Library.

George Sexton
MH Software, Inc.
Voice: 303 438 9585
Fax: 303 469 9679
URL: http://www.mhsoftware.com

-----Original Message-----
From: lug-admin at lug.boulder.co.us [mailto:lug-admin at lug.boulder.co.us]On
Behalf Of Manny Roque
Sent: Wednesday, September 22, 1999 1:56 PM
To: lug at lug.boulder.co.us
Subject: [lug] mishaps with the glibc libraries


hello all,
    i am currently taking a data structures class and have been running into
some problems with glibc at compile time.
i keep getting segmentation fault errors when i run my executable file, but
when i compile the same code on an HP machine at school it runs fine. before
this i was having problems with the math library. glibc was not handling
floater point arithmetic correctly. this problem was also fixed when i
compiled my source file on one of the non-linux machines at school.
    i enjoy using linux until now. the unpredictable behavior of compiling
code is something i can live with but a faulty library i cannot. i was
wondering if there is a way to fix this problem ?
i am using redhat 6.0 , i looked at their errata list but there is no
mention of this.
btw, when i use borland 5.0 on my nt partition i do not get this problem.
--
Best Wishes,
Manny Roque





More information about the LUG mailing list