From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 Date: Fri, 18 Apr 2014 20:52:22 +0100 Message-ID: From: Riddler To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: multipart/alternative; boundary=001a11c3735af2aee804f7567cc3 Subject: [9fans] Floating point and dividing by 0 Topicbox-Message-UUID: d9bec52a-ead8-11e9-9d60-3106f5b1d025 --001a11c3735af2aee804f7567cc3 Content-Type: text/plain; charset=UTF-8 Hello again, Continuing on with my floating point adventures, I have a question that I hope someone can provide some input on. I'm general idea of what I'm doing the following: double zero = 0.0; notify(fpnotecatch); //Ignore divide by zero note for a moment double pInf = 1.0/zero; notify(0); //Back to default note handler if(isInf(pInf, 1) <= 0 && isInf(pInf, 0) <= 0) exits("Divide by zero did not result in infinity"); The error "did not result in infinity" is always tripped. My understanding is that according to the spec it should have resulted in either + or - infinity. I suspect it's not required as there was a note thrown instead, and I can't think of any reason why you would deliberately ignore the note like I do of the top of my head. Thought I would mention it anyway see what input you guys had. Regards, Rid. --001a11c3735af2aee804f7567cc3 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hello again,

Continuing on wit= h my floating point adventures, I have a question that I hope someone can p= rovide some input on.

I'm general idea of what I'm doi= ng the following:
=C2=A0=C2=A0=C2=A0 double zero =3D 0.0;
=C2=A0=C2= =A0=C2=A0 notify(fpnotecatch); //Ignore divide by zero note for a moment
=C2=A0=C2=A0=C2=A0 double pInf =3D 1.0/zero;
=C2=A0= =C2=A0=C2=A0 notify(0); //Back to default note handler

=C2=A0=C2=A0=C2=A0 if(isInf(pInf, 1) <=3D 0 && isInf(pInf, = 0) <=3D 0) exits("Divide by zero did not result in infinity");=

The error "did not result in infinity&qu= ot; is always tripped. My understanding is that according to the spec it sh= ould have resulted in either + or - infinity.

I suspect it's not required as there was a note thrown i= nstead, and I can't think of any reason why you would deliberately igno= re the note like I do of the top of my head. Thought I would mention it any= way see what input you guys had.

Regards,
Rid.
--001a11c3735af2aee804f7567cc3--