tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

have a pint



   % units
   551 units, 41 prefixes

   You have: pint
   You want: imperial pint
           * 0.83267413
           / 1.20095

Ok, well enough. Lots of people forget that these are different, but
it's a thing and it's good that units knows about it. (Maybe it should
be less US-centric, but that's not what I'm looking at tonight.)

This is also reasonable:

   You have: pint
   You want: brpint
           * 0.83267248
           / 1.2009524

Except wait, they're not quite the same...

   You have: imperial pint
   You want: brpint
           * 0.99999802
           / 1.000002

I assume that's a rounding bug and not intentional.

This, however, seems problematic:

   You have: imperial pint
   You want: british pint
           * 1.2009476
           / 0.8326758

I assume the word "british" in units.lib is meant for use as an
adjective in some other other context. However, I'm wondering what,
given this:

   You have: british
   You want: 1
           * 1.000002
           / 0.999998

That is, it's almost but not quite 1, probably because of rounding.

Meanwhile this doesn't work:

   You have: pint
   You want: metric pint
   units: Unknown unit 'metric'

which given the way units works isn't surprising, but this could and
doesn't:

   You have: pint
   You want: metricpint
   units: Unknown unit 'metricpint'

(where a metric pint is 500 mL)

Meanwhile things like this shouldn't be allowed:

   You have: lightyear
   You want: imperial lightyear
           * 0.83267413
           / 1.20095

   You have: lightyear
   You want: british lightyear
           * 0.999998
           / 1.000002

since "imperial" is correctly only useable as a modifier on certain
volume units.

Then, units.lib defines a constant fuzz == 1 that appears to be used
to tag definitions that are not precise, but it's used inconsistently
and not always correctly (e.g. it's attached to c and should not be)
and units itself doesn't know about it or what it means so it serves
no actual purpose currently.

So, some propositions:

(a) Dimensional analysis is great but it seems like we ought to have
some additional typing rules to prevent misuse of adjective units;

(b) units ought to be able to track the number of significant digits
in its definitions and computations and print accordingly;

(c) units.lib should get some editorial attention. Does anyone know
what "british" is supposed to be there for?

(d) deep chrome green

-- 
David A. Holland
dholland%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index