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

RE: [proximity] Meaning of negative values

From: Chan Cathy (Nokia-CTO/Boston) <cathy.chan@nokia.com>
Date: Wed, 14 May 2014 15:00:06 +0000
To: "ext Kostiainen, Anssi" <anssi.kostiainen@intel.com>, "Hirsch Frederick (Nokia-CTO/Boston)" <frederick.hirsch@nokia.com>
CC: "public-device-apis@w3.org" <public-device-apis@w3.org>
Message-ID: <ad97a833f57040fdbbc68ddf72399303@NOKWDCFIEXCH02P.nnok.nokia.com>
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:00:38 UTC

This archive was generated by hypermail 2.3.1 : Monday, 23 October 2017 14:54:03 UTC