1
0
mirror of synced 2026-05-03 22:59:35 +00:00
Files
Interlisp.medley/internal/test/LANGUAGE/AUTO/12-3-MIN.TEST

72 lines
2.3 KiB
Plaintext

;; Function To Be Tested: MIN
;;
;; Source: Guy L Steele's CLTL
;; Section: 12.3 Comparisons on Numbers
;; Page: 198
;;
;; Created By: Kelly Roach
;;
;; Creation Date: July 12,1986
;;
;; Last Update: July 12,1986
;;
;; Filed As: {ERIS}<LISPCORE>CML>TEST>12-3-MIN.TEST
;;
;;
;; Syntax: (MIN &REST NUMBERS)
;;
;; Function Description:
;; The arguments may be any non-complex numbers.
;; MAX returns the argument that is greatest (closest
;; to positive infinity).
;; MIN returns the argument that is least (closest to
;; negative infinity).
;;
;; For MAX,
;; if the arguments are a mixture of rationals and floating-point
;; numbers, and the largest argument
;; is a rational, then the implementation is free to
;; produce either that rational or its floating-point approximation;
;; if the largest argument is a floating-point number of a smaller format
;; than the largest format of any floating-point argument,
;; then the implementation is free to
;; return the argument in its given format or expanded to the larger format.
;; More concisely, the implementation has the choice of returning the largest
;; argument as is or applying the rules of floating-point contagion,
;; taking all the arguments into consideration for contagion purposes.
;; Also, if one or more of the arguments are equal, then any one
;; of them may be chosen as the value to return.
;; Similar remarks apply to MIN (replacing ``largest argument'' by
;; ``smallest argument'').
;;
;;
;;
;; (MAX 6 12) => 12 (MIN 6 12) => 6
;; (MAX -6 -12) => -6 (MIN -6 -12) => -12
;; (MAX 1 3 2 -7) => 3 (MIN 1 3 2 -7) => -7
;; (MAX -2 3 0 7) => 7 (MIN -2 3 0 7) => -2
;; (MAX 3) => 3 (MIN 3) => 3
;; (MAX 5.0 2) => 5.0
;; (MIN 5.0 2) => 2 OR 2.0
;; (MAX 3.0 7 1) => 7 OR 7.0 (MIN 3.0 7 1) => 1 OR 1.0
;; (MAX 1.0S0 7.0D0) => 7.0D0
;; (MIN 1.0S0 7.0D0) => 1.0S0 OR 1.0D0
;; (MAX 3 1 1.0S0 1.0D0) => 3 OR 3.0D0
;; (MIN 3 1 1.0S0 1.0D0) => 1 OR 1.0S0 OR 1.0D0
;;
;;
;; Argument(s): NUMBERS - numbers
;;
;; Returns: a number
;;
(do-test min-test
(and (EQL (min 4 18) 4)
(EQL (min -4 -8 -2 0) -8)
(= (min 3 9.0 10 9 (/ 5 6) -30 1.0 1.5E2 150 0) -30)
(= (min 3 3.00001 (/ 10 3)) 3)))
STOP