[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

suggestions on floating point numbers and hash tables



    Date:  5 Oct 1982 0030-EDT
    From: HEDRICK at RUTGERS (Mgr DEC-20s/Dir LCSR Comp Facility)

    When you see 1.0, it is hard to know what the precision is. We would
    like to make sure that if you write something out and read it back in,
    it is EQUAL to what you started with.  Thus you should consider doing
    one of the following:

      - adopt a convention where you can tell the precision based on the
    	number of digits printed.  E.g. 1.00000 would be single, but
    	1.000000000000000 would be double.
This obnoxes me.

      - always print an exponent marker, or maybe always print it when the
    	it is not the same as READ-DEFAULT-FLOAT-FORMAT.

    (At the moment, we are always supplying an exponent marker when it is
    different from the default.)
Printing an exponent marker if the format is not the default is the right
alternative, I think.  It also happens to be what the Lisp machine does now
(which doesn't matter since we're willing to do anything reasonable).

No matter what you do you can't solve the problem of trying to get the
same precision on a different machine.

    We do not notice any way to write out hash tables.  We suggest that you
    adopt a # syntax for that.  In my opinion, it should be possible to
    write out and read back in as many kinds of user data structures as is
    possible.
I certainly do not want to see hash tables vomited out at me on the terminal.
But I do agree that is reasonable to have a way to put a hash table in a file.
I don't think it is necessary to add a new # syntax; all that is necessary
is a new keyword argument to MAKE-HASH-TABLE that provides the initial
contents (as an alist or something).  #. can then be used to include a hash
table in other data structure being read (i.e. to put one in a place that
is not a form to be evaluated).

    You specify a default packing factor of .8 for hash tables. I wonder
    whether you really want this number to be defined in the manual.
You are absolutely right.  Common Lisp has no business standardizing this.

    Finally, we wonder whether having separate MAKE-xxx-HASH-TABLE functions
    but the same PUT-HASH and GET-HASH for all types is the right way to go.
I have complained about this before.  There should be one function named
MAKE-HASH-TABLE that takes keywords defining the type of hash table you
want, and one set of functions for accessing.  We (the Lisp machine) screwed
up by ever having multiple functions for different kinds of hash tables.

    Although I don't quite know how one would use it, in
    principle it would make sense to put different kinds of items into the
    same hash table using different functions.
Do you really mean this?  I don't see how it can possibly be meaningful.