I have uploaded a fix. ECL will only constant fold a function when the output is an externalizable value or the function which is evaluated signals an error.<div><br></div><div>Juanjo<br><br><div class="gmail_quote">On Mon, Dec 19, 2011 at 7:00 PM, Waldek Hebisch <span dir="ltr"><<a href="mailto:hebisch@math.uni.wroc.pl">hebisch@math.uni.wroc.pl</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Put the the following line in a file:<br>
<br>
(DEFUN |nangenericcomplex| () (PROG () (RETURN (/ 1.0 (COMPLEX 0.0)))))<br>
<br>
And then try to compile-file it:<br>
<br>
> (compile-file "sfsfun.clisp")<br>
<br>
;;; Loading #P"/var/tmp/hebisch/usr/lib/ecl-11.1.1/cmp.fas"<br>
;;;<br>
;;; Compiling sfsfun.clisp.<br>
;;; OPTIMIZE levels: Safety=2, Space=0, Speed=3, Debug=0<br>
;;;<br>
;;; Compiling (DEFUN |nangenericcomplex| ...).<br>
;;; End of Pass 1.<br>
;;; Emitting code for |nangenericcomplex|.<br>
;;; Internal error:<br>
;;; ** Cannot print object #<single-float quiet NaN> readably.<br>
NIL<br>
NIL<br>
NIL<br>
<br>
FriCAS uses such a function to raise floating point errors<br>
when appropriate. In principle I could divide by "runtime"<br>
zero (I have one at hand as just before call to |nangenericcomplex|<br>
I have test which checks that number to be used as divisor is zero).<br>
But having separate function seems clearer. And some day compiler<br>
may be smart enough to realize that "runtime" zero is a zero and<br>
try to constant fold it...<br>
<br>
--<br>
Waldek Hebisch<br>
<a href="mailto:hebisch@math.uni.wroc.pl">hebisch@math.uni.wroc.pl</a><br>
<br>
------------------------------------------------------------------------------<br>
Learn Windows Azure Live! Tuesday, Dec 13, 2011<br>
Microsoft is holding a special Learn Windows Azure training event for<br>
developers. It will provide a great way to learn Windows Azure and what it<br>
provides. You can attend the event by watching it streamed LIVE online.<br>
Learn more at <a href="http://p.sf.net/sfu/ms-windowsazure" target="_blank">http://p.sf.net/sfu/ms-windowsazure</a><br>
_______________________________________________<br>
Ecls-list mailing list<br>
<a href="mailto:Ecls-list@lists.sourceforge.net">Ecls-list@lists.sourceforge.net</a><br>
<a href="https://lists.sourceforge.net/lists/listinfo/ecls-list" target="_blank">https://lists.sourceforge.net/lists/listinfo/ecls-list</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Instituto de Física Fundamental, CSIC<br>c/ Serrano, 113b, Madrid 28006 (Spain) <br><a href="http://juanjose.garciaripoll.googlepages.com" target="_blank">http://juanjose.garciaripoll.googlepages.com</a><br>
</div>