This calculation is not right! 40GB means 40*1024*1024*1024 = 43 000 000 000 bytes!
When you format the drive some space is allocated for drive directories/databases and drivers. And a 40GB harddrive is not exactly 40GB anyway. It's just a rounded value instead of saying like 39.1 GB.