Skip to content

Commit

Permalink
benchmark: improve random-float for integer-float
Browse files Browse the repository at this point in the history
  • Loading branch information
yitzchak committed Jun 26, 2024
1 parent c53f810 commit 0e77172
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions code/benchmark/integer-float.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@
:initargs (quaviver/liebler:client)
:types (single-float double-float long-float))))

(defvar *ieee754-client* (make-instance 'quaviver/ieee754:client))

(defvar *schubfach-client* (make-instance 'quaviver/schubfach:client))

(defun random-float (type)
(multiple-value-list
(quaviver:float-integer *schubfach-client* 10
(quaviver:bits-float *ieee754-client*
type
(random (ash 1 (quaviver:storage-size type)))))))
(list (random (ash 1 (quaviver:significand-size type)))
(quaviver/math:floor-log10-expt2 (+ (random (- (quaviver:max-exponent type)
(quaviver:min-exponent type)
(quaviver:significand-size type)
4))
(quaviver:min-exponent type)
(quaviver:significand-size type)
2))
(if (zerop (random 2)) 1 -1)))

(defun integer-float (&key (base 10)
(name (uiop:implementation-identifier)))
Expand Down

0 comments on commit 0e77172

Please sign in to comment.