A company that makes custom parts out of metal has hired me to revamp a 
program for reasons unrelated to measurement. They're not interested in 
metricating now, but from all I've heard I know they will. So I'm making it 
metric internally with selectable input and output units.

I looked at the code used to compute the weight of a part. It multiplies the 
dimensions, the density, and 1000. Why 1000? The total weight of an order is 
shown in pounds. The weight of one part is in pounds per 1000 - in other 
words, millipounds. When it shows metric, they will be in kilograms and 
grams.

When I rewrite the code, it'll multiply the dimensions and the density and 
divide by 1000. That's because the dimensions are in millimeters, the density 
is in grams per cubic centimeter, and the weight is in grams.

phma

Reply via email to