Click here to Skip to main content
15,893,486 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Resolution for Dialog Pin
Moak5-Jan-10 23:36
Moak5-Jan-10 23:36 
AnswerRe: Resolution for Dialog Pin
beko6-Jan-10 1:44
beko6-Jan-10 1:44 
AnswerRe: Resolution for Dialog Pin
SimonSays6-Jan-10 5:08
SimonSays6-Jan-10 5:08 
Questionhow to get Window name from window handle in win32. Pin
V K 25-Jan-10 19:22
V K 25-Jan-10 19:22 
AnswerRe: how to get Window name from window handle in win32. Pin
Naveen5-Jan-10 19:43
Naveen5-Jan-10 19:43 
QuestionToolTip Pin
S p k 5215-Jan-10 18:48
S p k 5215-Jan-10 18:48 
AnswerRe: ToolTip Pin
April Fans6-Jan-10 19:16
April Fans6-Jan-10 19:16 
QuestionDefault Button Pin
Pryabu5-Jan-10 17:48
Pryabu5-Jan-10 17:48 
AnswerRe: Default Button Pin
Chris Losinger5-Jan-10 17:52
professionalChris Losinger5-Jan-10 17:52 
GeneralRe: Default Button Pin
Pryabu5-Jan-10 17:58
Pryabu5-Jan-10 17:58 
AnswerRe: Default Button Pin
S p k 5215-Jan-10 18:43
S p k 5215-Jan-10 18:43 
QuestionRe: Default Button Pin
David Crow6-Jan-10 2:52
David Crow6-Jan-10 2:52 
Questiontruncating float Pin
EmbdedCguru5-Jan-10 17:13
EmbdedCguru5-Jan-10 17:13 
AnswerRe: truncating float Pin
Tim Craig5-Jan-10 17:41
Tim Craig5-Jan-10 17:41 
AnswerRe: truncating float Pin
Chris Losinger5-Jan-10 17:54
professionalChris Losinger5-Jan-10 17:54 
AnswerRe: truncating float Pin
«_Superman_»5-Jan-10 19:16
professional«_Superman_»5-Jan-10 19:16 
AnswerRe: truncating float Pin
beko5-Jan-10 19:49
beko5-Jan-10 19:49 
Hello

i use the following in order to truncate a double value (found somewhere and modified Smile | :) )
However you must be careful in here, because there could be an overflow in double fac = Num/Seed

#include <math.h>
#include <stdio.h>


double truncate(double Num, double Seed)
{
	 // get rational factor
    double fac = Num / Seed;

    // get natural factor
    fac = (fac < 0) ? (ceil(fac)) : (floor(fac));
	// fac = (fac < 0) ? static_cast<int>(fac-0.5) : static_cast<int>(fac+0.5);

    // return multiple
    return fac * Seed;
}

int main()
{
	double val = 4./3.;

	printf("%6.4f\n",truncate(val,1e-04));

	return 0;
}

QuestionUsing Managed Code in C++ Pin
Expert Coming5-Jan-10 9:35
Expert Coming5-Jan-10 9:35 
AnswerRe: Using Managed Code in C++ Pin
CPallini5-Jan-10 11:46
mveCPallini5-Jan-10 11:46 
AnswerRe: Using Managed Code in C++ Pin
«_Superman_»5-Jan-10 15:56
professional«_Superman_»5-Jan-10 15:56 
QuestionSleep less than 1 ms Pin
Adnan Merter5-Jan-10 8:50
Adnan Merter5-Jan-10 8:50 
AnswerRe: Sleep less than 1 ms Pin
Nemanja Trifunovic5-Jan-10 9:14
Nemanja Trifunovic5-Jan-10 9:14 
AnswerRe: Sleep less than 1 ms Pin
Cedric Moonen5-Jan-10 9:15
Cedric Moonen5-Jan-10 9:15 
GeneralRe: Sleep less than 1 ms Pin
Adnan Merter5-Jan-10 9:17
Adnan Merter5-Jan-10 9:17 
GeneralRe: Sleep less than 1 ms Pin
Cedric Moonen5-Jan-10 9:20
Cedric Moonen5-Jan-10 9:20 

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.