Commit 076f9358 authored by Liam M. Healy's avatar Liam M. Healy
Browse files

Better C floating point parsing; add dependency in gsll.asd

parent 65643447
;; Definition of GSLL system
;; Liam Healy
;; Time-stamp: <2010-04-17 18:47:14EDT gsll.asd>
;; Time-stamp: <2010-05-25 11:54:09EDT gsll.asd>
;; Copyright 2006, 2007, 2008, 2009 Liam M. Healy
;; Distributed under the terms of the GNU General Public License
......@@ -160,7 +160,7 @@
((:file "rng-types")
(:file "generators" :depends-on ("rng-types"))
(:file "quasi" :depends-on ("rng-types" "generators"))
(:file "tests")
(:file "tests" :depends-on ("rng-types"))
(:file "gaussian" :depends-on ("rng-types"))
(:file "gaussian-tail" :depends-on ("rng-types"))
(:file "gaussian-bivariate" :depends-on ("rng-types"))
;; Convert the GSL tests
;; Liam Healy 2010-05-22 13:03:53EDT convert.lisp
;; Time-stamp: <2010-05-25 23:15:21EDT convert.lisp>
;; Time-stamp: <2010-05-26 10:05:26EDT convert.lisp>
;;; This file is not normally loaded; it is only used to convert the
;;; GSL tests in C to CL tests. It requires cl-ppcre, lisp-util, and iterate.
......@@ -59,25 +59,21 @@
(second registers)))
:simple-calls t))
(defvar *float-parse-regex*
;; Based on advice given in
(cl-ppcre:parse-string "([-+]?[0-9]*\\.?[0-9]+)([eE][-+]?[0-9]+)?")
"A ppcre regular expression that matches a C floating point number.")
(defun translate-c-numbers (string)
"Translate the literal numbers in the string to CL double-float."
(cl-ppcre:regex-replace-all ; Floats without exponents become double-floats
(cl-ppcre:regex-replace-all ; Floats with "e" exponent become double-floats
;; need to exempt d from the first case
(cl-ppcre:regex-replace-all "([-+]?[0-9]*\\.?[0-9]+)" "-4.2134" "\\{1}d0")
(cl-ppcre:regex-replace-all "([-+]?[0-9]*\\.?[0-9]+)[eE](([-+]?[0-9]+)?)"
(lambda (match mant expon)
(declare (ignore match))
(format nil "~ad~:[0~;~a~]" mant expon (when expon (subseq expon 1))))
:simple-calls t))
(defun replace-tolerance (string)
(cl-ppcre:regex-replace "TEST_(\\w*)" string "+TEST-\\{1}+"))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment