1. ## sqrtf function

Hi all,
I have this function to compute for the distance between two given points. I have been getting this error:

Code:
`error C2064: term does not evaluate to a function taking 1 arguments`
Code is as follows:
Code:
```float dist(float ax, float ay, float az, float bx, float by, float bz)
{
float d = 0.0f, dist = 0.0f;

distance = ((bx-ax)(bx-ax)+(by-ay)(by-ay)+(bz-az)(bz-az));
d = sqrtf(distance);
cout << d << endl;
return d;
}```
I think I wasn't able to put the formula in the best code format.
Any ideas?

Thanks...

2. Code:
`distance = ((bx-ax)*(bx-ax)+(by-ay)*(by-ay)+(bz-az)*(bz-az));`

3. Oh.. the error points to the line where the distance computation is.. The function has six parameters hence, six arguments, right?

4. Code:
```#include <iostream>
#include <cmath>
using std::cout;
using std::endl;

float dist(float ax, float ay, float az, float bx, float by, float bz)
{
float d = 0.0f, dist = 0.0f;

dist = ((bx-ax)*(bx-ax)+(by-ay)*(by-ay)+(bz-az)*(bz-az));
d = sqrtf(dist);
cout << d << endl;
return d;
}```

5. Thanks a lot, Dave... I got it working right away..
It's funny I often overlook simple, important details like that..
Thanks again..

6. I would recommend that you don't use the same name for a function and a variable inside the function. Whilst it's perfectly legal and valid to do, it can confuse almost any reader.

Of course, aside from debug purposes, there's no reason to calculate intermediate values at all - just stuff the whole computation into the arguments to sqrtf() and be done with it.

--
Mats

7. Did you edit the code in your original post?