Thread Links Date Links
Thread Prev Thread Next Thread Index Date Prev Date Next Date Index

Re: Bare decorations (was ...level 2 datums) - level 2 versus level 3



Most of what I said about this, up to and including

was my attempt to explain the difference between a level 2 description and a level 3 (or 4?) description.


The next part, starting with
was imperfectly expressed and contained a mistake so may have been misunderstood. I think it's important, so I'll say it differently and hope the combination makes more sense.


We can all (within each of our abilities, anyway) read, understand and discuss level 2 without reference to level 3. We need to understand parts of 754 level 3, though, and the consequences to 1788 level 3, or we will design a 1788 level 2 that cannot be implemented in 754. That would be a great waste of time. And if/where level 3 affects level 2, we need to understand that and possibly adjust level 1.

One particular example of that is:

From the 754 level 3 facts that and consequently (both level 2 and level 3)
It would be unfortunate if we designed a 1788 level 2 (or 3) that assumed we would use an unmodified 754 in the obvious way and that also assumed we could put decorations in the payload field of an Infinity (or a zero, or a normal, or of a subnormal). Only a NaN can have a payload.

I'm not claiming there are no solutions. One is to use more memory to hold an interval. One is to use Signaling NaNs whenever a decoration is required, and pay the price whenever one was used. And of course several of us have suggested in different ways that an enhanced 754 would be useful for Intervals and for just straight floating point usage.

- Ian McIntosh IBM Canada Lab Compiler Back End Support and Development

----- Forwarded by Ian McIntosh/Toronto/IBM on 10/29/2010 03:59 PM -----


From:

Nate Hayes <nh@xxxxxxxxxxxxxxxxx>

To:

Ian McIntosh/Toronto/IBM@IBMCA

Date:

10/26/2010 12:16 PM

Subject:

Re: Bare decorations (was ...level 2 datums) - level 2 versus level 3




Michel Hack wrote:
> Ian McIntosh wrote, partially agreeing with Nate Hayes' claim that
> there is "NO way" to discuss level 2 without reference to level 3:
>> It also shows that you NEED to know some of the Level 3 details to
>> determine parts of the Level 2 abstract data type (eg, that Infinities
>> cannot have payloads - IF 754 had used different exponent field values
>> for NaNs versus Infinities, then Infinities could have had payloads).
>
> Not so.  I have no difficulty at all understanding Level 2 on its own
> terms, including determining the cardinality of its support set.

Michel,

I'm sure it was innocent on your part (and I agree the recent e-mails on
this thread have been confusing at times), but just to set the record
straight: it was John Pryce who made the claim there is "NO way" to discuss
level 2 without reference to level 3, not me. I believe the claim is not
true, and agree with your comment above.

Nate Hayes

. . . [messages omitted] . . .

----- Forwarded by Ian McIntosh/Toronto/IBM on 10/29/2010 04:13 PM -----


From:

Ian McIntosh/Toronto/IBM@IBMCA

To:

Ian McIntosh/Toronto/IBM@IBMCA

Date:

10/25/2010 05:50 PM

Subject:

Re: Bare decorations (was ...level 2 datums) - level 2 versus level 3




JP>    How can one specify the set F of level 2 datums of IEEE 754's
JP>    "binary32" datatype in a representation-free way?
JP>  The specification must enable one to answer the question "how many such datums are there?",
JP>  i.e. to find the cardinality of F explicitly -- a boring but valid level 2 question.



Ignoring operations, rounding, exceptions etc., which are not part of the set of datums:


* Level 3:  There is a sign bit, stored as the uppermost bit, with 0 meaning positive and 1 meaning negative.


 Level 2:  There is a sign, which is either positive or negative.



* Level 3:  There is a 7 bit exponent field, stored between the sign bit and the fraction field.
           The exponent is biased, so the leftmost bit is 0 for negative exponents and 1 for zero or positive exponents.
           All zero bits indicates that the value is either a Zero (if the fraction field is all zero bits),
           or a Subnormal (if the fraction field has at least one nonzero bit).
           All one bits indicates that the value is either an Infinity (if the fraction field is all zero bits),
           or a NaN (if the fraction field has at least one nonzero bit).
           Infinities represent both Infinities (eg, from 1./0.) and overflows (eg, from maxfinite+maxfinite).
           Other values represent Normal values with the base 2 exponents 2^-62 to 2^+62.


 Level 2:  For Normal values there is a base 2 exponents 2^-62 to 2^+62.
           For Subnormal values the exponent is 2^-63 or less, and each step lower decreases the precision by one bit.
           The smallest positive nonzero value is 2^(-63-23).
           For Zeros, Infinities and NaNs there is no exponent.
           Infinities represent both conceptual infinities (eg, the result of 1./0.) and overflows (eg, from maxfinite+maxfinite rounded away from zero).



