Click here to Skip to main content
16,010,553 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Question: Dynamic CEdit Window with Shortcut keys Pin
Christian Graus9-Feb-02 23:25
protectorChristian Graus9-Feb-02 23:25 
GeneralAgain GDI+ but diffrenet question Pin
Mazdak9-Feb-02 22:40
Mazdak9-Feb-02 22:40 
GeneralRe: Again GDI+ but diffrenet question Pin
Christian Graus9-Feb-02 22:57
protectorChristian Graus9-Feb-02 22:57 
GeneralFloating Point Variables Pin
9-Feb-02 22:10
suss9-Feb-02 22:10 
GeneralRe: Floating Point Variables Pin
Christian Graus9-Feb-02 22:40
protectorChristian Graus9-Feb-02 22:40 
GeneralRe: Floating Point Variables Pin
alex.barylski9-Feb-02 22:48
alex.barylski9-Feb-02 22:48 
GeneralRe: Floating Point Variables Pin
Tim Deveaux10-Feb-02 3:18
Tim Deveaux10-Feb-02 3:18 
GeneralRe: Floating Point Variables Pin
Tim Smith10-Feb-02 3:25
Tim Smith10-Feb-02 3:25 
Floating point is stored in base 2 and thus can have trouble representing numbers that look perfectly normal to us. Also, addition is inherently poor in floating point while multiplication works much better. If you can avoid repeatedly adding small numbers to a large number and instead perform a single add, the quality of the floating point number is much better.

For example:

// bad way

float a = 1000;
for (int i = 0; i < 10000; i++)
{
    a += 0.5;
    // do something
}

// good way

float a = 1000;
for (int i = 0; i < 10000; i++)
{
    float b = a + (float) i * 0.5;
    // do something
}


Tim Smith
Descartes Systems Sciences, Inc.
QuestionHeap, stack? Pin
Jasmyn9-Feb-02 22:06
Jasmyn9-Feb-02 22:06 
AnswerRe: Heap, stack? Pin
alex.barylski9-Feb-02 22:25
alex.barylski9-Feb-02 22:25 
GeneralRe: Heap, stack? Pin
Jasmyn9-Feb-02 23:04
Jasmyn9-Feb-02 23:04 
GeneralRe: Heap, stack? Pin
alex.barylski9-Feb-02 23:34
alex.barylski9-Feb-02 23:34 
GeneralRe: Heap, stack? Pin
Nish Nishant9-Feb-02 23:13
sitebuilderNish Nishant9-Feb-02 23:13 
GeneralRe: Heap, stack? Pin
alex.barylski9-Feb-02 23:31
alex.barylski9-Feb-02 23:31 
GeneralRe: Heap, stack? Pin
Nish Nishant10-Feb-02 0:19
sitebuilderNish Nishant10-Feb-02 0:19 
GeneralRe: Heap, stack? Pin
alex.barylski10-Feb-02 12:04
alex.barylski10-Feb-02 12:04 
AnswerRe: Heap, stack? Pin
Alvaro Mendez11-Feb-02 12:10
Alvaro Mendez11-Feb-02 12:10 
GeneralGlobals Pin
alex.barylski9-Feb-02 22:01
alex.barylski9-Feb-02 22:01 
GeneralRe: Globals Pin
Paul M Watt9-Feb-02 22:39
mentorPaul M Watt9-Feb-02 22:39 
GeneralRe: Globals Pin
alex.barylski9-Feb-02 22:44
alex.barylski9-Feb-02 22:44 
GeneralRe: Globals Pin
Christian Graus9-Feb-02 22:42
protectorChristian Graus9-Feb-02 22:42 
GeneralRe: Globals Pin
alex.barylski9-Feb-02 22:52
alex.barylski9-Feb-02 22:52 
GeneralRe: Globals Pin
Christian Graus9-Feb-02 22:59
protectorChristian Graus9-Feb-02 22:59 
GeneralRe: Globals Pin
alex.barylski10-Feb-02 0:13
alex.barylski10-Feb-02 0:13 
GeneralRe: Globals Pin
Sprudling10-Feb-02 0:46
Sprudling10-Feb-02 0:46 

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.