Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: 21did21 on May 06, 2011, 05:36:08 pm

Title: Change float in calculation and display
Post by: 21did21 on May 06, 2011, 05:36:08 pm
Hello world,  :P

me and my friend we have the same programm but me with C::B and him with C++ builder.
In our programm we write in a txt files values (order of magnitude: 4.5675e-10 ) but when i compare my result and his results we have a difference:

==> I have 4 (or 5 i don't remember) digits
==> my friend have near 10 digits

how i can solve it? i want to increase the number of digit when i write something with the command "ofstream"
i have test ::setprecision , std::fixed/std::scientific, std::setw
but it don't work ....


during the program we have difference when there is conditions like this:
Code
if (a < 4.5675023e-10)
{
}
So, i don't know if my program round number or if it is just in displaying...? (sometime we haven't the same result with my friend, so i think my compilator is not very accurate?? it's this or a little difference in our programm?)

Can you help me by explanation of your opinion ?
thank you  :D
Title: Re: Change float in calculation and display
Post by: Ceniza on May 06, 2011, 05:45:29 pm
My opinion is that your question has to do with C++ and the STL in the area of stream formatting. For that reason it has absolutely nothing to do with Code::Blocks. There is a huge difference between an IDE and a programming language + its standard library.

In short, your question does not belong here. Please search the web for an answer, or post it in appropriate website.
Title: Re: Change float in calculation and display
Post by: 21did21 on May 06, 2011, 06:02:34 pm
My opinion is that your question has to do with C++ and the STL in the area of stream formatting. For that reason it has absolutely nothing to do with Code::Blocks. There is a huge difference between an IDE and a programming language + its standard library.
In short, your question does not belong here. Please search the web for an answer, or post it in appropriate website.
ok, sorry...

i have asked it because i think that in the compilator of C::B there is a limit for digits and this limit is different that C++Builder... ?
Title: Re: Change float in calculation and display
Post by: stahta01 on May 06, 2011, 06:47:35 pm
Code::Blocks IS NOT a Compiler!!!
http://wiki.codeblocks.org/index.php?title=FAQ#Q:_What_Code::Blocks_is_not.3F

Tim S.
Title: Re: Change float in calculation and display
Post by: 21did21 on May 06, 2011, 07:27:54 pm
Code::Blocks IS NOT a Compiler!!!
http://wiki.codeblocks.org/index.php?title=FAQ#Q:_What_Code::Blocks_is_not.3F
Tim S.

it include a compiler...

thnak you all for your help

see you
Title: Re: Change float in calculation and display
Post by: Jenna on May 06, 2011, 07:52:20 pm
Code::Blocks IS NOT a Compiler!!!
http://wiki.codeblocks.org/index.php?title=FAQ#Q:_What_Code::Blocks_is_not.3F
Tim S.

it include a compiler...

thnak you all for your help

see you
We include a compiler on windows (in one of th etwo install-files) for the users convenience, but we do not answer general progarmming questions in this forum/website.
It's stated clearly in the forum rules (you should have read it before posting), so your violating our forum rules !!
Title: Re: Change float in calculation and display
Post by: 21did21 on May 07, 2011, 06:13:07 pm
It's stated clearly in the forum rules (you should have read it before posting), so your violating our forum rules !!

ok, sorry.