From tony@bloodrose.nog.net  Fri Jan 16 15:26:56 2004
Return-Path: <tony@bloodrose.nog.net>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 27EFE16A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 16 Jan 2004 15:26:56 -0800 (PST)
Received: from bloodrose.nog.net (bloodrose.nog.net [208.177.138.239])
	by mx1.FreeBSD.org (Postfix) with ESMTP id BCE5D43D53
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 16 Jan 2004 15:26:54 -0800 (PST)
	(envelope-from tony@bloodrose.nog.net)
Received: from bloodrose.nog.net (localhost [127.0.0.1])
	by bloodrose.nog.net (8.12.9p2/8.12.9/LosQuesosDelInfierno) with ESMTP id i0GNQpg2001826
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 16 Jan 2004 15:26:51 -0800 (PST)
	(envelope-from tony@bloodrose.nog.net)
Received: (from tony@localhost)
	by bloodrose.nog.net (8.12.9p2/8.12.9/Submit) id i0GNQpYE001825;
	Fri, 16 Jan 2004 15:26:51 -0800 (PST)
	(envelope-from tony)
Message-Id: <200401162326.i0GNQpYE001825@bloodrose.nog.net>
Date: Fri, 16 Jan 2004 15:26:51 -0800 (PST)
From: Tony Monroe <tmonroe+freebsd@nog.net>
Reply-To: Tony Monroe <tmonroe+freebsd@nog.net>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: Error with "carat" and "metriccarat" units in /usr/src/usr.bin/units/units.lib
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>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:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jan 16 15:30:15 PST 2004
>Closed-Date:    Sun May 30 09:21:41 PDT 2004
>Last-Modified:  Sun May 30 09:21:41 PDT 2004
>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@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:
State-Changed-From-To: open->closed 
State-Changed-By: dwmalone 
State-Changed-When: Sun May 30 09:20:58 PDT 2004 
State-Changed-Why:  
Committed to -current - thanks for the fix! 

David. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=61451 
>Unformatted:
