arxt@tank.uchicago.edu (patrick palmer) (04/19/89)
I am having vile problems using floating point in Manx C. I am using version 3.4a. (Whether I should stick with Manx and update is one of the questions I am deciding.) I have a fairly simple program which evaluates the Bessel function J1. I wrote a program that tests this function and it works. Then, I wrote an only slightly more complicated program that uses this function, and it produces instant guru's (that is it crashes essentially instantaneously, so I cannot get it to print that it even started). When I copy this progam to a Sun, it compiles and gives the right answers, so I assume that there is nothing wrong with the C code. That pretty much leaves the dreaded compliler and linker options (and things I do not know about, I suppose). I compile it with: cc +L +ff file.c Fine. Then link it with: ln +Q file.o -lm -lc (I know you are supposed to use the 32 bit library with +L, but the last numerical program I wrote would not work linking with -lm32 -lc32. It did not guru, at least, just appeared to run, but produced no output. I linked it as above, and it worked, and I took this to mean that the statment in the Manx documentation that 32 bits are assumed when the floating point options were used was supposed to explain this.) Fine. Then: file -----GURU Since I have floats and doubles, I worry about the linker. Since I know that when I use the cc +L, I should link to the c32 library, I tried to use: ln +Q file.o -lm32 -lc32 Fine, it linked, and gave a slightly bigger program as expected. Then: file ----GURU Then I tried: cc +L +fi file.c ln +Q file.o -lmx -lc32 This produced a program that did not guru, but did not produce any output. Next: cc +L +fi file.c ln +Q file.o -lmx -lc This program actually ran, put produced absurd answers (of the type you get when you get types mixed up). Then, compile as above, and ln +Q file.o -lmx -lc This produces different, but equally absurd answers. Then, compile: cc +fi file.c ln +Q file.o -lmx -lc This produces still another set of absurd answers. Can anyone explain to me some simple rules about how to know what options to compile with and what to use when linking for programs doing numerical tasks? The test program is so close to this evil one that I am extremely puzzled. (I would include them, but I have already taken up more than my share of bandwidth.) Pat Palmer (email: ppalmer@oddjob.uchicago.edu)