Click here to Skip to main content
15,894,017 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Not able to find the square of the floating number ... Pin
Jochen Arndt29-Jul-14 0:32
professionalJochen Arndt29-Jul-14 0:32 
AnswerRe: Not able to find the square of the floating number ... Pin
CPallini29-Jul-14 0:25
mveCPallini29-Jul-14 0:25 
GeneralRe: Not able to find the square of the floating number ... Pin
mybm129-Jul-14 1:52
mybm129-Jul-14 1:52 
GeneralRe: Not able to find the square of the floating number ... Pin
CPallini29-Jul-14 1:54
mveCPallini29-Jul-14 1:54 
GeneralRe: Not able to find the square of the floating number ... Pin
mybm129-Jul-14 1:56
mybm129-Jul-14 1:56 
QuestionRe: Not able to find the square of the floating number ... Pin
CPallini29-Jul-14 2:00
mveCPallini29-Jul-14 2:00 
AnswerRe: Not able to find the square of the floating number ... Pin
mybm129-Jul-14 2:47
mybm129-Jul-14 2:47 
GeneralRe: Not able to find the square of the floating number ... Pin
CPallini29-Jul-14 8:07
mveCPallini29-Jul-14 8:07 
You are wrong, the output of the following program:
C
int main()
{
  int i;
  double sum = 0.0;
  double a[] =
  {
    0.035679,
    0.079935,
    0.03332,
    0.042424,
    0.012387
  };


  for (i=0; i<sizeof(a)/sizeof(a[0]); ++i)
  {
    double sq = square_root(a[i]);
    printf("a[%d] = %g, sqrt(a[%d])=%g\n", i, a[i], i, sq);
    sum += sq;
  }
  printf("sum of square roots = %g\n", sum);
}


is
a[0] = 0.035679, sqrt(a[0])=0.188889
a[1] = 0.079935, sqrt(a[1])=0.282728
a[2] = 0.03332, sqrt(a[2])=0.182538
a[3] = 0.042424, sqrt(a[3])=0.205971
a[4] = 0.012387, sqrt(a[4])=0.111297
sum of square roots = 0.971422


That is correct (at least according to Excel Smile | :) ).
THESE PEOPLE REALLY BOTHER ME!! How can they know what you should do without knowing what you want done?!?!
-- C++ FQA Lite

GeneralRe: Not able to find the square of the floating number ... Pin
mybm129-Jul-14 18:19
mybm129-Jul-14 18:19 
GeneralRe: Not able to find the square of the floating number ... Pin
CPallini29-Jul-14 21:30
mveCPallini29-Jul-14 21:30 
GeneralRe: Not able to find the square of the floating number ... Pin
jeron129-Jul-14 9:14
jeron129-Jul-14 9:14 
GeneralRe: Not able to find the square of the floating number ... Pin
mybm129-Jul-14 18:20
mybm129-Jul-14 18:20 
Questionmigration from Visual studio 6 Pin
Swap928-Jul-14 3:30
Swap928-Jul-14 3:30 
AnswerRe: migration from Visual studio 6 Pin
Jochen Arndt28-Jul-14 4:03
professionalJochen Arndt28-Jul-14 4:03 
GeneralRe: migration from Visual studio 6 Pin
Swap928-Jul-14 4:34
Swap928-Jul-14 4:34 
GeneralRe: migration from Visual studio 6 Pin
Jochen Arndt28-Jul-14 4:58
professionalJochen Arndt28-Jul-14 4:58 
GeneralRe: migration from Visual studio 6 Pin
Swap928-Jul-14 5:03
Swap928-Jul-14 5:03 
GeneralRe: migration from Visual studio 6 Pin
Jochen Arndt28-Jul-14 5:11
professionalJochen Arndt28-Jul-14 5:11 
GeneralRe: migration from Visual studio 6 Pin
Swap928-Jul-14 11:25
Swap928-Jul-14 11:25 
GeneralRe: migration from Visual studio 6 Pin
Jochen Arndt28-Jul-14 21:16
professionalJochen Arndt28-Jul-14 21:16 
GeneralRe: migration from Visual studio 6 Pin
Swap929-Jul-14 3:36
Swap929-Jul-14 3:36 
GeneralRe: migration from Visual studio 6 Pin
Jochen Arndt29-Jul-14 4:01
professionalJochen Arndt29-Jul-14 4:01 
GeneralRe: migration from Visual studio 6 Pin
Swap929-Jul-14 4:26
Swap929-Jul-14 4:26 
GeneralRe: migration from Visual studio 6 Pin
Jochen Arndt29-Jul-14 4:44
professionalJochen Arndt29-Jul-14 4:44 
GeneralHi Jochen, Need help again Pin
Swap931-Jul-14 23:14
Swap931-Jul-14 23:14 

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.