Click here to Skip to main content
15,925,499 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionwrong code Pin
tom groezer14-Jul-07 7:05
tom groezer14-Jul-07 7:05 
AnswerRe: wrong code Pin
Paul Conrad14-Jul-07 7:25
professionalPaul Conrad14-Jul-07 7:25 
AnswerRe: wrong code Pin
Mark Salsbery14-Jul-07 7:27
Mark Salsbery14-Jul-07 7:27 
AnswerRe: wrong code Pin
Mark Salsbery14-Jul-07 7:32
Mark Salsbery14-Jul-07 7:32 
GeneralRe: wrong code Pin
Paul Conrad14-Jul-07 7:37
professionalPaul Conrad14-Jul-07 7:37 
AnswerRe: wrong code Pin
#realJSOP15-Jul-07 2:03
professional#realJSOP15-Jul-07 2:03 
QuestionFP Question Pin
Cmania14-Jul-07 7:02
Cmania14-Jul-07 7:02 
AnswerRe: FP Question Pin
Mike Dimmick14-Jul-07 9:22
Mike Dimmick14-Jul-07 9:22 
Read What Every Computer Scientist Should Know About Floating Point Arithmetic[^].

A binary floating-point number can only store numbers that are sums of powers of two. The digits to the right of the point are sums of negative powers of two. Just as 1/3 is not accurately representable in decimal (0.33333.... etc), 1/5 is not accurately representable in binary. The more operations you perform on a limited precision representation, the more representation error builds up. That's why it's rarely a good idea to directly compare two floating point numbers.

I don't think there are any values representable in binary that are not representable in decimal, because two divides evenly into ten. However, when displaying a floating point result, it's common to only show some decimal places, displaying a rounded result.

If you want decimal values, with a fixed decimal point, to be stored and computed accurately, you should use a scaled integer. This is not supplied by standard C++ so you'll have to find an implementation, e.g. here[^].

Stability. What an interesting concept. -- Chris Maunder

QuestionNull pointer Pin
tom groezer14-Jul-07 7:02
tom groezer14-Jul-07 7:02 
AnswerRe: Null pointer Pin
Mark Salsbery14-Jul-07 7:37
Mark Salsbery14-Jul-07 7:37 
AnswerRe: Null pointer Pin
c_explorer14-Jul-07 11:54
c_explorer14-Jul-07 11:54 
AnswerRe: Null pointer Pin
#realJSOP15-Jul-07 2:07
professional#realJSOP15-Jul-07 2:07 
QuestionClosing several ui threads together. Pin
neha.agarwal2714-Jul-07 1:50
neha.agarwal2714-Jul-07 1:50 
AnswerRe: Closing several ui threads together. Pin
saravananr_mca15-Jul-07 19:10
saravananr_mca15-Jul-07 19:10 
QuestionHow to disable entire menu bar. Pin
shivditya14-Jul-07 1:21
shivditya14-Jul-07 1:21 
AnswerRe: How to disable entire menu bar. Pin
Mark Salsbery14-Jul-07 7:21
Mark Salsbery14-Jul-07 7:21 
QuestionIAMStreamControl StartAt() doesn't work [modified] Pin
liur1713-Jul-07 23:55
liur1713-Jul-07 23:55 
Questionusb connection Pin
HOYAM13-Jul-07 23:15
HOYAM13-Jul-07 23:15 
AnswerRe: usb connection Pin
Cedric Moonen13-Jul-07 23:49
Cedric Moonen13-Jul-07 23:49 
GeneralRe: usb connection Pin
HOYAM14-Jul-07 3:51
HOYAM14-Jul-07 3:51 
Questioninsert image in Ms-word using MFC Pin
saravananr_mca13-Jul-07 20:51
saravananr_mca13-Jul-07 20:51 
QuestionCan i import jpeg images into workspace of visual C++ Application Pin
vipin_nvk13-Jul-07 20:15
vipin_nvk13-Jul-07 20:15 
AnswerRe: Can i import jpeg images into workspace of visual C++ Application Pin
Hamid_RT14-Jul-07 1:04
Hamid_RT14-Jul-07 1:04 
Question[Message Deleted] Pin
hkwj8813-Jul-07 19:20
hkwj8813-Jul-07 19:20 
AnswerRe: input file Pin
Cyrilix13-Jul-07 20:16
Cyrilix13-Jul-07 20:16 

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.