开发者

Data types where precision level means range of tolerance

开发者 https://www.devze.com 2023-04-07 22:16 出处:网络
What existing terminology and art is there for data types that have values implying ranges of tolerance, not specific points?

What existing terminology and art is there for data types that have values implying ranges of tolerance, not specific points?

An example: time values. In ISO 8601 notation, the value 1964 encompasses the values 1964-05, 1964-05-02, 1964-05-02T18, 1964-05-02T18:27, 1964-05-02T18:27:43, 1964-05-02T18:27:43.0613.

That is, each one of those values is not a zero-dimensional point, but an interval encompassing a range of more-precise values.

The more precise values in that set should compare equal to th开发者_开发问答e less-precise ones:

1964 < 1964-05-02 → False
1964 > 1964-05-02 → False
1964 = 1964-05-02 → True

and ‘greater than’ and ‘less than’ should be both false for values encompassed within a less-precise value. The intervals don't overlap, so that's not a concern.

1964-05-02T18:27:43 < 1964-05-02T18:30:11 → True
1964-05-02T18:27:43 < 1964-05-02 → False
1964-05-02T18:27:43 < 1964-05-04 → True

But how should such types be implemented? What kind of comparison am I talking about? What about arithmetic on such values?

In short, what existing body of knowledge should I be looking to for exploration of these concepts?


As your italics managed to work out, this is called interval arithmetic.

You're specifically interested in order and equality relationships between interval values. The wikipedia article doesn't talk about that, but i assume it has been worked on, as it's a fairly basic thing to want to do with numbers, even fuzzy ones.

I would imagine that you would say that two intervals are not equal if their ranges do not overlap at all, and that an interval is greater than another interval if the former's range lies entirely above the latter's.

However, i don't think you can have a sensible definition of equal; you might need several different kinds of quasi-equality. You could say two ranges which are not not equal are equal, but i don't think that really helps. That's more like possibly equal. Then there's your idea of one range containing another, in which case you might say that the larger was roughly equal to the smaller. However, since the roughly equal relationship is not symmetric, it's not an equivalence relation, and so it doesn't make a good kind of general-purpose equality.

Or maybe this whole thing is just a generalised case of the idea of significant figures? I suppose interval arithmetic is just the arithmetic you use to deal with numbers that have significant figures.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号