Re: Efficient interval representation
- From: Ben Pfaff <blp@xxxxxxxxxxxxxxx>
- Date: Fri, 31 Aug 2007 08:08:36 -0700
Tim Frink <plfriko@xxxxxxxx> writes:
...let's assume that the variable
is represented by the interval <10..255> at some point
of the program (program under analysis is a C source, so the
data type unsigned char has a bit length of 8).
When I now add a constant to that value, let's say <5..5>,
I have a wrap-around. IMHO, there are not two ways how to
represent the result:
a) again <0..255>. However, here I have a loss of precision
since the values <5..14> are actually not possible in the
sum
b) the result is represented by two intervals:
<0..4> and <15..255>. This form fosters precision since just
feasible values are given
Can't you just represent that "wraparound" interval with
<15...4>, and interpret such a "backward" interval as
<15...255>,<0...4>? Or is your problem actually more general
than that?
--
"[Modern] war is waged by each ruling group against its own subjects,
and the object of the war is not to make or prevent conquests of territory,
but to keep the structure of society intact."
--George Orwell, _1984_
.
- References:
- Efficient interval representation
- From: Tim Frink
- Efficient interval representation
- Prev by Date: Re: Coding Standards
- Next by Date: programming languages
- Previous by thread: Re: Efficient interval representation
- Next by thread: Re: Coding Standards
- Index(es):