Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!lll-winken!xanth!cs.odu.edu!kremer From: kremer@cs.odu.edu (Lloyd Kremer) Newsgroups: comp.lang.c Subject: Re: log function Message-ID: <1991Jun25.133612.2984@cs.odu.edu> Date: 25 Jun 91 13:36:12 GMT References: <1991Jun21.113211@cs.utwente.nl> Sender: news@cs.odu.edu (News File Owner) Organization: Old Dominion University, Norfolk, VA Lines: 35 Nntp-Posting-Host: opium.cs.odu.edu In article <1991Jun21.113211@cs.utwente.nl> stadt@cs.utwente.nl (Richard van de Stadt) writes: > >I get the error message >log: SING error > >when the statement >store_control_parameter (mean / log (1/get_acceptance_ratio_X0())) >is executed. > >Does anybody know what the error message means? > >The same message appears when I split up the statement: >tolog = 1/get_acceptance_ratio_X0(); /* tolog has then value 1.25 */ >loggie = log (tolog); /* now this is the statement that causes the message */ >store_control_parameter (mean / loggie); > SING error is the result of an operation producing a mathematical singularity. For the log() function, a singularity exists for log(0.0). I believe taking the log of a negative number would cause a DOMAIN error rather than SING. So the log() function thinks it's being handed a 0.0 argument. The log() function takes a double and returns a double, yet I see the integral constant "1" in the argument to log in your code. If no prototype is in scope, maybe an integral bit pattern is being passed to log(), which then interprets the pattern as a double representing the value 0.0 . As a first step, I would explicitly cast log's argument to double and see what happens. Passing the type float will not work either unless the compiler does automatic float-to-double promotion or a prototype is in scope. Lloyd Kremer Hilton Systems, Inc. kremer@cs.odu.edu