Click here to Skip to main content
15,900,325 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: project Pin
Software_Developer28-Jan-12 3:39
Software_Developer28-Jan-12 3:39 
AnswerRe: project Pin
Chris Losinger29-Jan-12 15:51
professionalChris Losinger29-Jan-12 15:51 
QuestionSetCursor position Pin
manju 327-Jan-12 23:22
manju 327-Jan-12 23:22 
AnswerRe: SetCursor position Pin
David Crow28-Jan-12 4:18
David Crow28-Jan-12 4:18 
Questionretreving application name using file extension Pin
VCProgrammer27-Jan-12 22:35
VCProgrammer27-Jan-12 22:35 
AnswerRe: retreving application name using file extension Pin
David Crow28-Jan-12 4:25
David Crow28-Jan-12 4:25 
QuestionEstablishing a Certification Authority Pin
Bram van Kampen27-Jan-12 14:32
Bram van Kampen27-Jan-12 14:32 
Questionproblem with conversion of string to float Pin
materatsu27-Jan-12 12:22
materatsu27-Jan-12 12:22 
I am currently having this problem using this:

C++
LPCSTR numStr = "128.40";

float num = 0.0;
 wstringstream stream;	
 stream<<setprecision(2);
 stream<<setiosflags(ios_base::fixed);
 stream<<numStr;
 stream>>num;


i am getting 128.3999 in num, this happens in 128.3, 128.2, 128.1, and any number over 128 with decimal x.1,x.2,x.3,x.4, but does not happens in numbers under 128.

I have just tested another numbers and this happens until 511.4 it gives me 511.3999 but with 512.1 it gives me 512.100001, after 512 all numbers give me that, the same behaviour maybe is repeated again later in series.

Just have tested the function atof and _tstof and both fail.

What do i am missing here, how to solve this issue??Confused | :confused:
AnswerRe: problem with conversion of string to float Pin
«_Superman_»27-Jan-12 16:02
professional«_Superman_»27-Jan-12 16:02 
AnswerRe: problem with conversion of string to float Pin
gebri28-Jan-12 0:35
gebri28-Jan-12 0:35 
AnswerRe: problem with conversion of string to float Pin
Bram van Kampen28-Jan-12 14:27
Bram van Kampen28-Jan-12 14:27 
AnswerRe: problem with conversion of string to float Pin
materatsu30-Jan-12 5:51
materatsu30-Jan-12 5:51 
GeneralRe: problem with conversion of string to float Pin
David Crow30-Jan-12 6:46
David Crow30-Jan-12 6:46 
GeneralRe: problem with conversion of string to float Pin
Stefan_Lang31-Jan-12 2:28
Stefan_Lang31-Jan-12 2:28 
QuestionDetecting if process is killed. Pin
Code-o-mat27-Jan-12 11:29
Code-o-mat27-Jan-12 11:29 
AnswerRe: Detecting if process is killed. Pin
Richard Andrew x6427-Jan-12 12:08
professionalRichard Andrew x6427-Jan-12 12:08 
GeneralRe: Detecting if process is killed. Pin
Code-o-mat27-Jan-12 21:52
Code-o-mat27-Jan-12 21:52 
GeneralRe: Detecting if process is killed. Pin
jschell28-Jan-12 4:25
jschell28-Jan-12 4:25 
GeneralRe: Detecting if process is killed. Pin
Code-o-mat28-Jan-12 7:59
Code-o-mat28-Jan-12 7:59 
AnswerRe: Detecting if process is killed. Pin
Randor 28-Jan-12 4:59
professional Randor 28-Jan-12 4:59 
GeneralRe: Detecting if process is killed. Pin
Code-o-mat28-Jan-12 10:49
Code-o-mat28-Jan-12 10:49 
GeneralRe: Detecting if process is killed. Pin
Randor 28-Jan-12 11:59
professional Randor 28-Jan-12 11:59 
GeneralRe: Detecting if process is killed. Pin
Code-o-mat28-Jan-12 23:33
Code-o-mat28-Jan-12 23:33 
GeneralRe: Detecting if process is killed. Pin
Randor 29-Jan-12 11:03
professional Randor 29-Jan-12 11:03 
GeneralRe: Detecting if process is killed. Pin
Code-o-mat1-Feb-12 3:03
Code-o-mat1-Feb-12 3:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.