# Thread: Function returning incorrect value

1. ## Function returning incorrect value

I'm having a little trouble with this block of code:

Code:
```int sphere()
{

volume = ( 4 / 3 ) * PI * pow( radius_2, 3 );

printf( "Volume = %f\n", volume );

return 0;
}```
PI is defined at the beginning of the program as 3.14159 using:

Code:
`#define PI 3.14159`
My problem is that this function is returning 25.132721 as as volume instead of the correct value of ~33.49. I've narrowed the problem down to the 'volume = ( 4 / 3 ) * PI * pow( radius_2, 3 );' statement; specifically the '( 4 / 3 )' portion of the statement. It seems to me that it is returning 1.0 as 4 / 3 instead of the actual value - even though volume is declared type float.

Thanks for any help!

2. You should express it as "(4.0 / 3.0)", or even "(4.0 / 3)" -- that way, you're getting a floating point result rather than an integer result.

3. Integer division bud.

4 / 3 = 1
4 / 3.0 = 1.3333333...

```volume = ( 4 / 3.0 ) * PI * pow( radius_2, 3 );