Bug in NR_QROMB? [message #3522] |
Sun, 05 February 1995 12:49  |
mallozzi
Messages: 60 Registered: August 1994
|
Member |
|
|
Hi all,
I needed to compute an integral, and the integrand itself contained a
second integral, so I wrote a simple program to test this case using
the IDL-supplied NR_QROMB. In order to use NR_QROMB, you must write a
function that contains the integrand, and then you call NR_QROMB with this
function name as a parameter. In my case, within my first function, I
placed another call to QROMB to evaluate the inner integral (this is not a
double integral), the result of which becomes part of the first integrand.
If I make BOTH calls to NR_QROMB in single or double precision, I get the
wrong result. If I make one call single and the other call double, I get
the correct result. Does anyone know what is happening?
|
|
|
Re: Bug in NR_QROMB? [message #3650 is a reply to message #3522] |
Wed, 08 February 1995 02:34  |
steinhh
Messages: 260 Registered: June 1994
|
Senior Member |
|
|
In article <3h3dku$o5j@hammer.msfc.nasa.gov>, mallozzi@ssl.msfc.nasa.gov writes:
[...snip..]
|>
|> In my case, within my first function, I
|> placed another call to QROMB to evaluate the inner integral (this is not a
|> double integral), the result of which becomes part of the first integrand.
|>
|> If I make BOTH calls to NR_QROMB in single or double precision, I get the
|> wrong result. If I make one call single and the other call double, I get
|> the correct result. Does anyone know what is happening?
|>
I suspect that NR_QROMB is not re-entrant, i.e., it
uses static variables which get corrupted when NR_QROMB is called
from a function that's called by NR_QROMB. I guess all the
NR routines are hardcoded in C, so they come in two versions, one
using double precision and one using single precision. Clearly they
don't use the same static variables.
Quite silly, really. The overhead of using dynamic variables
must be extremely small compared with the overhead of calling the
IDL function, and you wouldn't experience this problem.
And yes, I'd definitely call it a bug, since the "feature" is not
documented. Shouldn't be too hard for RSI to supply a patch, though.
Stein Vidar
|
|
|