[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[UDUNITS #VLT-428101]: Passing in numbers as units strings has some odd effects
- Subject: [UDUNITS #VLT-428101]: Passing in numbers as units strings has some odd effects
- Date: Thu, 29 Nov 2012 17:05:30 -0700
Jim,
> UDUnits2 has the ability to handle user defined conversion strings,
> which is pretty cool, but has a weird side effect. If you just enter
> numbers, UDUnits2 treats them as multiplicative conversion factors so:
>
> If I enter numbers say from 100 and to 10 I get 1 * 100/10 = 10. It is
> basically doing (entry1.value * entry2.value/entry3.value).
>
> Or, in other words you get a temporary unit, call it 'X'. UDUnits
> interprets it as, there is some unit 'X'. The 'From' value is 100*X,
> the 'To' value is 10*X. The result is 10.
>
> That's a little odd, but the problem is that it doesn't work with
> non-multiplication operations. I can't have a conversion string @10, or
> /10. UDUnits sees that as an error, so it should see the multiplicative
> case as an error as well, I think.
The "You have: 100"/"You want: 10" case works correctly in my view: you're
converting between 100 dimensionless units and 10 dimensionless units.
I'm not sure the meaning of "You have: @10" or "You have: /10" is sufficiently
obvious to justify the effor to modify the code. One might mean "nothing offset
to 10" and the other might mean "one tenth of nothing" -- but that's by no
means certain.
> Jim
Regards,
Steve Emmerson
Ticket Details
===================
Ticket ID: VLT-428101
Department: Support UDUNITS
Priority: Normal
Status: Closed