Thanks for the detailed reading, Jason. If the input is a unum, then the only way for it to contain zero is to be exactly zero. And that was the way the example was used. If the input to the function is a ubound, then you are correct that the test would need to be rewritten.
On Friday, July 31, 2015 at 9:51:57 AM UTC-7, Jason Merrill wrote: > > On Thursday, July 30, 2015 at 3:54:39 PM UTC-4, Jason Merrill wrote: >> >> >> * "Wrath of Kahan, 2" >> In the unum computation, squaring operations are fused with squareu, but >> float Interval calculations are not fused. I also believe the check for the >> ubounds containing zero in e[z] is erroneous in a way that makes this >> example very deceiving, but I don't want to go into that detail here. >> > > Since it looks like Dr. Gustafson is reading this thread, I wanted to give > my specific objection to this example. You should be able to read the > relevant text of the book here: > > > https://books.google.com/books?id=fZsXBgAAQBAJ&pg=PA176&lpg=PA176&dq=Kahan+constructed+the+following+fiendishly+clever+example&source=bl&ots=MH0vfJyw2V&sig=ZEzOR7sCXGyzcRbncbqlRQJdWaA&hl=en&sa=X&ved=0CB4Q6AEwAGoVChMIr9HmxOeFxwIVRlw-Ch3wjQ2K#v=onepage&q=Kahan%20constructed%20the%20following%20fiendishly%20clever%20example&f=false > > There's a function e(x) = (exp(x) - 1)/x, defined to be 1 when x is 0. In > the unum definition of this function, the function checks whether x > *contains* zero when x is a ubound, and in this case, returns 1 exactly. > This incorrectly collapses bounds with a finite width down to an exact > answer. > > If you look at the output of q(x) for the example points suggested in the > text, it is a bound of finite width, but the containment check in e(x) > collapses e(q(x)^2) down to an exact value, making unums look better than > they are. > > To be clear, I interpret this as an honest mistake, but this is also one > of the high excitement points of the book (at least it was for me), so it's > important to be very careful about what's really going on here. >