Float precission in C++

If you want this for diplaying purposes and not actual caluclation use this. Otherwise Muelas answer is a good approach.