Thread: [Dev-C++] Numerical Difference betewen Dev-Cpp and Microsoft C++.NET
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Luís B. <lf...@ya...> - 2003-01-09 02:55:12
|
Hi there
Ive 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 Im 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 classs and its 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? Ive changed to (long double) but the
function pow in math doesnt 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
=====
+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
Luís Filipe Delgado Brás
lf...@ya...
http://www.fotopt.net/autor.asp?autor=2637
+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
|
|
From: Matthews <dem...@uw...> - 2003-01-09 13:36:36
|
Actually, there's a few small changes in the decimals besides iteration 3. And your's is the best english I've heard in a while :) At 06:55 PM 08/01/2003 -0800, Lu=EDs" "Br=E1s wrote: >Hi there=85 > >I=92ve just finished developing an mathematical >optimization program=20 >in C++ for my Thesis. My base compiler that was >installed in my university was Microsoft Visual=20 >C++.Net. Now I=92m trying to compile with Dev-Cpp in my=20 >computer at home . The results were the same, until >my example 23, failed to converge in Dev-Cpp. When=20 >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=20 > 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=20 >that is difficult to find the problem just by looking=20 >at numbers!! The difference is always in the last=20 >decimal places (>12).=20 > >I use templates in all class=92s and it=92s being=20 >initialize with double. My compilation options are=20 >default. My computer is a Pentium 3. I think its=20 >probably the double that has different=20 >decimal places? I=92ve changed to (long double) but the=20 >function pow in math doesn=92t accept anything=20 >different from double. Even converting to double=20 >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 > |
|
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 > |
|
From: Ioannis V. <no...@ho...> - 2003-01-11 21:10:41
|
In MINGW the long double is broken. Also in MINGW (and GCC in general) us= e -ffloat-store.=0D =0D =0D Ioannis Vranos=0D =0D * Programming pages: http://www.noicys.freeurl.com=0D * Alternative URL: http://run.to/noicys =0D -------Original Message-------=0D =0D From: Lu=EDs" "Br=E1s=0D Date: =D0=DD=EC=F0=F4=E7, 9 =C9=E1=ED=EF=F5=DC=F1=E9=EF=F2 2003 4:57:41 =F0= =EC=0D To: dev...@li...=0D Subject: [Dev-C++] Numerical Difference betewen Dev-Cpp and Microsoft C++ NET=0D =0D Hi there?=0D =0D I?ve just finished developing an mathematical=0D optimization program =0D in C++ for my Thesis. My base compiler that was=0D installed in my university was Microsoft Visual =0D C++.Net. Now I?m trying to compile with Dev-Cpp in my =0D computer at home . The results were the same, until=0D my example 23, failed to converge in Dev-Cpp. When =0D dealing with math every decimal counts. And this is=0D the problem. The results are the following:=0D =0D ----------------------------------=0D Iteration function=0D error=0D next step=0D =0D --------NET-----------------------------DEV----------=0D =0D 0 6.08269457903887380000 6.08269457903887380000 =0D 14.38658488183035000000 14.38658488183034500000=0D 1.00000000000000000000 1.00000000000000000000=0D =0D 1 6.08269457903887380000 6.08269457903887380000=0D 14.38658488183035000000 14.38658488183034500000=0D 0.15334071686133940000 0.15334071686133718000=0D =0D 2 5.64283384487765800000 5.64283384487766430000=0D 11.71651970320963600000 11.71651970320965800000=0D 0.23998975404550715000 0.23998975404523476000=0D =0D 3 5.29623368056405490000 5.29623368056461440000=0D 9.25439173550483750000 9.25439173550664760000=0D 0.13589203600495686000 Error.=0D =0D As you can in iteration 3 the program fails. I know =0D that is difficult to find the problem just by looking =0D at numbers!! The difference is always in the last =0D decimal places (>12). =0D =0D I use templates in all class?s and it?s being =0D initialize with double. My compilation options are =0D default. My computer is a Pentium 3. I think its =0D probably the double that has different =0D decimal places? I?ve changed to (long double) but the =0D function pow in math doesn?t accept anything =0D different from double. Even converting to double =0D the results are the same.=0D =0D Thanks in advance for any help.=0D =0D P.S. Sorry for my bad English=0D =0D =0D =3D=3D=3D=3D=3D=0D +=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=0D Lu=EDs Filipe Delgado Br=E1s=0D lf...@ya...=0D http://www.fotopt.net/autor.asp?autor=3D2637=0D +=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=0D =0D __________________________________________________=0D Do you Yahoo!?=0D Yahoo! Mail Plus - Powerful. Affordable. Sign up now.=0D http://mailplus.yahoo.com=0D =0D =0D -------------------------------------------------------=0D This SF.NET email is sponsored by:=0D SourceForge Enterprise Edition + IBM + LinuxWorld =3D Something 2 See!=0D http://www.vasoftware.com=0D _______________________________________________=0D Dev-cpp-users mailing list=0D Dev...@li...=0D TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm=0D https://lists.sourceforge.net/lists/listinfo/dev-cpp-users=20 |