
Hi Carter,
Thank you for your help, but I can confirm that this is not due to floating point errors. My own hunch is that it is due to the way I am using random number generation from System.Random.MWC. To check it I wrote a version of mkNetwork function using random number generation from System.Random and it works fine with optimizations turned on. So any ideas why optimizations are messing with System.Random.MWC?
Azeem
From: carter.schonwald@gmail.com
Date: Fri, 15 Mar 2013 17:09:36 -0400
Subject: Re: [Haskell-cafe] Optimization flag changing result of code execution
To: azeeem@live.com
CC: haskell-cafe@haskell.org
Hey Azeem,have you tried running the same calculation using rationals? Theres some subtleties to writing numerically stable code using floats and doubles, where simple optimizations change the orders of operations in ways that *significantly* change the result. In this case it looks like you're averaging the averages, which i *believe* can get pretty nasty in terms of numerical precision. Rationals would be a bit slower, but you could then sort out which number is more correct.
On Fri, Mar 15, 2013 at 4:07 PM, Azeem -ul-Hasan