hidden and system files including the swap file which changes size depending on what you are doing can account for some of the "lost" space, formatting and the manufacturers way of describing drive space can also take a few gig's of space from the "40" gig advertised.
a 40 gig drive after partitioning and formatting would probably pan out about 37gig
i think really its time to invest in another drive if you are so close to filling the one you have. as hard drive prices are so low at the moment, now is a good time.
click here are offering free delivery in december. worth taking a look. also check click here