On Wed, Apr 30, 2008 at 3:30 PM, Johan Grönqvist
<firstname.lastname@example.org> wrote: > I have a program that, in many situations, seems to produce reasonable
Seeing the program would most likely help. Without it, others can only guess.
> In order to debug, I compile with -const 'Exn.keepHistory true', but then
> no unhandled exception is raised, and the program keeps runing happily.
The option does change the produced code. I would not find it
surprising if the option could change floating point results on the
x86 without the -ieee-fp true option.
> Thus, I conclude that commenting out unused code
> alters the program behaviour.
Based on your description, it does not seem strictly unused. MLton is
a whole-program compiler and commenting out code can change the
results of some program transformations. For example, if you have a
function that is initially called from two or more places and you then
delete all but one call to the function, then the function may become
a subject for a number of optimizations. This can change, for
example, register allocation and might change floating point results.
> Side note: As I do not use any kind of random numbers,
> I am also puzzled by the fact that I get different numerical answers
> depending on compiler options.
One possibility would be floating point imprecision. Have you tried
compiling with -ieee-fp true? The numerical values of "Energy"
(3.01984609884E~20 and 9.3088938774E~21) are near the extended
precision limit and might suggest that floating point issues are to
blame. If that is the case, then you might need to rethink the
This message was posted to the following mailing lists: