Celstar's link goes part of the way in explaining why that 40GB drive doesn't show as 40BG. But, a 40GB drive isn't going to format out to 30 or 32; more likely 38. So, another explanation of why that drive is only showing as a 30 or 32GB is tied to either your system or a jumper on the hard drive.
This page does a good job of explaining the limitations in hard drive size and what was done to overcome those limitations. Here's an excerpt from the explanation:
The LBA system was first applied to computer systems with BIOS dates after July 1994. However, this did not solve the whole problem. Some BIOS manufacturers set cylinder limitations in the BIOS which limited drive size to just over 2 gigabytes. This matched the Windows 95 16-bit file allocation table (FAT 16) limit of 2 gigabytes per partition. With the advent of FAT32, the BIOS limit was raised to 8.4 gigabytes. Further extensions of the INT13h interface allowed the BIOS limit to be increased to 32 gigabytes.
In general, computer systems with a BIOS dated 1998 or later can work with drives up to 32 gigabytes (GB) in size. The 32GB barrier is due to the inability of the BIOS to address an LBA that is larger than 66,060,287. Only in the most recent computer systems has the BIOS been upgraded to work with drives larger than 32GB. In addition, in some computers, a 64GB barrier is still to be overcome. So, the primary limit to the size of the hard drive your computer can use is the LBA limit of your system's BIOS.
So, depending on the date/age of your BIOS and your OS you're likely seeing that 40GB drive
size out at 32GB. Then after formatting that 32GB drive you're likely seeing 30GB of usable space. There's also likely a jumper on the drive that limits capacity to 32GB, to address BIOS limitations, and that would be worth checking out.