| Summary: | Error with "carat" and "metriccarat" units in /usr/src/usr.bin/units/units.lib | ||
|---|---|---|---|
| Product: | Base System | Reporter: | Tony Monroe <tmonroe+freebsd> |
| Component: | bin | Assignee: | freebsd-bugs (Nobody) <bugs> |
| Status: | Closed FIXED | ||
| Severity: | Affects Only Me | ||
| Priority: | Normal | ||
| Version: | 4.9-RELEASE | ||
| Hardware: | Any | ||
| OS: | Any | ||
State Changed From-To: open->closed Committed to -current - thanks for the fix! David. |
The database in /usr/share/misc/units.lib leads /usr/bin/units to believe that a carat is not a unit of mass, but of something else. This problem also affects the metric carat. (It is unfortunate that the units database is set up so that "mg" is interpreted as "m-" times "g", or 0.001 * 9.8 m / sec^2. This is not necessarily easily fixed, nor do I expect that it will be addressed as a result of this bug report.) This problem is present on 4.9-RELEASE as of 2003-11-03, and 5.1-RELEASE as of 2003-12-03. Fix: perl -pi.bak -e 's/mg/milligram/ if /carat/' /usr/src/usr.bin/units/units.lib Using the new units.lib, we get: $ units -f units.lib carat milligram * 205 / 0.0048780488 $ units -f units.lib metriccarat milligram * 200 / 0.005 Which is the expected result, and exhibits no "conformability error." How-To-Repeat: $ units carat milligram conformability error 2.0103633 m / sec^2 1e-06 kg $ units metriccarat milligram conformability error 1.96133 m / sec^2 1e-06 kg