From 2c68c6f00896c997ec91937face103eee366a4d8 Mon Sep 17 00:00:00 2001 From: Juan Jose Garcia Ripoll Date: Fri, 4 Jun 2010 15:21:39 +0200 Subject: [PATCH] Activated the use of statically defined floating point constants in compiled code --- src/cmp/cmpwt.lsp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/cmp/cmpwt.lsp b/src/cmp/cmpwt.lsp index bb5d9a614..f8d3680a6 100644 --- a/src/cmp/cmpwt.lsp +++ b/src/cmp/cmpwt.lsp @@ -170,13 +170,15 @@ (defun static-single-float-builder (name value stream) (let* ((*read-default-float-format* 'single-float) - (*print-readably* t)) - (format stream "ecl_def_ct_single_float(~A,~S,static,const);" name value stream))) + (*print-readably* t)) + (format stream "ecl_def_ct_single_float(~A,~S,static,const);" + name value stream))) (defun static-double-float-builder (name value stream) (let* ((*read-default-float-format* 'double-float) - (*print-readably* t)) - (format stream "ecl_def_ct_single_float(~A,~S,static,const);" name value stream))) + (*print-readably* t)) + (format stream "ecl_def_ct_double_float(~A,~S,static,const);" + name value stream))) (defun static-constant-builder (format value) (lambda (name stream) @@ -185,8 +187,12 @@ (defun static-constant-expression (object) (typecase object (base-string #'static-base-string-builder) - ;;(single-float #'static-single-float-builder) - ;;(double-float #'static-double-float-builder) + (single-float (and (not (si:float-nan-p object)) + (not (si:float-infinity-p object)) + #'static-single-float-builder)) + (double-float (and (not (si:float-nan-p object)) + (not (si:float-infinity-p object)) + #'static-double-float-builder)) (t nil))) (defun add-static-constant (object)