From: Raymond T. <toy...@gm...> - 2008-11-27 00:49:39
|
Sam Steingold wrote: > Raymond Toy wrote: >> Sam Steingold wrote: >>> Raymond Toy wrote: >>>> >>>> (let ((x (complex 0.0))) >>>> (check-type x complex)) >>>> >>>> I believe CL must return NIL here, but clisp produces an error that X >>>> is not of type COMPLEX. >>>> >>>> I understand why clisp does this, but this is valid ANSI code that >>>> ought to work. >>>> >>>> Should there be (yet another!) flag control how complex contagion >>>> works, like there is for float contagion? >>>> >>> looks like it. >>> what does this have to do with "contagion"? >>> >> Because I was looking at clhs #C entry and it refers to contagion in >> numeric operations. So it's not complex contagion, but is it float >> contagion. >> >> I assume that if the flag is set, the complex numeric stuff in imp notes >> will also have to be changed to reflect this. > > on a second thought (and the first reading of > http://www.lispworks.com/documentation/HyperSpec/Body/f_comp_2.htm), > clisp is fine. > clisp extends the COMPLEX type to hold different types in real and > imaginary parts, and the behavior you observe is consistent with this > extension. > note that COMPLEX is permitted to return a rational (not a complex), so > > (let ((x (complex 0))) > (check-type x complex)) > > will signal an error in a compliant implementation. > But the section on complex says complex returns either a rational or a complex. (complex 0.0) returns neither. Ray |