W3C home > Mailing lists > Public > public-device-apis@w3.org > May 2014

Re: [proximity] Meaning of negative values

From: Hirsch Frederick (Nokia-CTO/Boston) <frederick.hirsch@nokia.com>
Date: Tue, 13 May 2014 14:11:01 +0000
To: "Chan Cathy (Nokia-CTO/Boston)" <cathy.chan@nokia.com>
CC: "Hirsch Frederick (Nokia-CTO/Boston)" <frederick.hirsch@nokia.com>, "public-device-apis@w3.org" <public-device-apis@w3.org>
Message-ID: <6F632E69-EA72-4E6F-B796-9254629E21D3@nokia.com>

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).

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. I wonder if there is a documented set of conventions for the HTML5 family of specs that would include this.

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’. 

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

Does this make sense?

regards, frederick

On May 12, 2014, at 1:51 PM, ext Chan Cathy (Nokia-CTO/Boston) <cathy.chan@nokia.com> wrote:

> I'd imagine this would have been discussed, but can anyone remind me what a negative device proximity value mean? An object is detected at the "back" side of the device? 
> [[
> The current device proximity is a value that represents the proximity of the hosting device to a physical object (i.e., some value between the maximum sensing distance and the minimum sensing distance), in centimeters. 
> The minimum sensing distance at which the sensor can detect a physical object, in centimeters. 
> The maximum sensing distance at which the sensor can detect a physical object, in centimeters. 
> ]]
> [[
> The min attribute of the DeviceProximityEvent interface MUST return the value it was initialized to. When the object is created, this attribute MUST be initialized to negative Infinity. It represents the minimum sensing distance.
> ]]
> Thanks.
> - Cathy.
Received on Tuesday, 13 May 2014 14:11:40 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:33:07 UTC