From: Sam S. <sd...@gn...> - 2008-11-26 22:25:07
|
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. I think this is on par with PI not being a constant (because it changes when long-float-digits is modified), i.e., the behavior you observe is a side effect of an extension. |