Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Am I missing something?' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Am I missing something?
Authored by: tanderson4 on Jun 02, '01 05:08:44PM

From experimenting a bit, it appears that there are at least a couple of ways to get the units program to do conversions. If you want to be prompted, run units and then enter the values along with the units to be converted, like this:

% units
You have: 5.8 feet
You want: cm
* 176.784
/ 0.0056566205
You have: 160 lbs
You want: oz
* 2560
/ 0.000390625

If you want to use the command line, do this:

% units 5.8-feet cm
* 176.784
/ 0.0056566205
% units 160-lbs oz
* 2560
/ 0.000390625

The first number returned is the conversion. Still trying to figure out what the second number (after the "/") is....



[ Reply to This | # ]
Am I missing something?
Authored by: babbage on Jun 02, '01 06:02:55PM
Whether invoked interactively or all via the command line, the syntax works out the same. You give a value, and units A & B. The response line tells you how to get from A to B, while the second line tells you how to get from B to A. So in your example, you have to multiply by 176.786 if you want to go from feet to centimeters, and the second line tells you that you have to divide by 0.0056566205 to get from centimeters to feet. Both lines are giving you "the conversion"; the first line gives you A -> B and the second line gives you B -> A. If you always invoke the command with the units you have first and the units you want second (which makes more sense to me), then you'll always just be interested in the first line.

No wait I'm horribly wrong.

Upon closer inspection, the first line is always multiplication and the second line is always division. The numbers are mutually reciprocal: using liters & gallons, you get * 0.26... and / 3.78..., and if you take either of those numbers and divide one by it, you get the other: (3.78...) = (1 / 0.26...) && (0.26...) = (1 / 3.78...). SO, what you have here are two numbers that can get you from units of A to units of B. The only difference, as near as I can tell, is that you have a choice regarding whether you prefer multiplying or dividing to get your result.

I have no idea why this would matter to anyone. Presumably some electrical engineer wrote this command back in the day, and it would be useful in that context as part of a larger script, as a database of conversion factors for arbitrary calculations. Considering that it doesn't actually do the calculations, but rather helps describe how to write the formula for the calculations, I can't see how this would be useful for most people. Some intrepid soul could probably extend this program in order to do that, but short of that, it looks like you still have to do the (easier, more mechanical part of the) work yourself...

[ Reply to This | # ]

Am I missing something?
Authored by: rusto on Jun 03, '01 12:09:33AM

You have: 2 feet
You want: meters
* 0.6096 <----this is the answer
/ 1.6404199 <----this is how to get back to where you started
You have: 3 feet
You want: meters
* 0.9144
/ 1.0936133

So I would say it DOES figure out the answer for you. Note that in the second example above, the answer is different...it's not just showing a conversion factor. Potentially handy but someone probably has something like unit conversion incorporated into an OSX calculator.



[ Reply to This | # ]