On 2/4/2012 9:57 AM, Andreas Schwab wrote: \
How can the sine function know which of the millions of numbers represented by 0x1.0f0cf064dd591p+73 are meant? Applying the sine to this interval covers the whole result domain of the function.
The idea that an IEEE number necessarily represents an interval is peculiar. IEEE represents certain numbers exactly. There is no concept of representation of intervals, unless you care to somehow superimpose it. IEEE arithmetic is not about producing some vague ill-defined approximation of real arithmetic, even if programmers may think of it that way, it is about implementing completely well defined operations in a specified manner. Yes, the programmer may regard fpt as some vague approximation of real arithmetic, but the programmer may also be exepcting exact IEEE results, and not think of there being any vague apprximation, just well defined rounding. The sine function gets a number as input, and it is supposed to produce the sine of that number, end of story, where do you find it written that the sine function is somehow supposed to treat the input as an interval? In IEEE arithmetic, the result of all operations is well defined and gives exact results (they may not correspond to the same results as mathematical real arithmetic, but IEEE does not implement mathematical real arithmetic, it implements well defined IEEE operations, which precisely define the output for a given operation given the inputs.) When you write a program in an environment which provides IEEE semantics, all operations are exact, in the sense that they result in well defined results. There is no sense in which, e.g. the addition operator says "eacb of my operands represents a range of possible numbers, therefore the output can be anywhere from X to Y". Instead, it takes the exact representations passed as inputs, and produces a unique, well defined rounded result. The sine function should attempt to do the same thing, take an exact representation passed as input, and return the correctly rounded well-defined result. This is an ideal of course, in practice it may be too much work (and not very useful) for the sine function to fulfill this expectation for the entire input range, as the example which started this thread shows, but that should be the goal.
Andreas.