Path: utzoo!attcan!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!yale!mintaka!ogicse!orstcs!tgd@tesla.CS.ORST.EDU From: tgd@tesla.CS.ORST.EDU (Tom Dietterich) Newsgroups: comp.lang.lisp Subject: Re: Floating point in CL? Summary: Use compiler tracing facilities Keywords: lucid, franz Message-ID: <20643@orstcs.CS.ORST.EDU> Date: 29 Sep 90 21:35:52 GMT References: Sender: usenet@orstcs.CS.ORST.EDU Distribution: comp Organization: Computer Science Department, Oregon State Univ. Lines: 44 To write good floating point code, I have found it essential to use the facilities of the lucid and franz compilers to trace the compilation process. In lucid, you can do the following in your source file: (eval-when (compile) (compiler-options :show-optimizations t)) (defun ....) (eval-when (compile) (compiler-options :show-optimizations nil)) When you invoke the production compiler, you will get a very nice listing showing the type inference of the compiler and any expressions that it could not fail to optimize. In franz, the thing to do is include (defun .... (declare (:explain :calls :types)) ) which gives a similar (but not quite as pretty) trace. --Tom P.S. In lucid, all floats should be declared single-float, and I find it essential to call (the ..) quite often. Short floats are handled incorrectly (at least in lucid3.0 on sparc architectures). P.P.S. Many folks simply define their own versions of +, -, etc that include calls to the at each point: For example: (courtesy of Scott Fahlman) (defmacro *sf (&rest args) `(the single-float (* ,@(mapcar #'(lambda (x) (list 'the 'single-float x)) args)))) -- Thomas G. Dietterich Department of Computer Science Dearborn Hall, 303 Oregon State University