Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I've been using the GNU units program and I seem to think that I should be able to convert water between a volume and a weight.

Examples:

You have: 1 gram water
You want: cm^3
conformability error
    1 gram water = 9.80665 kg^2 / m^2 s^2
    cm^3 = 1e-06 m^3

and

You have: 1 gallon water
You want: pounds
conformability error
    1 gallon water = 37.122208 kg m / s^2
    pounds = 0.45359237 kg
share|improve this question
add comment

2 Answers

up vote 4 down vote accepted

The water unit is the specific weight of water at the standard temperature of 0°C. A cm water is a unit of pressure, like the cm Hg.

You have: water
You want: 
        Definition: gram force/cm^3 = 9806.65 kg / m^2 s^2

You have: 1cm Hg
You want: cm water
        * 13.5951
        / 0.073555914

A gram water is a unit of mass times pressume divided by length, which I don't recognize as a common physical quantity. Units has waterdensity defined to be the density of water at 4°C and 1atm, which is (to a very good precision) 1kg/m³.

You have: 1g/waterdensity
You want: cm^3
        * 1
        / 1

If you want density in other conditions or of other materials, either type out the constant or put it in your own unit definition file (units -f '' -f ~/.units.data).

share|improve this answer
add comment

Technically speaking, you're trying to convert volume into mass or weight. Sure, you wrote "water", but at what temperature and pressure? It makes a difference. And what if you wrote "1 gram mercury"?

You're asking for something that can't be done in the simplistic context in which units works. I think you're going to have to look up the density of the fluid you're interested in, and multiply by yourself.

share|improve this answer
    
-1, GNU units does actually have a limited selection of densities in its database, it's just that the keyword is waterdensity, not water. –  Random832 Jun 28 '11 at 17:20
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.