News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

Change float in calculation and display

Started by 21did21, May 06, 2011, 05:36:08 PM

Previous topic - Next topic

21did21

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:
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

Ceniza

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.

21did21

Quote from: 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.
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... ?

stahta01

C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

21did21


Jenna

Quote from: 21did21 on May 06, 2011, 07:27:54 PM
Quote from: 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.

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 !!

21did21

Quote from: jens on May 06, 2011, 07:52:20 PM
It's stated clearly in the forum rules (you should have read it before posting), so your violating our forum rules !!

ok, sorry.