Click here to Skip to main content
15,912,400 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Can I add a menu to a dialog based application? Pin
work_to_live12-Feb-03 9:05
work_to_live12-Feb-03 9:05 
GeneralCImage & Transparency Pin
loading12-Feb-03 8:01
loading12-Feb-03 8:01 
QuestionReliable way to convert float to a double? Pin
Member 9612-Feb-03 7:40
Member 9612-Feb-03 7:40 
AnswerRe: Reliable way to convert float to a double? Pin
Chris Losinger12-Feb-03 7:51
professionalChris Losinger12-Feb-03 7:51 
GeneralRe: Reliable way to convert float to a double? Pin
Member 9612-Feb-03 8:10
Member 9612-Feb-03 8:10 
GeneralRe: Reliable way to convert float to a double? Pin
Chris Losinger12-Feb-03 8:20
professionalChris Losinger12-Feb-03 8:20 
GeneralRe: Reliable way to convert float to a double? Pin
Member 9612-Feb-03 8:30
Member 9612-Feb-03 8:30 
GeneralRe: Reliable way to convert float to a double? Pin
Alvaro Mendez12-Feb-03 9:01
Alvaro Mendez12-Feb-03 9:01 
Hmmmm, I tried your example using my version of round and it gave me 2.7000000000000:

double round(double value, unsigned decimalPlaces)
{
	double scale = pow(10.0, (double)decimalPlaces);
	double temp = value * scale;
 
	temp += (value < 0 ? -0.5 : 0.5);
	return (int)temp / scale;
}


By the way, I also got a compiler warning with the float assignment, so I had to add an "f" to the end of the value to get rid of it:

float fData = 2.7f;


Regards,
Alvaro


All you need in this life is ignorance and confidence, and then success is sure. -- Mark Twain
GeneralRe: Reliable way to convert float to a double? Pin
Member 9612-Feb-03 8:41
Member 9612-Feb-03 8:41 
AnswerRe: Reliable way to convert float to a double? Pin
Tim Smith12-Feb-03 7:52
Tim Smith12-Feb-03 7:52 
GeneralRe: Reliable way to convert float to a double? Pin
Member 9612-Feb-03 7:55
Member 9612-Feb-03 7:55 
GeneralRe: Reliable way to convert float to a double? Pin
Stuart Dootson12-Feb-03 8:29
professionalStuart Dootson12-Feb-03 8:29 
GeneralRe: Reliable way to convert float to a double? Pin
Member 9612-Feb-03 8:37
Member 9612-Feb-03 8:37 
GeneralRe: Reliable way to convert float to a double? Pin
Stuart Dootson12-Feb-03 21:55
professionalStuart Dootson12-Feb-03 21:55 
AnswerThis will work, while ugly... Pin
Abin12-Feb-03 16:58
Abin12-Feb-03 16:58 
Generalmodeless dlg question Pin
ns12-Feb-03 7:17
ns12-Feb-03 7:17 
Generalnevermind...thanks Pin
ns12-Feb-03 7:44
ns12-Feb-03 7:44 
GeneralRe: nevermind...thanks Pin
Joan M12-Feb-03 20:12
professionalJoan M12-Feb-03 20:12 
Generalthanks! Pin
ns13-Feb-03 1:43
ns13-Feb-03 1:43 
Generalcatching file changes Pin
Joao Vaz12-Feb-03 6:41
Joao Vaz12-Feb-03 6:41 
GeneralRe: catching file changes Pin
AlexO12-Feb-03 6:54
AlexO12-Feb-03 6:54 
GeneralRe: catching file changes Pin
Joao Vaz12-Feb-03 7:07
Joao Vaz12-Feb-03 7:07 
GeneralDeriving a template class? Please help. Pin
clintsinger12-Feb-03 6:28
clintsinger12-Feb-03 6:28 
GeneralSolved it! Pin
clintsinger12-Feb-03 6:34
clintsinger12-Feb-03 6:34 
GeneralCString and \r question Pin
LukeV12-Feb-03 6:18
LukeV12-Feb-03 6:18 

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.