Click here to Skip to main content
15,890,282 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionget logon and logoff event in an service on windows 2000 Pin
EverettJF13-Jul-10 15:05
EverettJF13-Jul-10 15:05 
Question10 & 10/3*3 are not equal ! ! ! WHY? Pin
hasani200713-Jul-10 9:32
hasani200713-Jul-10 9:32 
AnswerRe: 10 & 10/3*3 are not equal ! ! ! WHY? PinPopular
Maximilien13-Jul-10 9:55
Maximilien13-Jul-10 9:55 
GeneralRe: 10 & 10/3*3 are not equal ! ! ! WHY? Pin
Niklas L14-Jul-10 1:13
Niklas L14-Jul-10 1:13 
AnswerRe: 10 & 10/3*3 are not equal ! ! ! WHY? PinPopular
Niklas L13-Jul-10 9:56
Niklas L13-Jul-10 9:56 
AnswerRe: 10 & 10/3*3 are not equal ! ! ! WHY? Pin
EverettJF13-Jul-10 14:47
EverettJF13-Jul-10 14:47 
GeneralRe: 10 & 10/3*3 are not equal ! ! ! WHY? Pin
Rick York13-Jul-10 16:32
mveRick York13-Jul-10 16:32 
AnswerRe: 10 & 10/3*3 are not equal ! ! ! WHY? Pin
Aescleal13-Jul-10 21:47
Aescleal13-Jul-10 21:47 
10 divided by 3 is 3.333 recurring in decimal and in binary it's something like: 11.01010101 (can't be bothered working it out any further). Say you have a computer which stores floats as 6 bits for the non-exponent chunk of the number. It'd truncate the value of 10/3 to 11.0101. When you multiply it by three you get: 1001.1111 which is truncated to 1001.11 which is 9.75 in decimal. While real double precision numbers use oodles more bits to represent the non-exponential part you get the same problem.

Note that you've got a similar problem with order of evaluation: (A * B ) / C for a computer using a finite number of bits is not necessarily equal to ( A / C ) * B. Fortunately most real world uses of computers don't have these problems - it's really only a concern to people doing simulation or some science. The rest of us can use integers most of the time and get away with it.

Cheers,

Ash
AnswerRe: 10 & 10/3*3 are not equal ! ! ! WHY? Pin
josda100014-Jul-10 6:26
josda100014-Jul-10 6:26 
QuestionDLL injection at start time. Pin
Code-o-mat13-Jul-10 6:13
Code-o-mat13-Jul-10 6:13 
QuestionWord automation using MFC - how to hide Word toolbar and menu bar Pin
Member 422150713-Jul-10 4:46
Member 422150713-Jul-10 4:46 
QuestionUsing Open SSL Pin
Rajmohan SK13-Jul-10 3:54
Rajmohan SK13-Jul-10 3:54 
AnswerRe: Using Open SSL Pin
Aescleal13-Jul-10 4:11
Aescleal13-Jul-10 4:11 
GeneralRe: Using Open SSL Pin
Rajmohan SK13-Jul-10 17:57
Rajmohan SK13-Jul-10 17:57 
Questionconst string reference variables Pin
apphia_j_7913-Jul-10 2:43
apphia_j_7913-Jul-10 2:43 
AnswerRe: const string reference variables Pin
Cedric Moonen13-Jul-10 2:47
Cedric Moonen13-Jul-10 2:47 
GeneralRe: const string reference variables Pin
apphia_j_7913-Jul-10 3:24
apphia_j_7913-Jul-10 3:24 
GeneralRe: const string reference variables Pin
Cedric Moonen13-Jul-10 3:32
Cedric Moonen13-Jul-10 3:32 
QuestionRe: const string reference variables Pin
CPallini13-Jul-10 2:58
mveCPallini13-Jul-10 2:58 
AnswerRe: const string reference variables Pin
Aescleal13-Jul-10 3:52
Aescleal13-Jul-10 3:52 
AnswerRe: const string reference variables Pin
Niklas L13-Jul-10 4:42
Niklas L13-Jul-10 4:42 
QuestionC2782 Pin
T.RATHA KRISHNAN13-Jul-10 1:47
T.RATHA KRISHNAN13-Jul-10 1:47 
AnswerRe: C2782 Pin
Cedric Moonen13-Jul-10 2:09
Cedric Moonen13-Jul-10 2:09 
AnswerRe: C2782 Pin
Emilio Garavaglia13-Jul-10 7:20
Emilio Garavaglia13-Jul-10 7:20 
Questionimport a registry file in the registry editor Pin
mazizi13-Jul-10 1:07
mazizi13-Jul-10 1:07 

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.