[clean-list] Re: (digest) IEEE floating point and Clean

Siegfried Gonzi siegfried.gonzi@kfunigraz.ac.at
Wed, 12 Sep 2001 17:53:21 +0200


>   4. IEEE floating point and Clean (Siegfried Gonzi)

> From: Siegfried Gonzi <siegfried.gonzi@kfunigraz.ac.at>

> What about Java here?
> 
> Are my Clean examples some sort of "exception handling"? I cannot prove
> it with Java,
> because I do not have installed a Java development kit on any of my
> platforms.

Only for the sake of completeness. I got a private mail with the Java
values. And to my surprise Java behaves the same as how  Clean (Java
delivers the same values) does.

Surprise in so far, as I thought Java would abort or randomly calculate
big values (as you are experiencing when you cope with the
post_fence_error in C). But neither was happening.

I think now Kahan is playing hardball with his title "Why Java's
floating point hurts everyone everywhere". Not because Clean could also
adopt this title, but as explained above I thought the problem in Java
is more severe.

Even Kahans recommendation could one lead to the misconception that he
can now assure on his results. Even with 8bytes one cannot calculate
every numerical problem to the last digit. One often needs more bytes
10bytes and more. I think --under the assumption the hardware in the
future will join in-- Clean should not sleep in this fact!

C and Fortran will not sleep!

But as postscript. The following C code snippet is of interest (I got
this in companion with the above mentioned Java results from an reader
as private mail):

#include <stdio.h>
int main (){

  printf("Question 1\n");
  printf("%d\n",0.0/0.0);
  printf("%d\n",1.0/0.0);
  printf("%d\n",1.0/(-0.0));
  printf("%d\n",0.0/(1.0/0.0));
  printf("%d\n",0.0/(1.0/(-0.0)));
}

Gives
Question 1
0
0
0
0
0


What does this mean? Or is there an printf option which lets you set
exceptions?

S. Gonzi