Click here to Skip to main content
14,662,169 members
Home » Discussions » C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Conversions in C Pin
ForNow30-Dec-15 6:22
MemberForNow30-Dec-15 6:22 
QuestionHow to call c# callback function from VC++ Pin
shakumar_2128-Dec-15 22:54
Membershakumar_2128-Dec-15 22:54 
AnswerRe: How to call c# callback function from VC++ Pin
Richard MacCutchan29-Dec-15 0:57
mveRichard MacCutchan29-Dec-15 0:57 
QuestionRESET USB Pin
Member 1223302928-Dec-15 15:17
MemberMember 1223302928-Dec-15 15:17 
QuestionRe: RESET USB Pin
David Crow28-Dec-15 17:01
MemberDavid Crow28-Dec-15 17:01 
QuestionCollecting openions/suggestions for Masters Project (topic: Firewall Optimisation) Pin
SujithKG28-Dec-15 5:15
MemberSujithKG28-Dec-15 5:15 
SuggestionRe: Collecting openions/suggestions for Masters Project (topic: Firewall Optimisation) Pin
Richard MacCutchan28-Dec-15 7:36
mveRichard MacCutchan28-Dec-15 7:36 
Questionwhy this funny double is not a true zero? Pin
includeh1027-Dec-15 3:13
Memberincludeh1027-Dec-15 3:13 
//print function
CString fmt(double db)
{
	CString cs;
	cs.Format("%f", db);
	return cs;
}


//problem
void TheDlg::Test00()
{
	const double dbInf  = 1.0/::sin(0);   //infinite
	const double dbZero = (::fabs(::cos(3.14159/2))<0.9)?0:1; //line 1

	CString cs;
	cs += fmt(dbZero)+"\r\n";          //line 2
	cs += fmt(dbZero * dbInf)+"\r\n";  //line 3
	cs += fmt(0 * dbInf)+"\r\n";       //line 4

	MessageBox(cs);
}

above dbZero only has 2 possible values : 0 or 1 - see line 1;
output:
0.000000
-1.#IND00
0.000000

output of line 2 shows that dbZero is zero.
output of line 3 shows that dbZero is not zero, since it is different from output of line 4.

funny thing is that if change line 1 to:
const double dbZero = (0.1<0.9)?0:1;

Then all outputs are zeros.

Why?
How to make dbZero as a true zero in problem code?
AnswerRe: why this funny double is not a true zero? Pin
Richard Andrew x6427-Dec-15 6:17
professionalRichard Andrew x6427-Dec-15 6:17 
AnswerRe: why this funny double is not a true zero? Pin
CPallini28-Dec-15 10:46
mveCPallini28-Dec-15 10:46 
AnswerRe: why this funny double is not a true zero? Pin
emersony21-Jan-16 8:37
Memberemersony21-Jan-16 8:37 
QuestionDatabase creation on external HD Pin
Amr.Mohammad8724-Dec-15 20:16
MemberAmr.Mohammad8724-Dec-15 20:16 
AnswerRe: Database creation on external HD Pin
Richard MacCutchan24-Dec-15 21:08
mveRichard MacCutchan24-Dec-15 21:08 
GeneralRe: Database creation on external HD Pin
Amr.Mohammad8725-Dec-15 7:21
MemberAmr.Mohammad8725-Dec-15 7:21 
GeneralRe: Database creation on external HD Pin
David Crow26-Dec-15 5:26
MemberDavid Crow26-Dec-15 5:26 
GeneralHello!I'm a young programmer from China Pin
Mike Covariant Lee23-Dec-15 1:39
MemberMike Covariant Lee23-Dec-15 1:39 
GeneralRe: Hello!I'm a young programmer from China Pin
Mike Covariant Lee23-Dec-15 1:41
MemberMike Covariant Lee23-Dec-15 1:41 
GeneralRe: Hello!I'm a young programmer from China Pin
CPallini23-Dec-15 2:29
mveCPallini23-Dec-15 2:29 
GeneralRe: Hello!I'm a young programmer from China Pin
Mike Covariant Lee23-Dec-15 18:00
MemberMike Covariant Lee23-Dec-15 18:00 
GeneralRe: Hello!I'm a young programmer from China Pin
Arthur V. Ratz29-Dec-15 21:34
mvaArthur V. Ratz29-Dec-15 21:34 
GeneralRe: Hello!I'm a young programmer from China Pin
Kleine schnappi8-Jan-16 23:23
MemberKleine schnappi8-Jan-16 23:23 
Questionplease fix my generic function Pin
Member 1150578522-Dec-15 9:04
MemberMember 1150578522-Dec-15 9:04 
AnswerRe: please fix my generic function Pin
Richard Andrew x6422-Dec-15 10:15
professionalRichard Andrew x6422-Dec-15 10:15 
GeneralRe: please fix my generic function Pin
Member 1150578522-Dec-15 21:29
MemberMember 1150578522-Dec-15 21:29 
AnswerRe: please fix my generic function Pin
k505422-Dec-15 10:17
mvek505422-Dec-15 10:17 

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.