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

Re: [proximity] Meaning of negative values

From: Frederick Hirsch <w3c@fjhirsch.com>
Date: Wed, 14 May 2014 11:26:36 -0400
Cc: Frederick Hirsch <w3c@fjhirsch.com>, "ext Kostiainen, Anssi" <anssi.kostiainen@intel.com>, "public-device-apis@w3.org" <public-device-apis@w3.org>
Message-Id: <F249C26A-8E8C-4876-B2FD-C20D07E314FE@fjhirsch.com>
To: "Chan Cathy (Nokia-CTO/Boston)" <cathy.chan@nokia.com>
A negative finite value should never occur, by definition in the specification.

Thus the API does not define what will  happen if it does occur, since this would be an implementation error related to the spec.

Applications should make sure values are reasonable, however we are not testing the application.

I think you are correct, having the negative finite value test case could be misleading and it isnít clear what the test shows. 

regards Frederick

On May 14, 2014, at 11:00 AM, Chan Cathy (Nokia-CTO/Boston) <cathy.chan@nokia.com> wrote:

> Thanks Frederick and Anssi for the explanations. It makes better sense now.
> Still one question though: should a web app or UA trip on a negative finite value? The reason I ask is there's now a test case with a negative finite value. I wonder if that does more harm than good. In other words, are we incorrectly setting the expectation that negative finite values are a possibility?
> - Cathy.
>> -----Original Message-----
>> From: ext Kostiainen, Anssi [mailto:anssi.kostiainen@intel.com]
>> Sent: Wednesday, May 14, 2014 3:07 AM
>> To: Chan Cathy (Nokia-CTO/Boston); Hirsch Frederick (Nokia-CTO/Boston)
>> Cc: public-device-apis@w3.org
>> Subject: 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 15:27:05 UTC

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