3 lines of code and an error I can't fix..

It won't compile. It says my call is "ambiguous"

1
2
3
4
int Lattice::XYZtoIndex( int a,int b,int c )
{
    return (int)(a + (b*pow( NSITES,2/3 )) + (c*cbrt( NSITES )));
}
2/3 is 0 due to integer division. Try 2.0/3
Thanks :)

NOw this won't work XD

(int)(a % pow( NSITES,1./NDIMENSIONS ))
yeah, just fixed it. % operator needs two integers
Topic archived. No new replies allowed.