gr@watcgl.UUCP (Gr Teaching Package) (03/12/85)
Students in one of my courses are using Pascal under Berkeley 4.2. They need to access several functions in the math library, but there doesn't seem to be an efficient, warning free technique. It seems that ``pc'' knows about the ``libm.a'' functions because it gives a duplicate definition warning if one defines such a function as external as is normally done for user-defined, external procedures. In spite of the warning, the math routine is linked correctly. If the external definition is omitted, ``pc'' generates an error message about the undefined function. I know of 2 methods to get around the warning: 1) Call an intermediate C function, ``foo'' that calls the appropriate math library routine. 2) Simulate the math routine in Pascal. Unfortunately this won't work for a function like ``pow(x,y)'' because its internal code sets a PSW flag (via an asm directive) to ignore underflow (generated when 0<x<1 and y is quite large). Is there a clean, efficient solution to this problem, or will we have to live with the warning messages? Why does ``pc'' check ``libm.a'' definitions when it seemingly won't let the user call its functions directly?