Jim Newton

2020-03-13 18:19:19 UTC

(OR (REAL * (-3.5d0)) (REAL (-3.5d0))

Is that all the real numbers except -3.5d0

What about the following?

(OR (REAL * (-3.5d0))

(REAL (-3.5d0))

(NOT INTEGER))

Discussion:

(too old to reply)

Jim Newton

2020-03-13 18:19:19 UTC

(OR (REAL * (-3.5d0)) (REAL (-3.5d0))

Is that all the real numbers except -3.5d0

What about the following?

(OR (REAL * (-3.5d0))

(REAL (-3.5d0))

(NOT INTEGER))

Alan Bawden

2020-03-13 18:44:03 UTC

Can someone help me understand what these types are?

(OR (REAL * (-3.5d0))

(REAL (-3.5d0)))

Is that all the real numbers except -3.5d0

Note that this type contains _all_ objects of type INTEGER.

Now you've added the non-integers, so this type is true of everything. It

is equivalent to the type T. (Except your implementation may not be able

to recognize that.)

--

Alan Bawden

Alan Bawden

Stefan Monnier

2020-03-16 15:36:43 UTC

Can someone help me understand what these types are?

(OR (REAL * (-3.5d0))

(REAL (-3.5d0)))

Is that all the real numbers except -3.5d0

(i.e. does it assume an equality for type membership based on `=` or on `eql`?)

Stefan

Alan Bawden

2020-03-16 20:04:50 UTC

Can someone help me understand what these types are?

(OR (REAL * (-3.5d0))

(REAL (-3.5d0)))

Is that all the real numbers except -3.5d0

(i.e. does it assume an equality for type membership based on `=` or on `eql`?)

(defun test (x)

(and (realp x)

(> x -3.5d0)))

No `=' or `eql' needed.

--

Alan Bawden

Alan Bawden

Stefan Monnier

2020-03-16 20:20:11 UTC

Can someone help me understand what these types are?

(OR (REAL * (-3.5d0))

(REAL (-3.5d0)))

Is that all the real numbers except -3.5d0

(i.e. does it assume an equality for type membership based on `=` or on `eql`?)

(and (realp x)

(> x -3.5d0)))

No `=' or `eql' needed.

excludes -3.5e0 and -7/2).

Stefan

smh

2020-03-18 00:03:37 UTC

But it ends up being more like =` than `eql` (i.e. it also

excludes -3.5e0 and -7/2).

The ANS description of FLOAT (see the dictionary entry in chapter 12) doesn't restrict the value of the float base _b_ (aka the radix), and in an implementation with radix a prime other than 2 there will be no float value that is exactly equal to -7/2. So the float approximation might be slightly greater or less than -7/2.

Of course, every known implementation uses IEEE in which the float radix is 2, so this problem is theoretical only.

Stefan Monnier

2020-03-18 17:25:44 UTC

that is exactly equal to -7/2. So the float approximation might be slightly

greater or less than -7/2.

exclude whichever is the rational -NN/MM which happens to be equal

to the -3.5d0 float.

Stefan

Loading...