From: Paul K. <pv...@pv...> - 2009-11-13 15:53:19
|
On 2009-11-13, at 8:50 AM, alexander a donkov wrote: > Dear Paul Khuong, > my name is alexander, i am a beginner user of sbcl (about a year). > I noticed your blog on complex float improvements in sbcl, x86-64, > and that is why i am addressing this email to you. > > i noticed that the current 1.0.32 sbcl, at least when installed on > my mac, gives a different result when a real number is added to a > complex number with -0.0 imaginary part. [...] > Perhaps, the real number is now promoted to complex with a zero im > part, which is mostly ok, but comes into trouble when signed zeros > are considered. > My understanding of the problem with dealing with signed zeros comes > from the Kahan's article on complex arithmetic: > http://www.eecs.berkeley.edu/Pubs/TechRpts/1992/CSD-92-667.pdf This is intentional. The CL specification explicitly demands that (+ real complex) [or any other arithmetic operation] be equivalent to (+ real (complex complex)). Since we do not have a special case for complex floats with an exactly zero imaginary part, signed zeros get absorbed. Either interpretation of real-complex arithmetic isn't hard to implement, but we should first decide whether we want to stray from the spec on that topic. Paul Khuong |