From a439feca16f10eed6c860573a7ea33fac43604e8 Mon Sep 17 00:00:00 2001 From: "Tarn W. Burton" Date: Mon, 8 Jul 2024 09:27:31 -0400 Subject: [PATCH] benchmark: add report/float-traits --- code/benchmark/packages.lisp | 3 ++- code/benchmark/report.lisp | 27 +++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/code/benchmark/packages.lisp b/code/benchmark/packages.lisp index c4dd7a14..102b8573 100644 --- a/code/benchmark/packages.lisp +++ b/code/benchmark/packages.lisp @@ -4,4 +4,5 @@ (:use #:common-lisp) (:export #:float-integer #:integer-float - #:report)) + #:report + #:report/float-traits)) diff --git a/code/benchmark/report.lisp b/code/benchmark/report.lisp index 60f221ec..bbabfccd 100644 --- a/code/benchmark/report.lisp +++ b/code/benchmark/report.lisp @@ -168,3 +168,30 @@ and collect (make-string 21 :initial-element #\space))))) (ascii-table:display table))) + +(defun report/float-traits () + (let ((table (ascii-table:make-table + (list "trait" + #+quaviver/short-float "short-float" + "single-float" + "double-float" + #+quaviver/long-float "long-float")))) + (loop for trait in '(quaviver:storage-size + quaviver:significand-size + quaviver:exponent-size + quaviver:sign-size + quaviver:hidden-bit-p + quaviver:subnormalp + quaviver:non-number-p + quaviver:exponent-bias + quaviver:max-exponent + quaviver:min-exponent + quaviver:arithmetic-size) + do (ascii-table:add-row table + (list (string-downcase (symbol-name trait)) + #+quaviver/short-float (funcall trait 'short-float) + (funcall trait 'single-float) + (funcall trait 'double-float) + #+quaviver/long-float (funcall trait 'long-float)))) + (format t "~a float traits~%" (lisp-implementation-type)) + (ascii-table:display table)))