User forums > Using Code::Blocks

Change float in calculation and display

(1/2) > >>

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:

--- Code: ---if (a < 4.5675023e-10)
{
}
--- End code ---
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.

--- End quote ---
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:
Code::Blocks IS NOT a Compiler!!!
http://wiki.codeblocks.org/index.php?title=FAQ#Q:_What_Code::Blocks_is_not.3F

Tim S.

21did21:

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

--- End quote ---

it include a compiler...

thnak you all for your help

see you

Navigation

[0] Message Index

[#] Next page

Go to full version