Thread Links | Date Links | ||||
---|---|---|---|---|---|
Thread Prev | Thread Next | Thread Index | Date Prev | Date Next | Date Index |
On Tuesday, 19 de February de 2013 at 18:32, Dan Zuras Intervals wrote:
Date: Tue, 19 Feb 2013 12:37:40 -0800From: Richard Fateman <fateman@xxxxxxxxxxxxxxxxx>To: "'stds-1788'" <stds-1788@xxxxxxxxxxxxxxxxx>Subject: dependent and independent intervals, proposal to toss out text2interval. Was re: about emp (was: Motion 42:no)Folks,I have remained silent on this problem since it began.(Actually, I am mostly listening to this list these days.)But Richard has raised a point about decimal to binary conversionthat I'm not quite sure he is aware of. Indeed, as the quotationsare a bit unclear, *I'M* not quite sure just who raised it.In the past, I have considered problems such as the conversion ofexpressions like "0.1 + pi" or "0.1 + 3.141" as being the conversionof strings to intervals followed by an interval add.Now lets ignore the interval add on the grounds that we all knowhow its done. But what about the string conversion? Again, in thepast, I have always considered it a problem of generalizing thefloating-point string conversion to intervals.In the floating-point conversion, one converts the entire stringto the form m*10^e or m/10^e, exactly if possible, & does thefloating-point operation on those (mostly) exact floating-pointoperands. For interval conversion, I would generalize to somethinglike [m-1,m+1]*[10^e-ulp,10^e+ulp] which is already widening theresult quite enough to cover the original decimal operand.However, given the way it is written, 0.1 + 3.141, such a formulamust be converted to something equivalent to an interval like[0,0.2] + [3.140,3.142] = [3.140,3.342] which is quite a bit widerthan I believe the user expects. *I*, as a user, would expectsomething like 0.10000000000 + 3.14100000000 to be the result.This has 2 problems. If you don't do it then the user is leftwith far wider intervals than I believe are reasonable. And ifyou do, the result of 0.10000000000 + 3.14100000000 will notcontain the answer to 0.1 + pi.Which is it to be? We can justify the first even if the usercannot. I don't believe we can justify the latter.But its up to you...DanOn 2/19/2013 2:00 AM, Guillaume Melquiond wrote:.... snip, , expressions meaning what they say...I think that whatever advantage can be gained by allowing an implementationto process string expressions like "0.1 + pi" is more than overcome by. . .If we are allowed to be slightly sloppy, by about half a unit in thelast place, we can takethe closest binary approximation for 0.1d0 and widen it by one ulp upand down, and encloseit. It turns out that for careful decimal-to-binary conversion, thisinterval willalso enclose the mathematical value of 1/10 as well.If we want to get the _tightest_ interval some work is required but I'mnot sure which of severalapproaches is simplest.One way is to form an interval [1.0d0,1.0d0] and divide by the scalar10.0d0. If proper IEEE-754directed rounding is available, we are done.Any decimal constant, say 3.141, could be done byscalar_to_interval(3141d0)/10^3.(I believe that directed rounding here can be cheaply simulated bydefault rounding-to-nearestby bumping 3141 up and down before division. for example, to get thetightest enclosurearound 1/3, in double-float binary, let eps = double-float-epsilon =2.0d0^-53= 1.11022...d-16;then create an interval [ 3141*(1-eps), 3141*(1+eps)] and thendivide, default rounding,by 10.)Another more elaborate way is to make available tight intervals around1/10, 1/100, etc.. . .Richard Fateman