Skip to content

Commit

Permalink
various: rename float-integer, etc to float-triple
Browse files Browse the repository at this point in the history
  • Loading branch information
yitzchak committed Aug 8, 2024
1 parent 0dc8638 commit 6de6077
Show file tree
Hide file tree
Showing 32 changed files with 275 additions and 275 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
(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)
`(:type double-float :limit ,most-positive-double-float)
#+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))
Expand All @@ -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)))
4 changes: 2 additions & 2 deletions code/benchmark/packages.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

(defpackage #:quaviver/benchmark
(:use #:common-lisp)
(:export #:float-integer
#:integer-float
(:export #:float-triple
#:triple-float
#:report
#:report/float-traits))
Original file line number Diff line number Diff line change
@@ -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))
Expand All @@ -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)))
2 changes: 1 addition & 1 deletion code/blub/implementation.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
24 changes: 12 additions & 12 deletions code/burger-dybvig/implementation.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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
Expand All @@ -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))
4 changes: 2 additions & 2 deletions code/c/implementation.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion code/common-lisp/implementation.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
28 changes: 14 additions & 14 deletions code/compare/float-integer.lisp → code/compare/float-triple.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

(cl:in-package #:quaviver/compare)

(defclass float-integer ()
(defclass float-triple ()
((name :reader test-name
:initarg :name
:initform nil)
Expand All @@ -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))
Expand All @@ -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)))
Expand All @@ -62,19 +62,19 @@
(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))
(list (make-instance 'bit-interval
: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))
Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion code/compare/interval.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -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)))))

Expand Down
16 changes: 8 additions & 8 deletions code/compare/packages.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Loading

0 comments on commit 6de6077

Please sign in to comment.