Float and double decimal size

Sir, we were told in class that in float it takes upto 6 decimal values and in double it takes upto 12 decimal values but in my programme it is printing only 4 decimals, why?