tag:blogger.com,1999:blog-8383004232931899216.post1741326844278907047..comments2023-11-01T11:47:57.046-04:00Comments on Designing ParaSail, a new programming language: When null isn't just null -- value representation in ParaSailTucker Tafthttp://www.blogger.com/profile/08866496974237052847noreply@blogger.comBlogger8125tag:blogger.com,1999:blog-8383004232931899216.post-2050549762994611112012-08-01T14:09:09.755-04:002012-08-01T14:09:09.755-04:00Here is an update on the current representation of...Here is an update on the current representation of "null" for "large" objects: <br /><br />We were representing a large "null" value by a reference to an object with a header specifying the appropriate region id and a "null" type-id. In the current implementation, we have now eliminated the extra level of indirection in the representation of "null." Large objects are normally represented by the (virtual) address of their header. We now reserve a big enough part of the virtual address space for "null" values, so we can encode both the fact that the address represents a "null" value, as well as the region id where the contents of the object should be allocated if it is ever assigned a non-null value. <br /><br />For example, a large null value might always have the high 32 bits being zero, with the low 32 bits being the region-id. The actual representation for any given ParaSail implementation will depend on what parts of the 64-bit virtual address space would not normally be used for object storage.Tucker Tafthttps://www.blogger.com/profile/08866496974237052847noreply@blogger.comtag:blogger.com,1999:blog-8383004232931899216.post-38568843941503910392011-05-28T11:15:27.471-04:002011-05-28T11:15:27.471-04:00I think that's OK as long as null() always ret...I think that's OK as long as null() always returns quiet NaN. (Computing NaN via 1/0 may signal, depending on whether the "NaNs always signal" bit is set.)HilbertAstronauthttps://www.blogger.com/profile/11443786031975040593noreply@blogger.comtag:blogger.com,1999:blog-8383004232931899216.post-25886960130496957672011-05-27T22:48:18.492-04:002011-05-27T22:48:18.492-04:00Is_Null(NaN) and Is_NaN(null) seem like a reasonab...Is_Null(NaN) and Is_NaN(null) seem like a reasonable pair of promises.Tucker Tafthttps://www.blogger.com/profile/08866496974237052847noreply@blogger.comtag:blogger.com,1999:blog-8383004232931899216.post-70728139016121624582011-05-27T21:36:07.920-04:002011-05-27T21:36:07.920-04:00Honestly, I've never spent much time looking a...Honestly, I've never spent much time looking at NaN bit patterns. I don't know of a library which uses the NaN payload (the values of the nonspecified bits) to convey information. If you want to experiment, you can use something like Matlab's<br /><br />typecast(x,'uint64')<br /><br />which reinterprets the bits of the double-precision floating-point value x as a 64-bit unsigned integer.<br /><br />The important distinction is between quiet and signalling NaNs, which differ by a bit. This has caused me some trouble when calling noninteractive foreign libraries from interactive programming languages that set the FPU to make all NaNs signal.<br /><br />The 2008 standard says: "Quiet NaNs should, by means left to the implementer’s discretion, afford retrospective diagnostic information inherited from invalid or unavailable data and results. To facilitate propagation of diagnostic information contained in NaNs, as much of that information as possible should be preserved in NaN results of operations." <br /><br />This suggests you could make all NaNs "null," but pick a specific NaN to be the value you get when you ask for "null." That's what you likely would have done anyway, and there is plenty of precedent for this. Just don't make 0/0=1 like APL did, and we'll be happy ;-PHilbertAstronauthttps://www.blogger.com/profile/11443786031975040593noreply@blogger.comtag:blogger.com,1999:blog-8383004232931899216.post-59128518963238798262011-05-27T00:46:24.294-04:002011-05-27T00:46:24.294-04:00Is there really that much variation in the handlin...Is there really that much variation in the handling of NaN is libraries? If you had some specific examples I would be interested.Tucker Tafthttps://www.blogger.com/profile/08866496974237052847noreply@blogger.comtag:blogger.com,1999:blog-8383004232931899216.post-50799054294455929932011-05-27T00:35:21.554-04:002011-05-27T00:35:21.554-04:00You know it's just going to be NaN so don'...You know it's just going to be NaN so don't bother thinking harder ;-P<br /><br />Seriously, it seems like defining null requires a negotiation between ParaSail code and calls to foreign functions. The negotiation would have to be made separately for each foreign library.HilbertAstronauthttps://www.blogger.com/profile/11443786031975040593noreply@blogger.comtag:blogger.com,1999:blog-8383004232931899216.post-85534904653700799512011-05-26T23:23:38.394-04:002011-05-26T23:23:38.394-04:00The expectation is that there would be user-defina...The expectation is that there would be user-definable "null"() and "is_null()" operators, so a particular floating-point type could determine what is the representation of null. It could even be a module parameter, so that different instances of the same "Float" module could use different representations for null.Tucker Tafthttps://www.blogger.com/profile/08866496974237052847noreply@blogger.comtag:blogger.com,1999:blog-8383004232931899216.post-36011888112657529642011-05-26T19:06:26.141-04:002011-05-26T19:06:26.141-04:00What value would a "null" double-float h...What value would a "null" double-float have? IEEE 754 completely constrains the bit pattern of +/-Inf. You could use one of the many possible NaN bit patterns, but other numerical libraries may prefer to use those bit patterns to convey meaningful information (that was the original intent). Just curious ;-)HilbertAstronauthttps://www.blogger.com/profile/11443786031975040593noreply@blogger.com