Click here to Skip to main content
16,004,969 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How can I improve this Function Pin
Stephen Hewitt30-May-07 14:05
Stephen Hewitt30-May-07 14:05 
Questiondouble = (int/int)*(int/int) Pin
Immunity1830-May-07 4:00
Immunity1830-May-07 4:00 
AnswerRe: double = (int/int)*(int/int) Pin
Cedric Moonen30-May-07 4:04
Cedric Moonen30-May-07 4:04 
GeneralRe: double = (int/int)*(int/int) Pin
Immunity1830-May-07 4:05
Immunity1830-May-07 4:05 
GeneralRe: double = (int/int)*(int/int) Pin
Immunity1830-May-07 4:15
Immunity1830-May-07 4:15 
GeneralRe: double = (int/int)*(int/int) Pin
toxcct30-May-07 5:02
toxcct30-May-07 5:02 
GeneralRe: double = (int/int)*(int/int) Pin
CPallini30-May-07 4:24
mveCPallini30-May-07 4:24 
AnswerRe: double = (int/int)*(int/int) Pin
CPallini30-May-07 4:21
mveCPallini30-May-07 4:21 
Immunity18 wrote:
rn = (double) (n/rCount)*(a/n)*(b/n)*(c/n)*(d/n)*(e/n);


cast should happen (in each factor) before division is performed
(otherwise integer division will result zero)
try :
<br />
  double rn = ((double)n/rCount)*((double)a/n)*((double)b/n)*((double)c/n)*((double)d/n)*((double)e/n); <br />
	<br />


Note that there is a smarter formulation of your expression:
<br />
  double rn =(double)( a * b * c * d * e )/(rCount * n * n * n * n);<br />


Smile | :)

If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.

GeneralRe: double = (int/int)*(int/int) Pin
Immunity1830-May-07 4:23
Immunity1830-May-07 4:23 
QuestionProblem with Excel automation Pin
Lampengeist30-May-07 3:38
professionalLampengeist30-May-07 3:38 
QuestionRe: Problem with Excel automation Pin
David Crow30-May-07 3:49
David Crow30-May-07 3:49 
AnswerRe: Problem with Excel automation Pin
Lampengeist30-May-07 3:58
professionalLampengeist30-May-07 3:58 
QuestionRe: Problem with Excel automation Pin
David Crow30-May-07 3:58
David Crow30-May-07 3:58 
AnswerRe: Problem with Excel automation Pin
Lampengeist30-May-07 4:08
professionalLampengeist30-May-07 4:08 
GeneralRe: Problem with Excel automation Pin
David Crow31-May-07 4:46
David Crow31-May-07 4:46 
QuestionNetwork Deployment Pin
priyank_ldce30-May-07 3:00
priyank_ldce30-May-07 3:00 
NewsRe: Network Deployment Pin
Rajkumar R31-May-07 2:14
Rajkumar R31-May-07 2:14 
QuestionDirectshow Pin
kcynic30-May-07 2:33
kcynic30-May-07 2:33 
AnswerRe: Directshow Pin
#realJSOP30-May-07 3:28
professional#realJSOP30-May-07 3:28 
AnswerRe: Directshow Pin
Mark Salsbery30-May-07 4:33
Mark Salsbery30-May-07 4:33 
GeneralRe: Directshow Pin
#realJSOP30-May-07 6:08
professional#realJSOP30-May-07 6:08 
GeneralRe: Directshow [modified] Pin
Mark Salsbery30-May-07 6:16
Mark Salsbery30-May-07 6:16 
GeneralRe: Directshow Pin
kcynic30-May-07 6:52
kcynic30-May-07 6:52 
Questionhow to use c# dll in vc++ .net ? Pin
jalsa G30-May-07 2:31
jalsa G30-May-07 2:31 
QuestionRe: how to use c# dll in vc++ .net ? Pin
Hamid_RT30-May-07 2:42
Hamid_RT30-May-07 2:42 

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.