From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by listman.redhat.com (Postfix) with ESMTP id 69CB63EA5C for ; Tue, 2 Jul 2002 16:49:24 -0400 (EDT) Received: (from mail@localhost) by int-mx1.corp.redhat.com (8.11.6/8.11.6) id g62KnNC15360 for axp-list@listman.redhat.com; Tue, 2 Jul 2002 16:49:23 -0400 Received: from mx1.redhat.com (mx1.redhat.com [172.16.48.31]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with SMTP id g62KnNa15356 for ; Tue, 2 Jul 2002 16:49:23 -0400 Received: from cpimssmtpu03.email.msn.com (cpimssmtpu03.email.msn.com [207.46.181.79]) by mx1.redhat.com (8.11.6/8.11.6) with SMTP id g62KdR926188 for ; Tue, 2 Jul 2002 16:39:27 -0400 Received: from josephas ([67.112.123.116]) by cpimssmtpu03.email.msn.com with Microsoft SMTPSVC(5.0.2195.4617); Tue, 2 Jul 2002 13:48:27 -0700 Message-ID: <007601c22209$e53b1620$6501a8c0@josephas> From: "Joseph Ashwood" To: References: <200207021310.JAA21609@technolust.cx> <200207021927.g62JRe912800@mx1.redhat.com> Subject: Re: Floating point on alpha - SOLUTION 1 Date: Tue, 2 Jul 2002 13:45:52 -0700 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-OriginalArrivalTime: 02 Jul 2002 20:48:27.0845 (UTC) FILETIME=[D1210F50:01C22209] X-Loop: axp-list@redhat.com Sender: axp-list-admin@redhat.com Errors-To: axp-list-admin@redhat.com X-BeenThere: axp-list@redhat.com X-Mailman-Version: 2.0.1 Precedence: bulk Reply-To: axp-list@redhat.com List-Help: List-Post: List-Subscribe: , List-Id: Linux and Red Hat on Alpha processors List-Unsubscribe: , List-Archive: ----- Original Message ----- From: "Linus Gasser" > F*CK with -miee I can divide by 0 w/o trouble! What the heck is this? I can > have > > double a = 0, b = 1, c = 2; > b = c / a; > > Someone wake me up! What is going on here? There are a few possible explanations, sorry I don't know which one it is don't have Alpha docs in front of me right now. Depending on the chip itself, it may actually have a 0 for floating point numbers, 0 will actually be 2^-500 or something, which will introduce very small errors, but usually nothing that is critical. This takes care of division by 0 very cleanly, by eliminating the possibility. The second possibility is that division by 0 results in a special code output, IIRC Alpha does NOT use this one, it is exclusively the realm of PowerPC. Third possibility, division by 0 creates an output of infinite, if you print this to the screen it is generally printed as "#INF" or something similar. The fourth possibility is that -mieee switched off the floating point signaling completely so your division by 0 error goes undetected, and b receives garbage. It will take some experimentation and documentation to determine which of these (possibly case 1 and 3 in some cases) is the actual result. If you are writing something the needs to be portable, you will need to address all of these cases, since different systems behave slightly differently. Joe