Thread Links Date Links
Thread Prev Thread Next Thread Index Date Prev Date Next Date Index

Re: textToIntevsal(s) and exceptions



Additional information...

On 2015-03-16 14:34:58 +0100, Vincent Lefevre wrote:
> If the input expects a string, I would say that this can happen when:
>   * the input is not a string (e.g. is a language that is not strongly
>     typed);

Here this doesn't apply to C since there isn't a "string" type.
In C, a string is "a contiguous sequence of characters terminated
by and including the first null character" (ISO C11, §7.1.1) and
this meaning is used only in the library part (§7). A string is
usually provided under the form of a pointer to char, but not all
pointers to char actually correspond to a string.

>   * the input has the right type "string" but the string is invalid
>     as a string (e.g. when UTF-8 encoding is expected but there's an
>     invalid UTF-8 sequence).

This is particularly interesting here since not all applications see
all invalid UTF-8 sequences as invalid (e.g. where a sequence passes
the UTF-8 decoding step, giving an integer, but this integer doesn't
correspond to a valid Unicode codepoint, as specified by the Unicode
standard).

[...]
> > c) s has correct syntax but violates some semantic rule
> >    s="[-inf,-inf]";
> > d) s has correct syntax and passes semantic rules, but condition l <= u
> >    surely fails
> >    s="[2,1]";
> 
> I would say that (c) and (d) should be treated in the same way in the
> set-based flavor. Anyway neither is regarded as a valid empty set,
> i.e. there is no Level 1 value, except if there's an extension[*] or
> we are in a specific flavor: (d) would be valid in a Kaucher flavor.

I don't see why you make a difference between (c) and (d) for the
set-based flavor. Draft 9.5 says in §10.5.8 page 34:

  The operation numsToInterval(l,u), takes extended-real values l
  and u. If (see 10.2) the conditions l <= u, l < +inf and u > -inf
  hold, its value is the nonempty interval [...]
  Otherwise, it has no value.

This is for numsToInterval(l,u). For textToInterval(s), there is the
same rule in §12.11.4 page 56:

  b) Inf-sup form: A string [ l , u ] where l and u are optional
     number literals with l <= u, l < +inf and u > -inf, [...]

-- 
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)