Click here to Skip to main content
16,005,552 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to write programt to create folder? Pin
Simon.W25-Mar-03 0:35
Simon.W25-Mar-03 0:35 
GeneralCTreeCtrl with icons Pin
rohit.dhamija24-Mar-03 19:24
rohit.dhamija24-Mar-03 19:24 
GeneralRe: CTreeCtrl with icons Pin
Tibor Blazko24-Mar-03 19:36
Tibor Blazko24-Mar-03 19:36 
GeneralRe: CTreeCtrl with icons Pin
jeremysay24-Mar-03 22:39
jeremysay24-Mar-03 22:39 
GeneralQuadratic equation Pin
ROK_RShadow24-Mar-03 19:01
ROK_RShadow24-Mar-03 19:01 
GeneralRe: Quadratic equation Pin
Roger Wright24-Mar-03 20:00
professionalRoger Wright24-Mar-03 20:00 
GeneralRe: Quadratic equation Pin
ROK_RShadow24-Mar-03 20:35
ROK_RShadow24-Mar-03 20:35 
GeneralRe: Quadratic equation Pin
Roger Wright24-Mar-03 21:17
professionalRoger Wright24-Mar-03 21:17 
It's really the int cast that caught my eye - the root of a function is very rarely an integer, and I hate imprecise answers. As a rule, I try to use the greatest precision available in all internal calculations, then use a cast as the final step to limit the output to what the program needs to provide. You're correct in assuming that it will give the right answer, within the limits of the data types you've selected.

The short form of my answer, without my editorial comments, would be that the two implementations are equivalent. Yours may be more efficient, as it requires for each solution one addition and one division, while the other uses two divisions and one addition. Division requires more CPU cycles, generally, than addition, too.

Ancient man conquered his rivals with the jawbone of an ass; modern man uses the jawbone of a politician.
GeneralRe: Quadratic equation Pin
ROK_RShadow24-Mar-03 21:28
ROK_RShadow24-Mar-03 21:28 
GeneralRe: Quadratic equation Pin
Roger Wright24-Mar-03 22:07
professionalRoger Wright24-Mar-03 22:07 
QuestionIs there a function to convert a CString value to an integer? Pin
julych24-Mar-03 18:30
julych24-Mar-03 18:30 
AnswerRe: Is there a function to convert a CString value to an integer? Pin
Michael Dunn24-Mar-03 19:10
sitebuilderMichael Dunn24-Mar-03 19:10 
GeneralRe: Is there a function to convert a CString value to an integer? Pin
r i s h a b h s25-Mar-03 17:01
r i s h a b h s25-Mar-03 17:01 
GeneralDynamic allocation of 2-d array using 'new' Pin
natiekyle24-Mar-03 18:05
natiekyle24-Mar-03 18:05 
GeneralRe: Dynamic allocation of 2-d array using 'new' Pin
Nick Parker24-Mar-03 18:20
protectorNick Parker24-Mar-03 18:20 
QuestionHow to find data in database ? Pin
ooosawaddee324-Mar-03 15:21
ooosawaddee324-Mar-03 15:21 
AnswerRe: How to find data in database ? Pin
Anonymous24-Mar-03 15:37
Anonymous24-Mar-03 15:37 
GeneralRe: How to find data in database ? Pin
ooosawaddee324-Mar-03 15:56
ooosawaddee324-Mar-03 15:56 
GeneralRe: How to find data in database ? Pin
Anonymous24-Mar-03 16:14
Anonymous24-Mar-03 16:14 
AnswerRe: How to find data in database ? Pin
Christian Graus24-Mar-03 16:56
protectorChristian Graus24-Mar-03 16:56 
GeneralRe: How to find data in database ? Pin
Nick Parker24-Mar-03 18:24
protectorNick Parker24-Mar-03 18:24 
GeneralHtmlHelp events Pin
trimtrom24-Mar-03 14:54
trimtrom24-Mar-03 14:54 
GeneralRe: HtmlHelp events Pin
Taka Muraoka24-Mar-03 15:02
Taka Muraoka24-Mar-03 15:02 
GeneralCOM Port data transfer Pin
TeraCoder24-Mar-03 13:09
TeraCoder24-Mar-03 13:09 
GeneralRe: COM Port data transfer Pin
Santanu Lahiri24-Mar-03 20:20
Santanu Lahiri24-Mar-03 20:20 

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.