On 11 December 2011, Xenia <yoraxe@googlemail.com> wrote:

Am 11.12.2011 11:25, schrieb Robin.Kirkham@csiro.au:
All,

I have put together some suggestions to extend the number formatting
capability in \unit, particularly for scientific and engineering purposes,
including basic support for tolerances and uncertainties.

It is a bit long, so source is attached and a PDF is at

http://dl.dropbox.com/u/36891398/units6.pdf

Of course, this is just my opinion, so I welcome any feedback from the list.

I like your suggestions. Especially the current handling of `e-23` etc.
is not intuitive but rather confusing and does not meet the standard.

I do not know if there is already a solution for automatically
shortening the number of digits in the output, but that would be nice, too.

Xenia

Yes, I thought about that, of course, but did not put it forward because to do it properly the correct numeric rounding/significant figures rules should be applied, and that I guess means the Lua code needs to interpret the number, rather than just treat it as a sequence of digits.

However if the Lua code did interpret the number into an internal format it would enable other things like normalisation to scientific or engineering form, etc. However the internal format would have to support arbitrarily long numbers and exponents ... Lua's built-in internal number format (a double precision float, I think) would not do, so there would be a bit of coding involved.

Robin