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

Re: text2interval again - the same but not the same



RF> >>>   I recall, but cannot spot some discussion of 0.5 vs 0.50.

AN> According to general consensus, these are the same numbers, both in
AN> mathematics and in computer science. So no discussion is needed.



Computer science is a diverse field.

In IEEE Binary Floating Point and most other representations, 0.5 and 0.50 have the same internal value so cannot be distinguished, but in IEEE 754-2008 Decimal Floating Point 0.5dd and 0.50dd are not exactly the same.  They will compare equal to each other, but the internal representation knows that the latter has 2 significant digits while the former has only 1, and that affects the number of significant digits of the result of operations they are used in and the result of some operations.  You can print a value so that only significant digits are produced.  In C, C++ and Fortran DFP can be the default instead of IEEE BFP or other representations, and in that case 0.5 and 0.50 (with no suffixes) are equal but not identical.  The same numbers but not the same numbers.

If they are the same base, is a number written as 0.5 the same as another written as 0.5?  In C, C++ and Java, 0.5 is double precision.  In Fortran it is generally single precision.  It sometimes means one half (infinite precision).  It's been used in these discussions with all three meanings.  The same numbers but not the same numbers.

If they are the same base and language, is single precision the same as single precision, and is double precision the same as double precision?  I've used computers where single was 24 bits, 32 bits, 36 bits, 48 bits, 60 bits and 64 bits, and compilers for those where double was either twice as big or the same size as single.  The same precisions but not the same precisions.  Thank goodness for IEEE 754!  Not that it solves everything, when "binary64x" means any of Intel's 80 bit extended precision or Motorola's 96 bit extended precision or IBM's PowerPC 128 bit (sometimes known as "double double") extended precision.


Outside mathematics and computer science, in the field of measurements, 0.5 and 0.50 are generally not exactly the same.  0.5 means the measured value is closer to 0.5 than to 0.4 or 0.6, while 0.50 means it is closer to 0.50 than to 0.49 or to 0.51.  Sometimes scientific notation is used to avoid overspecifying the precision of a measurement, not because the number is too large or small to write without an exponent. In measurement the number of digits usually implies the accuracy of the measurement.  Measured values are a form of interval.


Does that affect IEEE 1788?  Maybe, maybe not.  It's not essential but might be useful to some to have two text2interval constructors from a single string containing a single value:

text2interval ("0.5") = [0.500..., 0.500...]
and text2interval ("0.50") = [0.500..., 0.500...]
(the same)
but
measuredtext2interval ("0.5") = [0.45, 0.55]
and measuredtext2interval ("0.50") = [0.495, 0.505]
(not the same)

I've seen at least one 1788 email that I thought implied the author meant measuredtext2interval semantics and that rounding down or up should be based on the significant digits not ULPs.

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

McIntosh's Second Law:     Everything is more complicated than you expect, even when you take into account McIntosh's Second Law.


Inactive hide details for Arnold Neumaier ---03/08/2013 05:16:45 AM---On 03/08/2013 08:39 AM, Richard Fateman wrote: > On 3/7/2Arnold Neumaier ---03/08/2013 05:16:45 AM---On 03/08/2013 08:39 AM, Richard Fateman wrote: > On 3/7/2013 8:52 PM, Michel Hack wrote:


    From:

Arnold Neumaier <Arnold.Neumaier@xxxxxxxxxxxx>

    To:

Ian McIntosh/Toronto/IBM@IBMCA

    Date:

03/08/2013 05:16 AM

    Subject:

Re: text2interval again /





On 03/08/2013 08:39 AM, Richard Fateman wrote:
. . .
> Anyway, even a better version of correctness is still quite easy at
> least for bounded
> intervals and rational operations. Quality matters.
>>
>>>   I recall, but cannot spot some discussion of 0.5 vs 0.50.

According to general consensus, these are the same numbers, both in
mathematics and in computer science. So no discussion is needed.


Arnold Neumaier



GIF image

GIF image