Hello,<br><br>I try to create a fast double encoder/decoder function for ECL like SBCL's double-float-high-bits, double-float-low-bits and make-double-float. I want to do it, because I want to support ECL by my <a href="http://sites.google.com/a/rl-community.org/rl-glue/Home/Extensions/lisp-codec">library</a>. But I experienced very strange things with using type declarations. I attached my test code.<br>
<br>Results:<br><br>With '(optimize (speed 3) (safety 2) (debug 0))<br>endian: 1<br>---------- 1 ----------<br>5.6d0 =?= 5.6d0<br>-5.6d0 : error 3222693478 is not of type FIXNUM.<br>7.641415267766224d307 : error 3074424831 is not of type FIXNUM.<br>
-7.641415267766224d307 : error 4292555855 is not of type FIXNUM.<br>---------- 2 ----------<br>5.6d0 =?= 5.6d0<br>-5.6d0 =?= -5.6d0<br>7.641415267766224d307 =?= 7.641415267766224d307<br>-7.641415267766224d307 =?= -7.641415267766224d307<br>
<br>With (optimize (speed 3) (safety 0) (debug 0))<br>endian: 1<br>---------- 1 ----------<br>5.6d0 =?= 7.771840340661374d-298<br>-5.6d0 =?= 7.771782011685204d-298<br>7.641415267766224d307 =?= 7.771723682709034d-298<br>-7.641415267766224d307 =?= 7.771665353732864d-298<br>
---------- 2 ----------<br>5.6d0 =?= 7.77160702475668d-298<br>-5.6d0 =?= 7.771052899483105d-298<br>7.641415267766224d307 =?= 7.771023734994973d-298<br>-7.641415267766224d307 =?= -7.641412237423105d307<br><br>Versions:<br>
ECL (Embeddable Common-Lisp) 9.6.2 (I tried it with 9.6.1 as well, same results)<br>gcc (Ubuntu 4.3.3-5ubuntu4) 4.3.3<br>Linux udyo 2.6.28-13-generic #45-Ubuntu SMP Tue Jun 30 19:49:51 UTC 2009 i686 GNU/Linux<br>My computer is a 32bit architecture.<br>
<br>Any ideas, recommendations?<br><br>Thanks,<br>`Gabor`<br><br>