- (let* ((num (if (complexp x) (realpart x) x))
- (res (make-numeric-type
- :class (etypecase num
- (integer 'integer)
- (rational 'rational)
- (float 'float))
- :format (if (floatp num)
- (float-format-name num)
- nil))))
- (cond ((complexp x)
- (setf (numeric-type-complexp res) :complex)
- (let ((imag (imagpart x)))
- (setf (numeric-type-low res) (min num imag))
- (setf (numeric-type-high res) (max num imag))))
- (t
- (setf (numeric-type-low res) num)
- (setf (numeric-type-high res) num)))
- res))