Click here to Skip to main content
15,910,872 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionfloating point precision issue Pin
Sarath C2-Feb-09 23:42
Sarath C2-Feb-09 23:42 
AnswerRe: floating point precision issue Pin
Cedric Moonen2-Feb-09 23:53
Cedric Moonen2-Feb-09 23:53 
GeneralRe: floating point precision issue [modified] Pin
Sarath C3-Feb-09 0:38
Sarath C3-Feb-09 0:38 
GeneralRe: floating point precision issue Pin
Cedric Moonen3-Feb-09 0:48
Cedric Moonen3-Feb-09 0:48 
GeneralRe: floating point precision issue Pin
Sarath C3-Feb-09 0:55
Sarath C3-Feb-09 0:55 
GeneralRe: floating point precision issue Pin
Stuart Dootson3-Feb-09 1:06
professionalStuart Dootson3-Feb-09 1:06 
AnswerRe: floating point precision issue Pin
CPallini3-Feb-09 0:00
mveCPallini3-Feb-09 0:00 
AnswerRe: floating point precision issue Pin
Stuart Dootson3-Feb-09 0:38
professionalStuart Dootson3-Feb-09 0:38 
It's because standard floats and doubles cannot exactly represent 0.6.

The representation of 0.6 as a float can be determined by working out what sum of binary fractions (1/2n) best approximates it - you can see it's going to be something like 0.5 + 0.0625 + 0.03125 + .... - SpeedCrunch[^] (a nice calculator) gives it as this:

0b0.1001100110011001100110011001100110011001100110011001100110011001101

Infinitely recurring binary time...

Read this document[^] for the full story.
AnswerRe: floating point precision issue Pin
David Crow3-Feb-09 4:47
David Crow3-Feb-09 4:47 
QuestionCompile time error for 'string.h' Pin
Supriya Tonape2-Feb-09 23:33
Supriya Tonape2-Feb-09 23:33 
AnswerRe: Compile time error for 'string.h' Pin
Cedric Moonen2-Feb-09 23:37
Cedric Moonen2-Feb-09 23:37 
GeneralRe: Compile time error for 'string.h' Pin
Supriya Tonape2-Feb-09 23:44
Supriya Tonape2-Feb-09 23:44 
AnswerRe: Compile time error for 'string.h' Pin
prasad_som3-Feb-09 3:27
prasad_som3-Feb-09 3:27 
QuestionRe: Compile time error for 'string.h' Pin
David Crow3-Feb-09 4:50
David Crow3-Feb-09 4:50 
AnswerRe: Compile time error for 'string.h' Pin
Supriya Tonape12-Feb-09 0:33
Supriya Tonape12-Feb-09 0:33 
QuestionUnicode Strings Pin
user30342-Feb-09 23:31
user30342-Feb-09 23:31 
AnswerRe: Unicode Strings Pin
Sarath C2-Feb-09 23:50
Sarath C2-Feb-09 23:50 
GeneralRe: Unicode Strings Pin
Supriya Tonape3-Feb-09 1:00
Supriya Tonape3-Feb-09 1:00 
QuestionHow to append text in word document caption? Pin
SNI2-Feb-09 21:48
SNI2-Feb-09 21:48 
AnswerRe: How to append text in word document caption? Pin
Stuart Dootson2-Feb-09 22:14
professionalStuart Dootson2-Feb-09 22:14 
GeneralRe: How to append text in word document caption? Pin
SNI2-Feb-09 22:34
SNI2-Feb-09 22:34 
GeneralRe: How to append text in word document caption? Pin
Stuart Dootson2-Feb-09 23:16
professionalStuart Dootson2-Feb-09 23:16 
AnswerRe: How to append text in word document caption? Pin
Hamid_RT3-Feb-09 20:49
Hamid_RT3-Feb-09 20:49 
QuestionSocket programming Pin
Member 46946272-Feb-09 21:21
Member 46946272-Feb-09 21:21 
AnswerRe: Socket programming Pin
«_Superman_»2-Feb-09 21:27
professional«_Superman_»2-Feb-09 21:27 

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.