45 lines
1.0 KiB
Plaintext
45 lines
1.0 KiB
Plaintext
;; Function To Be Tested: float-radix
|
|
;;
|
|
;; Source: Common Lisp by Guy Steele
|
|
;; Section 12.6: Type Conversions and Component Extractions
|
|
;; on Numbers Page: 218
|
|
;;
|
|
;; Created By: John Park
|
|
;;
|
|
;; Creation Date: July 18, 86
|
|
;;
|
|
;; Last Update:
|
|
;;
|
|
;; Filed as: {eris}<lispcore>cml>test>12-6-float-radix.test
|
|
;;
|
|
;; Syntax: float-radix float
|
|
;;
|
|
;; Function Description: The function float-radix turns (as an integer) the
|
|
;; radix b of the floating-point argument.
|
|
;;
|
|
;; Argument(s): floating-point number
|
|
;;
|
|
;; Returns: integer
|
|
;;
|
|
;; Constraints/limitations: None
|
|
|
|
|
|
(do-test-group float-radix-test-setup
|
|
:before (progn
|
|
(setq float-radix-numbers (mapcar #'eval
|
|
'(1.0 2.0 -3.10 0.0 most-positive-double-float
|
|
most-negative-double-float)))
|
|
(defun is-radix-2? (number)
|
|
(if (= number 2)t)))
|
|
|
|
|
|
(do-test float-radix-test
|
|
(and (setq radix-result (mapcar #'float-radix float-radix-numbers))
|
|
(or (every #'is-radix-2? radix-result)
|
|
(every #'integerp radix-result)))))
|
|
|
|
|
|
|
|
STOP
|
|
|