* Level 3:  There is a fraction field, stored as the lower 24 bits.
           The binary point is at the upper end.
           For Normal values the fraction is 25 bits, adjusted (with a corresponding adjustment to the exponent) so the upper bit is a 1.
           For Subnormal values the fraction is 25 bits with the upper bit 0.
           For Normals and Subnormals the upper bit is called the Hidden Bit and is not stored since it is always known.
           For NaNs the fraction distinguishes Quiet from Signaling NaNs and holds a "payload" of 24 bits, at least one being a 1.
           There way to distinguish Quiet versus Signaling NaNs is implementation defined,
           typically based on the uppermost payload bit (but which 0 means and which 1 means differs between implementations).
           For Zeros and Infinities there is no fraction or payload.


 Level 2:  For Normal and Subnormal values there is a fraction.
           For Normal values the fraction is 25 bits, adjusted (with a corresponding adjustment to the exponent) so the upper bit is a 1.
           For Subnormal values the fraction is 25 bits with the upper bit 0.
           For NaNs there is no fraction.  Instead there is a "payload" of 24 bits, at least one being a 1.
           For Zeros and Infinities there is no fraction or payload.



* Level 3:  The representation implies that positive and negative values are symmetrical
           (unlike twos complement integers where the most negative value has no corresponding positive value).
           Positive and negative Zeros are considered equal in value for comparisons and some operations,
           but distinguishable in other operations.


 Level 2:  Positive and negative values are symmetrical.
           Positive and negative Zeros are considered equal in value for comparisons and some operations,
           but distinguishable in other operations.



This should show how one can consider the Level 2 characteristics of an abstract data type without going into all the Level 3 representation details.  It doesn't matter how big the fields are, or what order they're in, or to some extent what values in them mean what, just what the possible representable values are.  In a way, semantics not syntax.


It also shows that you NEED to know some of the Level 3 details to determine parts of the Level 2 abstract data type (eg, that Infinities cannot have payloads - IF 754 had used different exponent field values for NaNs versus Infinities, then Infinities could have had payloads).


Similarly, one needs to understand the Level 3 representation and the Level 2 abstract data type to understand what aspects of the Level 1 mathematical concepts CAN and CANNOT be represented; eg, that Intervals represented via IEEE 754 floating point cannot distinguish the concept "positive infinity" represented by 754 +Infinity from the infinite set of finite values also mapped to the 754 representation +Infinity.  At some point we need to think about whether that makes any of our previous discussions and decisions just wishful thinking.


- Ian McIntosh IBM Canada Lab Compiler Back End Support and Development

----- Forwarded by Ian McIntosh/Toronto/IBM on 10/25/2010 04:37 PM -----


From:

John Pryce <j.d.pryce@xxxxxxxxxxxx>

To:

Ian McIntosh/Toronto/IBM@IBMCA

Date:

10/25/2010 05:33 AM

Subject:

Re: Bare decorations (was ...level 2 datums)




Nate

On 25 Oct 2010, at 06:09, Nate Hayes wrote:

>> It is possible to discuss Level 2 in the abstract, but there is NO way to
>> define a specific Level 2 floating-point or interval datatype without
>> describing it by some sort of formula, which usually amounts to a
>> representation.
>
> I'm sorry, John, but this is not true.
>
> It is done all the time. A good reference is Bertrand Meyer's book on
> object-oriented design where he describes an abstract datatype (ADT) purely
> in mathematical terms by:
>
>   -- its types (i.e., its mathematical sets)
>   -- its functions
>   -- its axioms
>   -- its preconditions (if any)

I have read books on OO design; indeed I consulted one of Grady Booch's while composing that last email. Maybe what's at issue is what my words "amounts to a representation" mean. So I ask you
  How can one specify the set F of level 2 datums of IEEE 754's
  "binary32" datatype in a representation-free way?
The specification must enable one to answer the question "how many such datums are there?", i.e. to find the cardinality of F explicitly -- a boring but valid level 2 question.

John