Re: [Dev-C++] Numerical Difference betewen Dev-Cpp and Microsoft C++.NET
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Per W. <pw...@ia...> - 2003-01-09 20:52:15
|
I don't know about the .Net edition, but in Developer C++ 6.0, there is a compiler switch /Op to "improve float consistency". What it does, is that all intermediate floating point results are written down to a float or double variable and then reloaded again into the floating point processor, to make sure that the application doesn't "take advantage" of the 80 bits of precision (long double on some compilers) used internally by the x87 floating point unit. Since this switch is normally not set - setting it results in slower and larger code - heavily inlined float or double code will be a bit more exact that on some other compilers. If you use long double, you might use powl instead. It's defined as long double powl(long double,long double) However, a numerically stable iterative algorithm should normally converge anyway, or the algorithm isn't suitable for the required task. /Per W On Wed, 8 Jan 2003, Lu=EDs Br=E1s wrote: > Hi there=85 > > I=92ve just finished developing an mathematical > optimization program > in C++ for my Thesis. My base compiler that was > installed in my university was Microsoft Visual > C++.Net. Now I=92m trying to compile with Dev-Cpp in my > computer at home . The results were the same, until > my example 23, failed to converge in Dev-Cpp. When > dealing with math every decimal counts. And this is > the problem. The results are the following: > > ---------------------------------- > Iteration function > error > next step > > --------NET-----------------------------DEV---------- > > 0 6.08269457903887380000 6.08269457903887380000 > 14.38658488183035000000 14.38658488183034500000 > 1.00000000000000000000 1.00000000000000000000 > > 1 6.08269457903887380000 6.08269457903887380000 > 14.38658488183035000000 14.38658488183034500000 > 0.15334071686133940000 0.15334071686133718000 > > 2 5.64283384487765800000 5.64283384487766430000 > 11.71651970320963600000 11.71651970320965800000 > 0.23998975404550715000 0.23998975404523476000 > > 3 5.29623368056405490000 5.29623368056461440000 > 9.25439173550483750000 9.25439173550664760000 > 0.13589203600495686000 Error. > > As you can in iteration 3 the program fails. I know > that is difficult to find the problem just by looking > at numbers!! The difference is always in the last > decimal places (>12). > > I use templates in all class=92s and it=92s being > initialize with double. My compilation options are > default. My computer is a Pentium 3. I think its > probably the double that has different > decimal places? I=92ve changed to (long double) but the > function pow in math doesn=92t accept anything > different from double. Even converting to double > the results are the same. > > Thanks in advance for any help. > > P.S. Sorry for my bad English > > > =3D=3D=3D=3D=3D > +=3D+=3D+=3D+=3D+=3D+=3D+=3D+=3D+=3D+=3D+=3D+=3D+=3D+=3D+=3D+=3D+=3D+=3D+= =3D+=3D+=3D+=3D+=3D+=3D+=3D+=3D+=3D+=3D+=3D+=3D > Lu=EDs Filipe Delgado Br=E1s > lf...@ya... > http://www.fotopt.net/autor.asp?autor=3D2637 > +=3D+=3D+=3D+=3D+=3D+=3D+=3D+=3D+=3D+=3D+=3D+=3D+=3D+=3D+=3D+=3D+=3D+=3D+= =3D+=3D+=3D+=3D+=3D+=3D+=3D+=3D+=3D+=3D+=3D+=3D > > __________________________________________________ > Do you Yahoo!? > Yahoo! Mail Plus - Powerful. Affordable. Sign up now. > http://mailplus.yahoo.com > > > ------------------------------------------------------- > This SF.NET email is sponsored by: > SourceForge Enterprise Edition + IBM + LinuxWorld =3D Something 2 See! > http://www.vasoftware.com > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |