Mail Archives: djgpp/2001/08/15/10:00:03
>
> > Is it possible that RedHat's gcc compile with a somewhat implicit option
> > that is not enabled on other versions?
>
> *Everything* is possible. Even more so since you still didn't show
> even a single line of source code yet. To see the options GCC actually
> uses while compiling, add switches '-v' and '-Q' to the compiler
> flags.
>
> > The main strange thing is that, after the 11th iteration, both programs
> > produce equal results (until the last decimal)
I'm also running big iterative simulations with MATLAB and C code compiled
with DJGPP. I don't believe the compiler is at fault here. There are a few
numerical
issues to consider when using C code. For example, what kind of rounding are
you
using (this is one likely issue since iterative algorithms are particularly
suceptable
to this kind of issue). Do you use transcendental functions such as erfc or
other?
These are implemented in libm as curve fits that may differ on the last few
decimals
depending on which implementation of the library you link with. What kind on
arithmetic precision do you use? I've noticed in my case that after 100
iterations of
what I do the results are different depending on whether I use float, double
or long double precision. MATLAB uses double, so if you want to repeat that
behaviour, you should too. Do you use the -ffast-math and -ffloat-no-store
options? These will also change your numerical behaviour. Do you use random
numbers? There are many issues
with generating random numbers. A 32-bit random integer isn't necessarily a
good
choice to create a "random" double in the range [0-1] since you can't make
the
last 20 or so binary digits of the mantissa "random".
Cheers,
Patrick
- Raw text -