From 8f708f8aed8b9f7fca11d0ccd2a9f9d8ad6d8387 Mon Sep 17 00:00:00 2001 From: "Tarn W. Burton" Date: Tue, 6 Aug 2024 10:49:41 -0400 Subject: [PATCH] various: rename float-integer, etc to float-triple --- .github/workflows/test.yml | 18 +++---- .../{float-integer.lisp => float-triple.lisp} | 24 ++++----- code/benchmark/packages.lisp | 4 +- .../{integer-float.lisp => triple-float.lisp} | 18 +++---- code/blub/implementation.lisp | 2 +- code/burger-dybvig/implementation.lisp | 24 ++++----- code/c/implementation.lisp | 4 +- code/common-lisp/implementation.lisp | 2 +- .../{float-integer.lisp => float-triple.lisp} | 28 +++++----- code/compare/interval.lisp | 2 +- code/compare/packages.lisp | 16 +++--- .../{integer-float.lisp => triple-float.lisp} | 26 ++++----- code/dragonbox/implementation.lisp | 20 +++---- code/float-integer.lisp | 36 ------------- ....lisp => float-primitive-triple-form.lisp} | 52 +++++++++--------- code/float-triple.lisp | 36 +++++++++++++ code/fortran/implementation.lisp | 4 +- code/interface.lisp | 8 +-- code/jaffer/implementation.lisp | 22 ++++---- code/json/implementation.lisp | 2 +- code/liebler/implementation.lisp | 18 +++---- .../{float-integer.lisp => float-triple.lisp} | 4 +- .../{integer-float.lisp => triple-float.lisp} | 8 +-- code/number-parser.lisp | 40 +++++++------- code/packages.lisp | 8 +-- ....lisp => primitive-triple-float-form.lisp} | 54 +++++++++---------- code/python/implementation.lisp | 2 +- code/schubfach/implementation.lisp | 12 ++--- code/trailing-zeros/implementation.lisp | 10 ++-- .../{integer-float.lisp => triple-float.lisp} | 24 ++++----- code/unit-test/json.lisp | 2 +- quaviver.asd | 20 +++---- 32 files changed, 275 insertions(+), 275 deletions(-) rename code/benchmark/{float-integer.lisp => float-triple.lisp} (59%) rename code/benchmark/{integer-float.lisp => triple-float.lisp} (74%) rename code/compare/{float-integer.lisp => float-triple.lisp} (85%) rename code/compare/{integer-float.lisp => triple-float.lisp} (71%) delete mode 100644 code/float-integer.lisp rename code/{float-internal-integer-form.lisp => float-primitive-triple-form.lisp} (67%) create mode 100644 code/float-triple.lisp rename code/native/{float-integer.lisp => float-triple.lisp} (96%) rename code/native/{integer-float.lisp => triple-float.lisp} (79%) rename code/{internal-integer-float-form.lisp => primitive-triple-float-form.lisp} (72%) rename code/{integer-float.lisp => triple-float.lisp} (57%) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 94fd02f6..d1566514 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -37,19 +37,19 @@ jobs: with: repository: s-expressionists/Incless path: incless - ref: quaviver3 + ref: quaviver4 - name: Checkout Inravina uses: actions/checkout@v4 with: repository: s-expressionists/Inravina path: inravina - ref: quaviver3 + ref: quaviver4 - name: Checkout Invistra uses: actions/checkout@v4 with: repository: s-expressionists/Invistra path: invistra - ref: quaviver3 + ref: quaviver4 - name: Checkout Repository uses: actions/checkout@v4 with: @@ -64,18 +64,18 @@ jobs: - name: Run ANSI Tests run: | lisp -i ${{ matrix.lisp }} -e "(ql:quickload :quaviver/ansi-test)" -e "(quaviver/ansi-test:test :exit t)" - - name: float-integer/Burger-Dybvig vs Schubfach + - name: float-triple/Burger-Dybvig vs Schubfach if: ${{ matrix.lisp != 'cmucl' }} run: | - lisp -i ${{ matrix.lisp }} -e "(ql:quickload :quaviver/compare)" -e "(quaviver/compare:float-integer/bd.s/f :coverage 0.001 :exit t :output \"failures-float-integer-bd-s.sexp\")" - - name: float-integer/Schubfach vs Dragonbox + lisp -i ${{ matrix.lisp }} -e "(ql:quickload :quaviver/compare)" -e "(quaviver/compare:float-triple/bd.s/f :coverage 0.001 :exit t :output \"failures-float-triple-bd-s.sexp\")" + - name: float-triple/Schubfach vs Dragonbox if: ${{ matrix.lisp != 'cmucl' }} run: | - lisp -i ${{ matrix.lisp }} -e "(ql:quickload :quaviver/compare)" -e "(quaviver/compare:float-integer/s.d/f :coverage 0.001 :exit t :output \"failures-float-integer-s-d.sexp\")" - - name: integer-float/Jaffer vs Liebler + lisp -i ${{ matrix.lisp }} -e "(ql:quickload :quaviver/compare)" -e "(quaviver/compare:float-triple/s.d/f :coverage 0.001 :exit t :output \"failures-float-triple-s-d.sexp\")" + - name: triple-float/Jaffer vs Liebler if: ${{ matrix.lisp != 'cmucl' }} run: | - lisp -i ${{ matrix.lisp }} -e "(ql:quickload :quaviver/compare)" -e "(quaviver/compare:integer-float/j.l/f :coverage 0.001 :exit t :output \"failures-integer-float-j-l.sexp\")" + lisp -i ${{ matrix.lisp }} -e "(ql:quickload :quaviver/compare)" -e "(quaviver/compare:triple-float/j.l/f :coverage 0.001 :exit t :output \"failures-triple-float-j-l.sexp\")" - name: Upload comparison results uses: actions/upload-artifact@v4 if: failure() diff --git a/code/benchmark/float-integer.lisp b/code/benchmark/float-triple.lisp similarity index 59% rename from code/benchmark/float-integer.lisp rename to code/benchmark/float-triple.lisp index 218727f9..c20bfa10 100644 --- a/code/benchmark/float-integer.lisp +++ b/code/benchmark/float-triple.lisp @@ -1,6 +1,6 @@ (cl:in-package #:quaviver/benchmark) -(defvar *float-integer-tests* +(defvar *float-triple-tests* (list #+quaviver/short-float `(:type short-float :limit ,most-positive-short-float) `(:type single-float :limit ,most-positive-single-float) @@ -8,7 +8,7 @@ #+quaviver/long-float `(:type long-float :limit ,most-positive-long-float))) -(defvar *float-integer-clients* +(defvar *float-triple-clients* `((:label "Burger-Dybvig" :initargs (quaviver/burger-dybvig:client) :types (short-float single-float double-float long-float)) @@ -23,14 +23,14 @@ :initargs (quaviver/native:benchmark-client) :types (short-float single-float double-float long-float)))) -(defun float-integer (&key (base 10) - (name (uiop:implementation-identifier))) +(defun float-triple (&key (base 10) + (name (uiop:implementation-identifier))) (let ((results (bench (lambda (client &key type limit) - (quaviver:float-integer client - base - (* (1- (ash (random 2) 1)) - (random limit)))) - *float-integer-tests* - *float-integer-clients*))) - (write-results name `(quaviver:float-integer ,base) results) - (report/run-summary "float-integer" *float-integer-tests* results))) + (quaviver:float-triple client + base + (* (1- (ash (random 2) 1)) + (random limit)))) + *float-triple-tests* + *float-triple-clients*))) + (write-results name `(quaviver:float-triple ,base) results) + (report/run-summary "float-triple" *float-triple-tests* results))) diff --git a/code/benchmark/packages.lisp b/code/benchmark/packages.lisp index 102b8573..552f27f8 100644 --- a/code/benchmark/packages.lisp +++ b/code/benchmark/packages.lisp @@ -2,7 +2,7 @@ (defpackage #:quaviver/benchmark (:use #:common-lisp) - (:export #:float-integer - #:integer-float + (:export #:float-triple + #:triple-float #:report #:report/float-traits)) diff --git a/code/benchmark/integer-float.lisp b/code/benchmark/triple-float.lisp similarity index 74% rename from code/benchmark/integer-float.lisp rename to code/benchmark/triple-float.lisp index 69c3a053..7d50e123 100644 --- a/code/benchmark/integer-float.lisp +++ b/code/benchmark/triple-float.lisp @@ -1,12 +1,12 @@ (cl:in-package #:quaviver/benchmark) -(defvar *integer-float-tests* +(defvar *triple-float-tests* (list `(:type single-float) `(:type double-float) #+quaviver/long-float `(:type long-float))) -(defvar *integer-float-clients* +(defvar *triple-float-clients* `((:label "Jaffer" :initargs (quaviver/jaffer:client) :types (single-float double-float long-float)) @@ -29,13 +29,13 @@ 2)) (if (zerop (random 2)) 1 -1))) -(defun integer-float (&key (base 10) - (name (uiop:implementation-identifier))) +(defun triple-float (&key (base 10) + (name (uiop:implementation-identifier))) (let ((results (bench (lambda (client &key type) - (apply #'quaviver:integer-float + (apply #'quaviver:triple-float client type base (random-float type))) - *integer-float-tests* - *integer-float-clients*))) - (write-results name `(quaviver:integer-float ,base) results) - (report/run-summary "integer-float" *integer-float-tests* results))) + *triple-float-tests* + *triple-float-clients*))) + (write-results name `(quaviver:triple-float ,base) results) + (report/run-summary "triple-float" *triple-float-tests* results))) diff --git a/code/blub/implementation.lisp b/code/blub/implementation.lisp index 751d20fa..a3f387c4 100644 --- a/code/blub/implementation.lisp +++ b/code/blub/implementation.lisp @@ -32,7 +32,7 @@ (defmethod quaviver:write-number ((client client) (base (eql 10)) (value float) stream) (multiple-value-bind (significand exponent sign) - (quaviver:float-integer client base value) + (quaviver:float-triple client base value) (when (keywordp exponent) (error "Unable to represent ~a in ~a." exponent (client-standard client))) (when (minusp sign) diff --git a/code/burger-dybvig/implementation.lisp b/code/burger-dybvig/implementation.lisp index 8e983936..91f7b4a3 100644 --- a/code/burger-dybvig/implementation.lisp +++ b/code/burger-dybvig/implementation.lisp @@ -235,7 +235,7 @@ (defmacro %burger-dybvig/basic (client float-type value) (declare (ignore client)) `(multiple-value-bind (significand exponent sign) - ,(quaviver:float-internal-integer-form float-type value) + ,(quaviver:float-primitive-triple-form float-type value) (if (or (keywordp exponent) (zerop significand)) (values significand exponent sign) @@ -285,7 +285,7 @@ (incf value (* factor d)))))))) #+clisp -(defmethod quaviver:float-integer ((client basic-client) (base (eql 10)) value) +(defmethod quaviver:float-triple ((client basic-client) (base (eql 10)) value) (typecase value #+quaviver/short-float (short-float @@ -301,19 +301,19 @@ (call-next-method)))) #+(and (not clisp) quaviver/short-float) -(defmethod quaviver:float-integer ((client basic-client) (base (eql 10)) (value short-float)) +(defmethod quaviver:float-triple ((client basic-client) (base (eql 10)) (value short-float)) (%burger-dybvig/basic client short-float value)) #-clisp -(defmethod quaviver:float-integer ((client basic-client) (base (eql 10)) (value single-float)) +(defmethod quaviver:float-triple ((client basic-client) (base (eql 10)) (value single-float)) (%burger-dybvig/basic client single-float value)) #-clisp -(defmethod quaviver:float-integer ((client basic-client) (base (eql 10)) (value double-float)) +(defmethod quaviver:float-triple ((client basic-client) (base (eql 10)) (value double-float)) (%burger-dybvig/basic client double-float value)) #+(and (not clisp) quaviver/long-float) -(defmethod quaviver:float-integer ((client basic-client) (base (eql 10)) (value long-float)) +(defmethod quaviver:float-triple ((client basic-client) (base (eql 10)) (value long-float)) (%burger-dybvig/basic client long-float value)) (defun int-1 (x) @@ -348,7 +348,7 @@ (defmacro %burger-dybvig (client float-type value) (declare (ignore client)) `(multiple-value-bind (f e sign) - ,(quaviver:float-internal-integer-form float-type value) + ,(quaviver:float-primitive-triple-form float-type value) (cond ((or (not (numberp e)) (zerop f)) (values f e sign)) @@ -411,7 +411,7 @@ (go next))))))))) #+clisp -(defmethod quaviver:float-integer ((client client) (base (eql 10)) value) +(defmethod quaviver:float-triple ((client client) (base (eql 10)) value) (typecase value #+quaviver/short-float (short-float @@ -427,17 +427,17 @@ (call-next-method)))) #+(and (not clisp) quaviver/short-float) -(defmethod quaviver:float-integer ((client client) (base (eql 10)) (value short-float)) +(defmethod quaviver:float-triple ((client client) (base (eql 10)) (value short-float)) (%burger-dybvig client short-float value)) #-clisp -(defmethod quaviver:float-integer ((client client) (base (eql 10)) (value single-float)) +(defmethod quaviver:float-triple ((client client) (base (eql 10)) (value single-float)) (%burger-dybvig client single-float value)) #-clisp -(defmethod quaviver:float-integer ((client client) (base (eql 10)) (value double-float)) +(defmethod quaviver:float-triple ((client client) (base (eql 10)) (value double-float)) (%burger-dybvig client double-float value)) #+(and (not clisp) quaviver/long-float) -(defmethod quaviver:float-integer ((client client) (base (eql 10)) (value long-float)) +(defmethod quaviver:float-triple ((client client) (base (eql 10)) (value long-float)) (%burger-dybvig client long-float value)) diff --git a/code/c/implementation.lisp b/code/c/implementation.lisp index 418747bf..380d23e5 100644 --- a/code/c/implementation.lisp +++ b/code/c/implementation.lisp @@ -208,7 +208,7 @@ (defmethod quaviver:write-number ((client client) (base (eql 10)) (value float) stream) (multiple-value-bind (significand exponent sign) - (quaviver:float-integer client base value) + (quaviver:float-triple client base value) (when (keywordp exponent) (error "Unable to represent ~a in ~a." exponent (client-standard client))) (when (minusp sign) @@ -236,7 +236,7 @@ (defmethod quaviver:write-number ((client client) (base (eql 16)) (value float) stream) (multiple-value-bind (significand exponent sign) - (quaviver:float-integer client 2 value) + (quaviver:float-triple client 2 value) (when (keywordp exponent) (error "Unable to represent ~a in ~a." exponent (client-standard client))) (when (minusp sign) diff --git a/code/common-lisp/implementation.lisp b/code/common-lisp/implementation.lisp index d8b3c5e4..2d9cc7b7 100644 --- a/code/common-lisp/implementation.lisp +++ b/code/common-lisp/implementation.lisp @@ -105,7 +105,7 @@ (defmethod quaviver:write-number ((client client) base (value float) stream) (declare (ignore base)) (multiple-value-bind (significand exponent sign) - (quaviver:float-integer client 10 value) + (quaviver:float-triple client 10 value) (cond ((and (extended-exponent-sign-p client) (eq exponent :infinity)) (when (minusp sign) diff --git a/code/compare/float-integer.lisp b/code/compare/float-triple.lisp similarity index 85% rename from code/compare/float-integer.lisp rename to code/compare/float-triple.lisp index ab01202c..7f713ddd 100644 --- a/code/compare/float-integer.lisp +++ b/code/compare/float-triple.lisp @@ -3,7 +3,7 @@ (cl:in-package #:quaviver/compare) -(defclass float-integer () +(defclass float-triple () ((name :reader test-name :initarg :name :initform nil) @@ -14,16 +14,16 @@ (base :accessor base :initarg :base))) -(defun compare/float-integer (test iterator) +(defun compare/float-triple (test iterator) (with-accessors ((client1 client1) (client2 client2) (base base)) test (let ((value (iterator-float iterator))) (multiple-value-bind (significand1 exponent1 sign1) - (quaviver:float-integer client1 base value) + (quaviver:float-triple client1 base value) (multiple-value-bind (significand2 exponent2 sign2) - (quaviver:float-integer client2 base value) + (quaviver:float-triple client2 base value) (unless (or (and (eql significand1 significand2) ; identical results (eql exponent1 exponent2) (eql sign1 sign2)) @@ -47,9 +47,9 @@ (when significand2 (list significand2 exponent2 sign2))))))))) -(defmethod iterator-value-pass-p ((test float-integer) iterator stream) +(defmethod iterator-value-pass-p ((test float-triple) iterator stream) (handler-case - (let ((result (compare/float-integer test iterator))) + (let ((result (compare/float-triple test iterator))) (when result (format stream "~:<#x~v,'0x ~e ~s ~s~:@>~%" (list* (float-hex-digits (float-type (iterator-interval iterator))) @@ -62,9 +62,9 @@ (format nil "~a" condition)) nil))) -(defun float-integer/bd.s/f (&rest rest &key (coverage 1) &allow-other-keys) +(defun float-triple/bd.s/f (&rest rest &key (coverage 1) &allow-other-keys) (apply #'test - (list (make-instance 'float-integer + (list (make-instance 'float-triple :client1 (make-instance 'quaviver/burger-dybvig:client) :client2 (make-instance 'quaviver/schubfach:client) :base 10)) @@ -72,9 +72,9 @@ :coverage coverage)) rest)) -(defun float-integer/bd.s/d (&rest rest &key (coverage (expt 2 -32)) &allow-other-keys) +(defun float-triple/bd.s/d (&rest rest &key (coverage (expt 2 -32)) &allow-other-keys) (apply #'test - (list (make-instance 'float-integer + (list (make-instance 'float-triple :client1 (make-instance 'quaviver/burger-dybvig:client) :client2 (make-instance 'quaviver/schubfach:client) :base 10)) @@ -83,11 +83,11 @@ :coverage coverage)) rest)) -(defun float-integer/s.d/f (&rest rest +(defun float-triple/s.d/f (&rest rest &key (coverage 1) (rounding :away-from-zero) &allow-other-keys) (apply #'test - (list (make-instance 'float-integer + (list (make-instance 'float-triple :client1 (make-instance 'quaviver/schubfach:client :rounding rounding) :client2 (make-instance 'quaviver/dragonbox:nearest-client @@ -97,11 +97,11 @@ :coverage coverage)) rest)) -(defun float-integer/s.d/d (&rest rest +(defun float-triple/s.d/d (&rest rest &key (coverage (expt 2 -32)) (rounding :away-from-zero) &allow-other-keys) (apply #'test - (list (make-instance 'float-integer + (list (make-instance 'float-triple :client1 (make-instance 'quaviver/schubfach:client :rounding rounding) :client2 (make-instance 'quaviver/dragonbox:nearest-client diff --git a/code/compare/interval.lisp b/code/compare/interval.lisp index 2a45507c..97f6fde2 100644 --- a/code/compare/interval.lisp +++ b/code/compare/interval.lisp @@ -56,7 +56,7 @@ iterator (with-accessors ((float-type float-type)) interval - (quaviver:float-integer client base + (quaviver:float-triple client base (quaviver:bits-float float-type bits))))) diff --git a/code/compare/packages.lisp b/code/compare/packages.lisp index f08e03ac..0e35074c 100644 --- a/code/compare/packages.lisp +++ b/code/compare/packages.lisp @@ -8,11 +8,11 @@ #:bit-interval #:bit-part-interval #:test - #:float-integer - #:float-integer/bd.s/f - #:float-integer/bd.s/d - #:float-integer/s.d/f - #:float-integer/s.d/d - #:integer-float - #:integer-float/j.l/f - #:integer-float/j.l/d)) + #:float-triple + #:float-triple/bd.s/f + #:float-triple/bd.s/d + #:float-triple/s.d/f + #:float-triple/s.d/d + #:triple-float + #:triple-float/j.l/f + #:triple-float/j.l/d)) diff --git a/code/compare/integer-float.lisp b/code/compare/triple-float.lisp similarity index 71% rename from code/compare/integer-float.lisp rename to code/compare/triple-float.lisp index 2814f765..aec15d09 100644 --- a/code/compare/integer-float.lisp +++ b/code/compare/triple-float.lisp @@ -3,7 +3,7 @@ (cl:in-package #:quaviver/compare) -(defclass integer-float () +(defclass triple-float () ((name :reader test-name :initarg :name :initform nil) @@ -14,7 +14,7 @@ (base :accessor base :initarg :base))) -(defun compare/integer-float (test iterator) +(defun compare/triple-float (test iterator) (with-accessors ((client1 client1) (client2 client2) (base base)) @@ -25,19 +25,19 @@ (iterator-integer iterator base) (floating-point-invalid-operation () ;; this might be signaled if we attempt to encode a signaling NaN. - (return-from compare/integer-float nil))) - (let ((float1 (quaviver:integer-float client1 float-type base significand exponent sign)) - (float2 (quaviver:integer-float client2 float-type base significand exponent sign))) - (unless (equalp (multiple-value-list (quaviver:float-integer nil 2 float1)) - (multiple-value-list (quaviver:float-integer nil 2 float2))) + (return-from compare/triple-float nil))) + (let ((float1 (quaviver:triple-float client1 float-type base significand exponent sign)) + (float2 (quaviver:triple-float client2 float-type base significand exponent sign))) + (unless (equalp (multiple-value-list (quaviver:float-triple nil 2 float1)) + (multiple-value-list (quaviver:float-triple nil 2 float2))) (list (iterator-bits iterator) (list significand exponent sign) float1 float2))))))) -(defmethod iterator-value-pass-p ((test integer-float) iterator stream) +(defmethod iterator-value-pass-p ((test triple-float) iterator stream) (handler-case - (let ((result (compare/integer-float test iterator))) + (let ((result (compare/triple-float test iterator))) (when result (format stream "~:<#x~v,'0x ~e ~s ~s~:@>~%" (list* (float-hex-digits (float-type (iterator-interval iterator))) @@ -51,9 +51,9 @@ (format nil "~a" condition)) nil))) -(defun integer-float/j.l/f (&rest rest &key (coverage 1) &allow-other-keys) +(defun triple-float/j.l/f (&rest rest &key (coverage 1) &allow-other-keys) (apply #'test - (list (make-instance 'integer-float + (list (make-instance 'triple-float :client1 (make-instance 'quaviver/jaffer:client) :client2 (make-instance 'quaviver/liebler:client) :base 10)) @@ -61,9 +61,9 @@ :coverage coverage)) rest)) -(defun integer-float/j.l/d (&rest rest &key (coverage (expt 2 -32)) &allow-other-keys) +(defun triple-float/j.l/d (&rest rest &key (coverage (expt 2 -32)) &allow-other-keys) (apply #'test - (list (make-instance 'integer-float + (list (make-instance 'triple-float :client1 (make-instance 'quaviver/jaffer:client) :client2 (make-instance 'quaviver/liebler:client) :base 10)) diff --git a/code/dragonbox/implementation.lisp b/code/dragonbox/implementation.lisp index a4e3a220..4f81370e 100644 --- a/code/dragonbox/implementation.lisp +++ b/code/dragonbox/implementation.lisp @@ -417,7 +417,7 @@ (progn ; for future LET bindings `(block %dragonbox (multiple-value-bind (significand exponent sign) - ,(quaviver:float-internal-integer-form type value) + ,(quaviver:float-primitive-triple-form type value) (declare ((quaviver.math:arithmetic-word ,arithmetic-size) significand) ((or quaviver:exponent-word keyword) exponent) (fixnum sign)) @@ -590,7 +590,7 @@ (progn ; for future LET bindings `(block %dragonbox (multiple-value-bind (significand exponent sign) - ,(quaviver:float-internal-integer-form type value) + ,(quaviver:float-primitive-triple-form type value) (declare ((quaviver.math:arithmetic-word ,arithmetic-size) significand) ((or quaviver:exponent-word keyword) exponent) (fixnum sign)) @@ -692,7 +692,7 @@ (values significand (+ -k ,kappa) sign)))))))))) #+clisp -(defmethod quaviver:float-integer +(defmethod quaviver:float-triple ((client nearest-client) (base (eql 10)) value) (declare (optimize speed)) (typecase value @@ -716,7 +716,7 @@ (call-next-method)))) #+(and (not clisp) quaviver/short-float) -(defmethod quaviver:float-integer +(defmethod quaviver:float-triple ((client nearest-client) (base (eql 10)) (value short-float)) (declare (optimize speed)) (%nearest client short-float value @@ -725,7 +725,7 @@ quaviver.math:floor-multiply/evenp/32-64q64)) #-clisp -(defmethod quaviver:float-integer +(defmethod quaviver:float-triple ((client nearest-client) (base (eql 10)) (value single-float)) (declare (optimize speed)) (%nearest client single-float value @@ -734,7 +734,7 @@ quaviver.math:floor-multiply/evenp/32-64q64)) #-clisp -(defmethod quaviver:float-integer +(defmethod quaviver:float-triple ((client nearest-client) (base (eql 10)) (value double-float)) (declare (optimize speed)) (%nearest client double-float value @@ -743,7 +743,7 @@ quaviver.math:floor-multiply/evenp/64-128q128)) #+clisp -(defmethod quaviver:float-integer +(defmethod quaviver:float-triple ((client directed-client) (base (eql 10)) value) (declare (optimize speed)) (typecase value @@ -767,7 +767,7 @@ (call-next-method)))) #+(and (not clisp) quaviver/short-float) -(defmethod quaviver:float-integer +(defmethod quaviver:float-triple ((client directed-client) (base (eql 10)) (value short-float)) (declare (optimize speed)) (%directed client short-float value @@ -776,7 +776,7 @@ quaviver.math:floor-multiply/evenp/32-64q64)) #-clisp -(defmethod quaviver:float-integer +(defmethod quaviver:float-triple ((client directed-client) (base (eql 10)) (value single-float)) (declare (optimize speed)) (%directed client single-float value @@ -785,7 +785,7 @@ quaviver.math:floor-multiply/evenp/32-64q64)) #-clisp -(defmethod quaviver:float-integer +(defmethod quaviver:float-triple ((client directed-client) (base (eql 10)) (value double-float)) (declare (optimize speed)) (%directed client double-float value diff --git a/code/float-integer.lisp b/code/float-integer.lisp deleted file mode 100644 index bdf8d0e2..00000000 --- a/code/float-integer.lisp +++ /dev/null @@ -1,36 +0,0 @@ -(in-package #:quaviver) - -#+clisp -(defmethod float-integer (client (base (eql 2)) value) - (declare (ignore client)) - (etypecase value - #+quaviver/short-float - (short-float - (float-internal-integer/short-float value)) - (single-float - (float-internal-integer/single-float value)) - (double-float - (float-internal-integer/double-float value)) - #+quaviver/long-float - (long-float - (float-internal-integer/long-float value)))) - -#+(and (not clisp) quaviver/short-float) -(defmethod float-integer (client (base (eql 2)) (value short-float)) - (declare (ignore client)) - (float-internal-integer/short-float value)) - -#-clisp -(defmethod float-integer (client (base (eql 2)) (value single-float)) - (declare (ignore client)) - (float-internal-integer/single-float value)) - -#-clisp -(defmethod float-integer (client (base (eql 2)) (value double-float)) - (declare (ignore client)) - (float-internal-integer/double-float value)) - -#+(and (not clisp) quaviver/long-float) -(defmethod float-integer (client (base (eql 2)) (value long-float)) - (declare (ignore client)) - (float-internal-integer/long-float value)) diff --git a/code/float-internal-integer-form.lisp b/code/float-primitive-triple-form.lisp similarity index 67% rename from code/float-internal-integer-form.lisp rename to code/float-primitive-triple-form.lisp index eb7e4be0..e7dc112b 100644 --- a/code/float-internal-integer-form.lisp +++ b/code/float-primitive-triple-form.lisp @@ -1,13 +1,13 @@ (in-package #:quaviver) (declaim (inline #+quaviver/short-float - float-internal-integer/short-float - float-internal-integer/single-float - float-internal-integer/double-float + float-primitive-triple/short-float + float-primitive-triple/single-float + float-primitive-triple/double-float #+quaviver/long-float - float-internal-integer/long-float)) + float-primitive-triple/long-float)) -(defmacro %float-internal-integer-form (float-type value) +(defmacro %float-primitive-triple-form (float-type value) (with-accessors ((storage-size storage-size) (significand-size significand-size) (significand-bytespec significand-bytespec) @@ -55,41 +55,41 @@ (values significand exponent sign))))))))) #+quaviver/short-float -(defun float-internal-integer/short-float (value) - (%float-internal-integer-form short-float value)) +(defun float-primitive-triple/short-float (value) + (%float-primitive-triple-form short-float value)) -(defun float-internal-integer/single-float (value) - (%float-internal-integer-form single-float value)) +(defun float-primitive-triple/single-float (value) + (%float-primitive-triple-form single-float value)) -(defun float-internal-integer/double-float (value) - (%float-internal-integer-form double-float value)) +(defun float-primitive-triple/double-float (value) + (%float-primitive-triple-form double-float value)) #+quaviver/long-float -(defun float-internal-integer/long-float (value) - (%float-internal-integer-form long-float value)) +(defun float-primitive-triple/long-float (value) + (%float-primitive-triple-form long-float value)) #+quaviver/short-float -(defmethod float-internal-integer-form ((float-type (eql 'short-float)) value) - `(float-internal-integer/short-float ,value)) +(defmethod float-primitive-triple-form ((float-type (eql 'short-float)) value) + `(float-primitive-triple/short-float ,value)) #-quaviver/short-float -(defmethod float-internal-integer-form ((float-type (eql 'short-float)) value) - `(float-internal-integer/single-float ,value)) +(defmethod float-primitive-triple-form ((float-type (eql 'short-float)) value) + `(float-primitive-triple/single-float ,value)) -(defmethod float-internal-integer-form ((float-type (eql 'single-float)) value) - `(float-internal-integer/single-float ,value)) +(defmethod float-primitive-triple-form ((float-type (eql 'single-float)) value) + `(float-primitive-triple/single-float ,value)) -(defmethod float-internal-integer-form ((float-type (eql 'double-float)) value) - `(float-internal-integer/double-float ,value)) +(defmethod float-primitive-triple-form ((float-type (eql 'double-float)) value) + `(float-primitive-triple/double-float ,value)) #+quaviver/long-float -(defmethod float-internal-integer-form ((float-type (eql 'long-float)) value) - `(float-internal-integer/long-float ,value)) +(defmethod float-primitive-triple-form ((float-type (eql 'long-float)) value) + `(float-primitive-triple/long-float ,value)) #-quaviver/long-float -(defmethod float-internal-integer-form ((float-type (eql 'long-float)) value) - `(float-internal-integer/double-float ,value)) +(defmethod float-primitive-triple-form ((float-type (eql 'long-float)) value) + `(float-primitive-triple/double-float ,value)) -(defmethod float-internal-integer-form (float-type value) +(defmethod float-primitive-triple-form (float-type value) (declare (ignore float-type)) `(integer-decode-float ,value)) diff --git a/code/float-triple.lisp b/code/float-triple.lisp new file mode 100644 index 00000000..1f444860 --- /dev/null +++ b/code/float-triple.lisp @@ -0,0 +1,36 @@ +(in-package #:quaviver) + +#+clisp +(defmethod float-triple (client (base (eql 2)) value) + (declare (ignore client)) + (etypecase value + #+quaviver/short-float + (short-float + (float-primitive-triple/short-float value)) + (single-float + (float-primitive-triple/single-float value)) + (double-float + (float-primitive-triple/double-float value)) + #+quaviver/long-float + (long-float + (float-primitive-triple/long-float value)))) + +#+(and (not clisp) quaviver/short-float) +(defmethod float-triple (client (base (eql 2)) (value short-float)) + (declare (ignore client)) + (float-primitive-triple/short-float value)) + +#-clisp +(defmethod float-triple (client (base (eql 2)) (value single-float)) + (declare (ignore client)) + (float-primitive-triple/single-float value)) + +#-clisp +(defmethod float-triple (client (base (eql 2)) (value double-float)) + (declare (ignore client)) + (float-primitive-triple/double-float value)) + +#+(and (not clisp) quaviver/long-float) +(defmethod float-triple (client (base (eql 2)) (value long-float)) + (declare (ignore client)) + (float-primitive-triple/long-float value)) diff --git a/code/fortran/implementation.lisp b/code/fortran/implementation.lisp index 25a992ce..fc0102a6 100644 --- a/code/fortran/implementation.lisp +++ b/code/fortran/implementation.lisp @@ -34,7 +34,7 @@ (defmethod quaviver:write-number ((client client) (base (eql 10)) (value single-float) stream) (multiple-value-bind (significand exponent sign) - (quaviver:float-integer client base value) + (quaviver:float-triple client base value) (when (keywordp exponent) (error "Unable to represent ~a in ~a." exponent (client-standard client))) (when (minusp sign) @@ -48,7 +48,7 @@ (defmethod quaviver:write-number ((client client) (base (eql 10)) (value double-float) stream) (multiple-value-bind (significand exponent sign) - (quaviver:float-integer client base value) + (quaviver:float-triple client base value) (when (keywordp exponent) (error "Unable to represent ~a in ~a." exponent (client-standard client))) (when (minusp sign) diff --git a/code/interface.lisp b/code/interface.lisp index 46b47570..a1a2c032 100644 --- a/code/interface.lisp +++ b/code/interface.lisp @@ -8,13 +8,13 @@ (defgeneric float-bits-form (type value)) -(defgeneric integer-float (client float-type base significand exponent sign)) +(defgeneric triple-float (client float-type base significand exponent sign)) -(defgeneric internal-integer-float-form (float-type significand exponent sign)) +(defgeneric primitive-triple-float-form (float-type significand exponent sign)) -(defgeneric float-integer (client base value)) +(defgeneric float-triple (client base value)) -(defgeneric float-internal-integer-form (float-type value)) +(defgeneric float-primitive-triple-form (float-type value)) (defgeneric parse-number (client base sequence &optional start end integerp ratiop floatp float-type)) diff --git a/code/jaffer/implementation.lisp b/code/jaffer/implementation.lisp index 190a6348..af159347 100644 --- a/code/jaffer/implementation.lisp +++ b/code/jaffer/implementation.lisp @@ -9,7 +9,7 @@ float-type `(if (or (keywordp ,exponent) (zerop ,significand)) - ,(quaviver:internal-integer-float-form float-type + ,(quaviver:primitive-triple-float-form float-type significand exponent sign) @@ -18,18 +18,18 @@ ,(- significand-size)))) ;; The following overflow and underflow checks are not ;; strict checks. Stricter checks will happen in - ;; integer-float/2. These are here to avoid excessible + ;; triple-float/2. These are here to avoid excessible ;; large bignum in the intermediate calculations. (cond ((> q ,(+ max-exponent (quaviver.math:ceiling-log-expt 2 10 1))) (quaviver.condition:floating-point-overflow - 'quaviver:integer-float + 'quaviver:triple-float ,client ',float-type 10 ,significand ,exponent ,sign)) ((< q ,(- min-exponent (quaviver.math:ceiling-log-expt 2 10 1))) (quaviver.condition:floating-point-underflow - 'quaviver:integer-float + 'quaviver:triple-float ,client ',float-type 10 ,significand ,exponent ,sign)) ((minusp ,exponent) @@ -47,7 +47,7 @@ (when (> (integer-length quotient) mantlen) (incf bex) (setf quotient (round num (ash scale 1)))) - ,(quaviver:internal-integer-float-form float-type + ,(quaviver:primitive-triple-float-form float-type 'quotient `(+ bex ,exponent) sign)))) @@ -55,33 +55,33 @@ (let* ((num (* ,significand (expt 5 ,exponent))) (bex (- (integer-length num) ,significand-size))) (if (plusp bex) - ,(quaviver:internal-integer-float-form float-type + ,(quaviver:primitive-triple-float-form float-type `(round num (ash 1 bex)) `(+ bex ,exponent) sign) - ,(quaviver:internal-integer-float-form float-type + ,(quaviver:primitive-triple-float-form float-type 'num exponent sign))))))))) #+quaviver/short-float -(defmethod quaviver:integer-float +(defmethod quaviver:triple-float ((client client) (float-type (eql 'short-float)) (base (eql 10)) significand exponent sign) (%jaffer client short-float significand exponent sign)) -(defmethod quaviver:integer-float +(defmethod quaviver:triple-float ((client client) (float-type (eql 'single-float)) (base (eql 10)) significand exponent sign) (%jaffer client single-float significand exponent sign)) -(defmethod quaviver:integer-float +(defmethod quaviver:triple-float ((client client) (float-type (eql 'double-float)) (base (eql 10)) significand exponent sign) (%jaffer client double-float significand exponent sign)) #+quaviver/long-float -(defmethod quaviver:integer-float +(defmethod quaviver:triple-float ((client client) (float-type (eql 'long-float)) (base (eql 10)) significand exponent sign) (%jaffer client long-float significand exponent sign)) diff --git a/code/json/implementation.lisp b/code/json/implementation.lisp index 925b64c1..0c9b0e8c 100644 --- a/code/json/implementation.lisp +++ b/code/json/implementation.lisp @@ -30,7 +30,7 @@ (defmethod quaviver:write-number ((client client) base (value float) stream) (multiple-value-bind (significand exponent sign) - (quaviver:float-integer client base value) + (quaviver:float-triple client base value) (when (keywordp exponent) (error "Unable to represent ~a in JSON." exponent)) (when (minusp sign) diff --git a/code/liebler/implementation.lisp b/code/liebler/implementation.lisp index c3c15dc6..c731ce93 100644 --- a/code/liebler/implementation.lisp +++ b/code/liebler/implementation.lisp @@ -19,23 +19,23 @@ (optimize speed)) (if (or (keywordp ,exponent-var) (zerop ,significand-var)) - ,(quaviver:internal-integer-float-form float-type significand-var exponent-var sign-var) + ,(quaviver:primitive-triple-float-form float-type significand-var exponent-var sign-var) (let* ((shift (- ,significand-size (integer-length ,significand-var))) (k (- (quaviver.math:floor-log-expt 2 10 ,exponent-var) -1 shift))) (declare (type quaviver:exponent-word k shift)) ;; The following overflow and underflow checks are not ;; strict checks. Stricter checks will happen in - ;; integer-float/2. These are here to protect the expt10 + ;; triple-float/2. These are here to protect the expt10 ;; table lookup from an out of bounds error. (cond ((> k ,(+ max-exponent (quaviver.math:ceiling-log-expt 2 10 1))) (quaviver.condition:floating-point-overflow - 'quaviver:integer-float + 'quaviver:triple-float ,client ',float-type 10 ,significand-var ,exponent-var ,sign-var)) ((< k ,(- min-exponent (quaviver.math:ceiling-log-expt 2 10 1))) (quaviver.condition:floating-point-underflow - 'quaviver:integer-float + 'quaviver:triple-float ,client ',float-type 10 ,significand-var ,exponent-var ,sign-var)) (t (setf ,significand-var (quaviver.math:round-to-odd @@ -44,29 +44,29 @@ (quaviver.math:expt ,arithmetic-size 10 (- ,exponent-var))) shift (- ,significand-size (integer-length ,significand-var))) - ,(quaviver:internal-integer-float-form float-type + ,(quaviver:primitive-triple-float-form float-type `(round ,significand-var (ash 1 (- shift))) `(- k shift ,extra) sign-var))))))))) #+quaviver/short-float -(defmethod quaviver:integer-float +(defmethod quaviver:triple-float ((client client) (float-type (eql 'short-float)) (base (eql 10)) significand exponent sign) (%liebler client short-float significand exponent sign)) -(defmethod quaviver:integer-float +(defmethod quaviver:triple-float ((client client) (float-type (eql 'single-float)) (base (eql 10)) significand exponent sign) (%liebler client single-float significand exponent sign)) -(defmethod quaviver:integer-float +(defmethod quaviver:triple-float ((client client) (float-type (eql 'double-float)) (base (eql 10)) significand exponent sign) (%liebler client double-float significand exponent sign)) #+quaviver/long-float -(defmethod quaviver:integer-float +(defmethod quaviver:triple-float ((client client) (float-type (eql 'long-float)) (base (eql 10)) significand exponent sign) (%liebler client long-float significand exponent sign)) diff --git a/code/native/float-integer.lisp b/code/native/float-triple.lisp similarity index 96% rename from code/native/float-integer.lisp rename to code/native/float-triple.lisp index bc5c34b6..5f6f17cd 100644 --- a/code/native/float-integer.lisp +++ b/code/native/float-triple.lisp @@ -3,7 +3,7 @@ (defclass benchmark-client () ()) #+(or abcl ccl clasp clisp cmucl ecl sbcl) -(defmethod quaviver:float-integer +(defmethod quaviver:float-triple ((client benchmark-client) (base (eql 10)) value) #+abcl (system::flonum-to-string (abs value)) #+ccl (ccl::flonum-to-string value) @@ -16,7 +16,7 @@ (defclass client () ()) #+(or abcl ccl clasp clisp cmucl ecl sbcl) -(defmethod quaviver:float-integer +(defmethod quaviver:float-triple ((client client) (base (eql 10)) value) #+abcl (multiple-value-bind (digits digits-length leading-point diff --git a/code/native/integer-float.lisp b/code/native/triple-float.lisp similarity index 79% rename from code/native/integer-float.lisp rename to code/native/triple-float.lisp index 89698500..5d488c88 100644 --- a/code/native/integer-float.lisp +++ b/code/native/triple-float.lisp @@ -1,24 +1,24 @@ (in-package #:quaviver/native) -(defmethod quaviver:integer-float ((client client) float-type base significand exponent sign) +(defmethod quaviver:triple-float ((client client) float-type base significand exponent sign) (let ((significand (if (minusp sign) (- significand) significand))) (coerce (if (minusp exponent) (/ significand (expt base (- exponent))) (* significand (expt base exponent))) float-type))) -(defmethod quaviver:integer-float +(defmethod quaviver:triple-float ((client client) (float-type (eql 'single-float)) base (significand (eql 0)) exponent sign) (declare (ignore base exponent)) (if (minusp sign) -0f0 0f0)) -(defmethod quaviver:integer-float +(defmethod quaviver:triple-float ((client client) (float-type (eql 'double-float)) base (significand (eql 0)) exponent sign) (declare (ignore base exponent)) (if (minusp sign) -0d0 0d0)) #+quaviver/long-float -(defmethod quaviver:integer-float +(defmethod quaviver:triple-float ((client client) (float-type (eql 'long-float)) base (significand (eql 0)) exponent sign) (declare (ignore base exponent)) (if (minusp sign) -0l0 0l0)) diff --git a/code/number-parser.lisp b/code/number-parser.lisp index 60fe1401..cff46107 100644 --- a/code/number-parser.lisp +++ b/code/number-parser.lisp @@ -427,12 +427,12 @@ ,@expanded-clauses ,*next-tag* (cond (,code - (return (quaviver:integer-float ,(expand-ref :client) - ,(expand-ref :float-type) - ,(expand-ref :base) - ,payload - ,code - ,sign))) + (return (quaviver:triple-float ,(expand-ref :client) + ,(expand-ref :float-type) + ,(expand-ref :base) + ,payload + ,code + ,sign))) ,@(when integerp `(((and ,(expand-ref :integer) (or (plusp ,sign) @@ -445,20 +445,20 @@ (return (/ (* ,sign ,integral) ,divisor))))) ,@(when floatp `((,(expand-ref :float) - (return (quaviver:integer-float ,(expand-ref :client) - ,(expand-ref :float-type) - ,(expand-ref :base) - (if (zerop ,integral) - ,fractional - (+ (* (expt ,(expand-ref :base) - (+ ,fractional-count - ,fractional-leading-zero)) - ,integral) - ,fractional)) - (- (* ,exponent-sign ,exponent) - ,fractional-count - ,fractional-leading-zero) - ,sign))))) + (return (quaviver:triple-float ,(expand-ref :client) + ,(expand-ref :float-type) + ,(expand-ref :base) + (if (zerop ,integral) + ,fractional + (+ (* (expt ,(expand-ref :base) + (+ ,fractional-count + ,fractional-leading-zero)) + ,integral) + ,fractional)) + (- (* ,exponent-sign ,exponent) + ,fractional-count + ,fractional-leading-zero) + ,sign))))) (t (error 'parse-error))))))) diff --git a/code/packages.lisp b/code/packages.lisp index 2d74d8ca..ef3dc38e 100644 --- a/code/packages.lisp +++ b/code/packages.lisp @@ -4,10 +4,10 @@ #:bits-float-form #:float-bits #:float-bits-form - #:integer-float - #:internal-integer-float-form - #:float-integer - #:float-internal-integer-form + #:triple-float + #:primitive-triple-float-form + #:float-triple + #:float-primitive-triple-form #:parse-digits #:compose-digits #:parse-number diff --git a/code/internal-integer-float-form.lisp b/code/primitive-triple-float-form.lisp similarity index 72% rename from code/internal-integer-float-form.lisp rename to code/primitive-triple-float-form.lisp index adc4030a..36ee525d 100644 --- a/code/internal-integer-float-form.lisp +++ b/code/primitive-triple-float-form.lisp @@ -1,13 +1,13 @@ (in-package #:quaviver) (declaim (inline #+quaviver/short-float - internal-integer-float/short-float - internal-integer-float/single-float - internal-integer-float/double-float + primitive-triple-float/short-float + primitive-triple-float/single-float + primitive-triple-float/double-float #+quaviver/long-float - internal-integer-float/long-float)) + primitive-triple-float/long-float)) -(defmacro %internal-integer-float-form (float-type significand exponent sign) +(defmacro %primitive-triple-float-form (float-type significand exponent sign) (with-accessors ((storage-size storage-size) (significand-bytespec significand-bytespec) (significand-byte-form significand-byte-form) @@ -57,11 +57,11 @@ (decf ,exponent-var shift)) (cond ((< ,exponent-var ,min-exponent) (quaviver.condition:floating-point-underflow - 'integer-float + 'triple-float ,significand-var ,exponent-var ,sign-var)) ((> ,exponent-var ,max-exponent) (quaviver.condition:floating-point-overflow - 'integer-float + 'triple-float ,significand-var ,exponent-var ,sign-var)) (t (incf ,exponent-var ,exponent-bias) @@ -83,37 +83,37 @@ ,(bits-float-form float-type bits-var))))) #+quaviver/short-float -(defun internal-integer-float/short-float (significand exponent sign) - (%internal-integer-float-form short-float significand exponent sign)) +(defun primitive-triple-float/short-float (significand exponent sign) + (%primitive-triple-float-form short-float significand exponent sign)) -(defun internal-integer-float/single-float (significand exponent sign) - (%internal-integer-float-form single-float significand exponent sign)) +(defun primitive-triple-float/single-float (significand exponent sign) + (%primitive-triple-float-form single-float significand exponent sign)) -(defun internal-integer-float/double-float (significand exponent sign) - (%internal-integer-float-form double-float significand exponent sign)) +(defun primitive-triple-float/double-float (significand exponent sign) + (%primitive-triple-float-form double-float significand exponent sign)) #+quaviver/long-float -(defun internal-integer-float/long-float (significand exponent sign) - (%internal-integer-float-form long-float significand exponent sign)) +(defun primitive-triple-float/long-float (significand exponent sign) + (%primitive-triple-float-form long-float significand exponent sign)) #+quaviver/short-float -(defmethod internal-integer-float-form ((float-type (eql 'short-float)) significand exponent sign) - `(internal-integer-float/short-float ,significand ,exponent ,sign)) +(defmethod primitive-triple-float-form ((float-type (eql 'short-float)) significand exponent sign) + `(primitive-triple-float/short-float ,significand ,exponent ,sign)) #-quaviver/short-float -(defmethod internal-integer-float-form ((float-type (eql 'short-float)) significand exponent sign) - `(internal-integer-float/single-float ,significand ,exponent ,sign)) +(defmethod primitive-triple-float-form ((float-type (eql 'short-float)) significand exponent sign) + `(primitive-triple-float/single-float ,significand ,exponent ,sign)) -(defmethod internal-integer-float-form ((float-type (eql 'single-float)) significand exponent sign) - `(internal-integer-float/single-float ,significand ,exponent ,sign)) +(defmethod primitive-triple-float-form ((float-type (eql 'single-float)) significand exponent sign) + `(primitive-triple-float/single-float ,significand ,exponent ,sign)) -(defmethod internal-integer-float-form ((float-type (eql 'double-float)) significand exponent sign) - `(internal-integer-float/double-float ,significand ,exponent ,sign)) +(defmethod primitive-triple-float-form ((float-type (eql 'double-float)) significand exponent sign) + `(primitive-triple-float/double-float ,significand ,exponent ,sign)) #+quaviver/long-float -(defmethod internal-integer-float-form ((float-type (eql 'long-float)) significand exponent sign) - `(internal-integer-float/long-float ,significand ,exponent ,sign)) +(defmethod primitive-triple-float-form ((float-type (eql 'long-float)) significand exponent sign) + `(primitive-triple-float/long-float ,significand ,exponent ,sign)) #-quaviver/long-float -(defmethod internal-integer-float-form ((float-type (eql 'long-float)) significand exponent sign) - `(internal-integer-float/double-float ,significand ,exponent ,sign)) +(defmethod primitive-triple-float-form ((float-type (eql 'long-float)) significand exponent sign) + `(primitive-triple-float/double-float ,significand ,exponent ,sign)) diff --git a/code/python/implementation.lisp b/code/python/implementation.lisp index e3736c13..8e4ea866 100644 --- a/code/python/implementation.lisp +++ b/code/python/implementation.lisp @@ -117,7 +117,7 @@ (defmethod quaviver:write-number ((client client) (base (eql 10)) (value float) stream) (multiple-value-bind (significand exponent sign) - (quaviver:float-integer client base value) + (quaviver:float-triple client base value) (when (keywordp exponent) (error "Unable to represent ~a." exponent)) (when (minusp sign) diff --git a/code/schubfach/implementation.lisp b/code/schubfach/implementation.lisp index d73fcd7e..afc95ed6 100644 --- a/code/schubfach/implementation.lisp +++ b/code/schubfach/implementation.lisp @@ -24,7 +24,7 @@ (let ((word-size (+ significand-size 6))) `(block %schubfach (multiple-value-bind (significand exponent sign) - ,(quaviver:float-internal-integer-form type value) + ,(quaviver:float-primitive-triple-form type value) (declare (type (unsigned-byte ,word-size) significand) (type (or keyword quaviver:exponent-word) exponent) @@ -124,7 +124,7 @@ sign)))))))))) #+clisp -(defmethod quaviver:float-integer ((client client) (base (eql 10)) value) +(defmethod quaviver:float-triple ((client client) (base (eql 10)) value) (declare (optimize speed)) (typecase value #+quaviver/short-float @@ -141,21 +141,21 @@ (call-next-method)))) #+(and (not clisp) quaviver/short-float) -(defmethod quaviver:float-integer ((client client) (base (eql 10)) (value short-float)) +(defmethod quaviver:float-triple ((client client) (base (eql 10)) (value short-float)) (declare (optimize speed)) (%schubfach client short-float value)) #-clisp -(defmethod quaviver:float-integer ((client client) (base (eql 10)) (value single-float)) +(defmethod quaviver:float-triple ((client client) (base (eql 10)) (value single-float)) (declare (optimize speed)) (%schubfach client single-float value)) #-clisp -(defmethod quaviver:float-integer ((client client) (base (eql 10)) (value double-float)) +(defmethod quaviver:float-triple ((client client) (base (eql 10)) (value double-float)) (declare (optimize speed)) (%schubfach client double-float value)) #+(and (not clisp) quaviver/long-float) -(defmethod quaviver:float-integer ((client client) (base (eql 10)) (value long-float)) +(defmethod quaviver:float-triple ((client client) (base (eql 10)) (value long-float)) (declare (optimize speed)) (%schubfach client long-float value)) diff --git a/code/trailing-zeros/implementation.lisp b/code/trailing-zeros/implementation.lisp index d1244d81..5a7292e2 100644 --- a/code/trailing-zeros/implementation.lisp +++ b/code/trailing-zeros/implementation.lisp @@ -127,7 +127,7 @@ (defclass client () ()) #+clisp -(defmethod quaviver:float-integer :around +(defmethod quaviver:float-triple :around ((client client) (base (eql 10)) value) (typecase value #+quaviver/short-float @@ -142,21 +142,21 @@ (call-next-method)))) #+(and (not clisp) quaviver/short-float) -(defmethod quaviver:float-integer :around +(defmethod quaviver:float-triple :around ((client client) (base (eql 10)) (value short-float)) (remove-trailing-zeros short-float)) #-clisp -(defmethod quaviver:float-integer :around +(defmethod quaviver:float-triple :around ((client client) (base (eql 10)) (value single-float)) (remove-trailing-zeros single-float)) #-clisp -(defmethod quaviver:float-integer :around +(defmethod quaviver:float-triple :around ((client client) (base (eql 10)) (value double-float)) (remove-trailing-zeros double-float)) #+(and (not clisp) quaviver/long-float) -(defmethod quaviver:float-integer :around +(defmethod quaviver:float-triple :around ((client client) (base (eql 10)) (value long-float)) (remove-trailing-zeros long-float)) diff --git a/code/integer-float.lisp b/code/triple-float.lisp similarity index 57% rename from code/integer-float.lisp rename to code/triple-float.lisp index 5234829e..a6164e42 100644 --- a/code/integer-float.lisp +++ b/code/triple-float.lisp @@ -1,33 +1,33 @@ (in-package #:quaviver) #+quaviver/short-float -(defmethod integer-float +(defmethod triple-float (client (float-type (eql 'short-float)) (base (eql 2)) significand exponent sign) (declare (ignore client)) - (internal-integer-float/short-float significand exponent sign)) + (primitive-triple-float/short-float significand exponent sign)) -(defmethod integer-float +(defmethod triple-float (client (float-type (eql 'single-float)) (base (eql 2)) significand exponent sign) (declare (ignore client)) - (internal-integer-float/single-float significand exponent sign)) + (primitive-triple-float/single-float significand exponent sign)) -(defmethod integer-float +(defmethod triple-float (client (float-type (eql 'double-float)) (base (eql 2)) significand exponent sign) (declare (ignore client)) - (internal-integer-float/double-float significand exponent sign)) + (primitive-triple-float/double-float significand exponent sign)) #+quaviver/long-float -(defmethod integer-float +(defmethod triple-float (client (float-type (eql 'long-float)) (base (eql 2)) significand exponent sign) (declare (ignore client)) - (internal-integer-float/long-float significand exponent sign)) + (primitive-triple-float/long-float significand exponent sign)) #-quaviver/short-float -(defmethod integer-float +(defmethod triple-float (client (float-type (eql 'short-float)) base significand exponent sign) - (integer-float client 'single-float base significand exponent sign)) + (triple-float client 'single-float base significand exponent sign)) #-quaviver/long-float -(defmethod integer-float +(defmethod triple-float (client (float-type (eql 'long-float)) base significand exponent sign) - (integer-float client 'double-float base significand exponent sign)) + (triple-float client 'double-float base significand exponent sign)) diff --git a/code/unit-test/json.lisp b/code/unit-test/json.lisp index 21940a3d..6fa8b5b7 100644 --- a/code/unit-test/json.lisp +++ b/code/unit-test/json.lisp @@ -2,7 +2,7 @@ (defclass json-client (quaviver/json:client) ()) -(defmethod quaviver:integer-float ((client json-client) float-type base significand exponent sign) +(defmethod quaviver:triple-float ((client json-client) float-type base significand exponent sign) (list significand exponent sign)) (define-test json diff --git a/quaviver.asd b/quaviver.asd index 4f087872..c17be05d 100644 --- a/quaviver.asd +++ b/quaviver.asd @@ -35,10 +35,10 @@ (:file "bits-float") (:file "float-bits-form") (:file "float-bits") - (:file "internal-integer-float-form") - (:file "integer-float") - (:file "float-internal-integer-form") - (:file "float-integer") + (:file "primitive-triple-float-form") + (:file "triple-float") + (:file "float-primitive-triple-form") + (:file "float-triple") (:file "parse-digits") (:file "compose-digits") (:file "read-digits") @@ -75,8 +75,8 @@ :pathname "code/native/" :serial t :components ((:file "packages") - (:file "float-integer") - (:file "integer-float"))))) + (:file "float-triple") + (:file "triple-float"))))) (defsystem "quaviver/burger-dybvig" :description "Burger Dybvig algorithm for Quaviver" @@ -353,8 +353,8 @@ :components ((:file "packages") (:file "results") (:file "report") - (:file "float-integer") - (:file "integer-float"))))) + (:file "float-triple") + (:file "triple-float"))))) (defsystem "quaviver/compare" :description "Compare implementations of Quaviver protocol" @@ -378,5 +378,5 @@ (:file "utility") (:file "interval") (:file "test") - (:file "float-integer") - (:file "integer-float"))))) + (:file "float-triple") + (:file "triple-float")))))