Re: [proximity] Meaning of negative values

On 13 May 2014, at 17:11, Hirsch Frederick (Nokia-CTO/Boston) <frederick.hirsch@nokia.com> wrote:

> My understanding is that meaningful values are positive in the range of min - max but that a ‘negative infinity’ value is used to represent ‘undefined’.
> 
> Value is a double so it can be negative, but only positive values have meaning for this API. The negative infinity value is used as a special case indicator to mean no value has been assigned (e.g. not supported or available).

Correct.

> Thus for min, max and value the negative and positive infinity values are used to indicate ‘no defined value’ - I guess Javascript NaN or ‘undefined’ could be used instead of this convention, but this way it is always a number and just requires a value test.

This allows to differentiate between the "value is zero" and "value is not known”, and is easier to use with comparison operators than NaN or undefined as Frederick notes.

> I wonder if there is a documented set of conventions for the HTML5 family of specs that would include this.

The HTML spec does use this convention to set certain "not known” values as negative or positive Infinity. The spec itself serves as a documented set of conventions, and there’s no separate maintained document for that, AFAIK.

> The language about returning the ‘value it was initialized to’ is not very clear. What it really means is ‘return the value determined by the device which is either the actual value or the indicator that no value is available’.

The “value it was initialised to” is established language for initialising attributes of an event, used by specification that make use of events.

> Thus in general no negative values should be found other than negative infinity.

Correct.

> Does this make sense?

Thanks,

-Anssi

Received on Wednesday, 14 May 2014 07:07:51 UTC