From: Raymond Toy
Subject: (write 1f0 :readably t) prints what?
Date: 
Message-ID: <4nbtdlmsnn.fsf@rtp.ericsson.se>
What is (write 1f0 :readably t) supposed to print?

Some data points (with *read-default-float-format* set to
'single-float):

CLISP		1f0
CMUCL		1.0
LWW 4.1		1.0  (but it appears LWW only has double-floats)
ACL 5.0		1.0

It seems to me that the answer should be 1f0, otherwise, the result
that's read back depends on the setting of
*read-default-float-format*, and therefore not really printed readably.

A bug?  Perhaps I'm missing the relevant part of the CLHS?

Ray

From: Kent M Pitman
Subject: Re: (write 1f0 :readably t) prints what?
Date: 
Message-ID: <sfw7lo9mja8.fsf@world.std.com>
Raymond Toy <···@rtp.ericsson.se> writes:

> What is (write 1f0 :readably t) supposed to print?
> 
> Some data points (with *read-default-float-format* set to
> 'single-float):
> 
> CLISP		1f0
> CMUCL		1.0
> LWW 4.1		1.0  (but it appears LWW only has double-floats)
> ACL 5.0		1.0
> 
> It seems to me that the answer should be 1f0, otherwise, the result
> that's read back depends on the setting of
> *read-default-float-format*, and therefore not really printed readably.
>
> A bug?  Perhaps I'm missing the relevant part of the CLHS?

I think you should assume that the read/print invertibility thing is
always "with respect to the current settings".  Consider that even symbols
don't print re-readably if you set *package* to something else.  Ditto
integers don't re-read if you change the base (unless you use *print-radix*).
From: Raymond Toy
Subject: Re: (write 1f0 :readably t) prints what?
Date: 
Message-ID: <m3r9mge4gs.fsf@lorien.users.mindspring.com>
>>>>> "Kent" == Kent M Pitman <······@world.std.com> writes:

    Kent> Raymond Toy <···@rtp.ericsson.se> writes:
    >> What is (write 1f0 :readably t) supposed to print?
    >>
    >> It seems to me that the answer should be 1f0, otherwise, the

    Kent> I think you should assume that the read/print invertibility
    Kent> thing is always "with respect to the current settings".
    Kent> Consider that even symbols don't print re-readably if you
    Kent> set *package* to something else.  Ditto integers don't
    Kent> re-read if you change the base (unless you use
    Kent> *print-radix*).

But at least for this case, there is a way to print the number in a
readable, so the result should be readable.  Likewise for symbols: add
the package name to the symbol.  For integers, you are hosed, I guess.

Ray
From: Pierpaolo Bernardi
Subject: Re: (write 1f0 :readably t) prints what?
Date: 
Message-ID: <931770140.744434@fire-int>
Raymond Toy (····@mindspring.com) wrote:

: But at least for this case, there is a way to print the number in a
: readable, so the result should be readable.  Likewise for symbols: add
: the package name to the symbol.  For integers, you are hosed, I guess.

Well, no.  You can add a trailing dot.  31234. is read as decimal
whatever the *READ-BASE*.

P.
From: David Bakhash
Subject: Re: (write 1f0 :readably t) prints what?
Date: 
Message-ID: <cxjg12w31b8.fsf@acs5.bu.edu>
Raymond Toy <···@rtp.ericsson.se> writes:

> LWW 4.1		1.0  (but it appears LWW only has double-floats)

I noticed the same thing.  Is it the case that single-floats are not required
by the spec?  in LW I tried:

CL-USER 1> (type-of- 1f0)

==>
DOUBLE-FLOAT

dave
From: Sunil Mishra
Subject: Re: (write 1f0 :readably t) prints what?
Date: 
Message-ID: <efywvw82vwb.fsf@whizzy.cc.gatech.edu>
Hmmm, they seem to have done fine on unix...

CL-USER 5 > (type-of 1.0)
SINGLE-FLOAT

CL-USER 12 > (type-of 1.0f0)
SINGLE-FLOAT

CL-USER 13 > (type-of 1.0d0)
DOUBLE-FLOAT

CL-USER 14 > (type-of (coerce 1.0 'short-float))
SHORT-FLOAT

Sunil

David Bakhash <·····@bu.edu> writes:

> Raymond Toy <···@rtp.ericsson.se> writes:
> 
> > LWW 4.1		1.0  (but it appears LWW only has double-floats)
> 
> I noticed the same thing.  Is it the case that single-floats are not required
> by the spec?  in LW I tried:
> 
> CL-USER 1> (type-of- 1f0)
> 
> ==>
> DOUBLE-FLOAT
> 
> dave
From: Raymond Toy
Subject: Re: (write 1f0 :readably t) prints what?
Date: 
Message-ID: <m3oghke4av.fsf@lorien.users.mindspring.com>
>>>>> "David" == David Bakhash <·····@bu.edu> writes:

    David> Raymond Toy <···@rtp.ericsson.se> writes:
    >> LWW 4.1 1.0 (but it appears LWW only has double-floats)

    David> I noticed the same thing.  Is it the case that
    David> single-floats are not required by the spec?  in LW I tried:

I'm pretty sure that you're not required to have all 4 types of floats
to be distinct.  One is enough.  GCL and LWW only have double-float.
CMUCL and ACL have single-float and double-float.  (Some versions of
CMUCL have long-float.)  CLISP has all 4 types.
From: Kent M Pitman
Subject: Re: (write 1f0 :readably t) prints what?
Date: 
Message-ID: <sfwemieogdb.fsf@world.std.com>
David Bakhash <·····@bu.edu> writes:

> Raymond Toy <···@rtp.ericsson.se> writes:
> 
> > LWW 4.1		1.0  (but it appears LWW only has double-floats)
> 
> I noticed the same thing.  Is it the case that single-floats are not required
> by the spec?  in LW I tried:
> 
> CL-USER 1> (type-of- 1f0)
> 
> ==>
> DOUBLE-FLOAT

That's right.  An implementation can implement only a subset of the FLOAT
types.  There are some guidelines for what you are supposed to call the
various types if you implement only some of them.  See the CLHS entry for
the System Class named FLOAT.