bin/61451: Error with "carat" and "metriccarat" units in /usr/src/usr.bin/units/units.lib

Tony Monroe tmonroe+freebsd at nog.net
Fri Jan 16 15:30:20 PST 2004


>Number:         61451
>Category:       bin
>Synopsis:       Error with "carat" and "metriccarat" units in /usr/src/usr.bin/units/units.lib
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jan 16 15:30:15 PST 2004
>Closed-Date:
>Last-Modified:
>Originator:     Tony Monroe
>Release:        FreeBSD 4.9-RELEASE i386
>Organization:
self
>Environment:
System: FreeBSD bloodrose.nog.net 4.9-RELEASE FreeBSD 4.9-RELEASE #2: Mon Nov 3 14:23:16 PST 2003 root at bloodrose:/var/obj/usr/src/sys/BLOOD_FOUR i386

>Description:

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.

>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

>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."
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list