Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!stanford.edu!agate!ucbvax!informatics.wustl.edu!sbc From: sbc@informatics.wustl.edu (Steve Cousins) Newsgroups: comp.soft-sys.andrew Subject: wierd behavior Message-ID: <9105161920.AA02290@informatics.WUstl.EDU> Date: 16 May 91 19:20:33 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 61 I'm having a lot of trouble tracking down a bug, which only comes up when my code is linked in to ATK. The following program works fine: #include main() { int bigN = 4181; int ndocs = 4; double log_val; log_val = log((double)bigN/(double)ndocs); printf("log(%f/%f) = %f or %f\n", (double)bigN, (double)ndocs, log_val, log((double)bigN/(double)ndocs)); } when compiled with "cc foo.c -lm" or with "gcc foo.c -lm" on either a Sparcstation 330 with SunOS 4.1 or a Sparcstation 470 with SunOS 4.1.1. (I've tried all the experiments I'll describe on both of these platforms). When I include this code segment in an ATK program, things act very strangly. The correct answer is: log(4181.000000/4.000000) = 6.952011 or 6.952011 From the ATK version I get log(4181.000000/4.000000) = 1072715008.000000 or 1.020752 and if (in the ATK version) I move that calculation of the log from the last arg to printf to the first argument after the control string, I get: log(1.020752/0.000000) = 0.000000 or -0.000000 This tells me that maybe log is returning something of a different length than the C compiler thinks. Anyway, it's very frustrating because I got the code to work standalone, but can't seem to embed it in the ATK application. My Imakefile has the line: DynamicMultiObject(searchv.do, searchv.o, /usr/desert/sybase/lib/libsybdb.a, -lm) which generates the commands: rm -f searchv.o cc -c -I. -I/usr/desert/sybase/include/ -g -I/usr/andrew/include/atk -I/usr/andrew/include -I//usr/include/X11 searchv.c /usr/desert/sybase/include//sybfront.h: 164: MAX redefined /usr/desert/sybase/include//sybfront.h: 165: MIN redefined /usr/andrew/bin/makedo -g -d /usr/andrew/lib -b /usr/andrew/bin -o searchv.do searchv.o /usr/desert/sybase/lib/libsybdb.a -lm doindex: indexing searchv.do ...OK doindex: Writing index file...Done Can anyone see anything I'm doing that's obviously wrong? What version of "log" is getting called? Any help is appreciated, as I'm at a loss as to how to proceed at this point. Thanks Steve Cousins Medical Informatics Laboratory Washington University St. Louis, MO