Serving the Quantitative Finance Community

 
User avatar
DevonFangs
Topic Author
Posts: 0
Joined: November 9th, 2009, 1:49 pm

Nan in release mode

September 6th, 2011, 9:17 am

VS 2005 compiler, even with fp: Precise. What else could it be? I suspect it is std::exp.
Last edited by DevonFangs on September 5th, 2011, 10:00 pm, edited 1 time in total.
 
User avatar
Hansi
Posts: 41
Joined: January 25th, 2010, 11:47 am

Nan in release mode

September 6th, 2011, 9:35 am

For what? Everything?
 
User avatar
DevonFangs
Topic Author
Posts: 0
Joined: November 9th, 2009, 1:49 pm

Nan in release mode

September 6th, 2011, 9:38 am

Just just once in a while. The numbers I get in debug where in release there's a nan have nothing peculiar. It could be also some weird library other people pulled into this proj.
 
User avatar
Cuchulainn
Posts: 20254
Joined: July 16th, 2004, 7:38 am
Location: 20, 000

Nan in release mode

September 6th, 2011, 10:13 am

Would that be a QNAN or a SNAN?
Last edited by Cuchulainn on September 5th, 2011, 10:00 pm, edited 1 time in total.
 
User avatar
DevonFangs
Topic Author
Posts: 0
Joined: November 9th, 2009, 1:49 pm

Nan in release mode

September 6th, 2011, 10:15 am

QNAN, sorry.
 
User avatar
Hansi
Posts: 41
Joined: January 25th, 2010, 11:47 am

Nan in release mode

September 6th, 2011, 10:19 am

Did you do a clean rebuild of all the external libraries which might be producing the NaNs when you switched mode?
 
User avatar
DevonFangs
Topic Author
Posts: 0
Joined: November 9th, 2009, 1:49 pm

Nan in release mode

September 6th, 2011, 10:28 am

No. I'll do. Thanks.
 
User avatar
adcockj
Posts: 1
Joined: July 14th, 2002, 3:00 am

Nan in release mode

September 6th, 2011, 2:20 pm

I've seen this with an uninitialised variable, in debug it gets set to 0.0 in release it's whatever was on the stack so can vary. Although these days the comipler warnings usually pick it up.John
 
User avatar
DevonFangs
Topic Author
Posts: 0
Joined: November 9th, 2009, 1:49 pm

Nan in release mode

September 6th, 2011, 2:30 pm

QuoteOriginally posted by: adcockjI've seen this with an uninitialised variable, in debug it gets set to 0.0 in release it's whatever was on the stack so can vary. Although these days the comipler warnings usually pick it up.JohnThanks but no, I've already checked that and it should be fine.
 
User avatar
adcockj
Posts: 1
Joined: July 14th, 2002, 3:00 am

Nan in release mode

September 6th, 2011, 2:58 pm

Other stuff to try, building a release build with all optimizations turned off, if that still fails then most likely its a stack overwritting/uninit var issue that gets uncovered by switching to the release mode, if that works then switch the optimizations on one by one till you find the one that breaks the code.John
 
User avatar
Cuchulainn
Posts: 20254
Joined: July 16th, 2004, 7:38 am
Location: 20, 000

Nan in release mode

September 6th, 2011, 3:40 pm

DF,Here is a discussion that might be related. http://www.wilmott.com/messageview.cfm? ... TABLE=Root cause was log(S/K) when S = 0 in combination with recursive function calls. Quotesome weird library ??
Last edited by Cuchulainn on September 5th, 2011, 10:00 pm, edited 1 time in total.
 
User avatar
zeta
Posts: 26
Joined: September 27th, 2005, 3:25 pm
Location: Houston, TX
Contact:

Nan in release mode

September 6th, 2011, 6:10 pm

can you set something like -fpe0 -traceback ala intel?
 
User avatar
DevonFangs
Topic Author
Posts: 0
Joined: November 9th, 2009, 1:49 pm

Nan in release mode

September 15th, 2011, 3:21 pm

So the question seems tricky. I access those values in two ways: one is via a DLL (imagine something like an XL interface), another by simply writing them as a text file when running the program as an exe.The QNANs are only in the text file, as if the filename << number was the problem. If I turn optim off then it works fine.My filename << number is nested in some sort of complicated loop/ if/ crap, so I'm afraid the compiler optimizes the stuff stupidly, shuffling the order of the << or something.Other ideas?
 
User avatar
DevonFangs
Topic Author
Posts: 0
Joined: November 9th, 2009, 1:49 pm

Nan in release mode

September 15th, 2011, 3:47 pm

OK, let's change the questions. How can I disable optimization of a single block of code? I can use the relevant #pragma optimization, but it doesn't seem to work. Maybe because it's a template class (and I want to *not* optimize one single method of it).
 
User avatar
spv205
Posts: 1
Joined: July 14th, 2002, 3:00 am

Nan in release mode

September 15th, 2011, 5:40 pm

dare I say it- you have to create a small program that recreates the bug and take it from there!