From owner-sc22wg5@open-std.org  Sat Feb 13 04:53:52 2010
Return-Path: <owner-sc22wg5@open-std.org>
X-Original-To: sc22wg5-dom8
Delivered-To: sc22wg5-dom8@www2.open-std.org
Received: by www2.open-std.org (Postfix, from userid 521)
	id 93B5FC178DA; Sat, 13 Feb 2010 04:53:52 +0100 (CET)
X-Original-To: sc22wg5@open-std.org
Delivered-To: sc22wg5@open-std.org
Received: from ppsw-0.csi.cam.ac.uk (ppsw-0.csi.cam.ac.uk [131.111.8.130])
	by www2.open-std.org (Postfix) with ESMTP id AE91AC178D9
	for <sc22wg5@open-std.org>; Sat, 13 Feb 2010 04:53:49 +0100 (CET)
X-Cam-AntiVirus: no malware found
X-Cam-SpamDetails: not scanned
X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/
Received: from hermes-2.csi.cam.ac.uk ([131.111.8.54]:34171)
	by ppsw-0.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.150]:25)
	with esmtpa (EXTERNAL:nmm1) id 1Ng94m-0003n4-1m (Exim 4.70)
	(return-path <nmm1@hermes.cam.ac.uk>); Sat, 13 Feb 2010 03:53:48 +0000
Received: from prayer by hermes-2.csi.cam.ac.uk (hermes.cam.ac.uk)
	with local (PRAYER:nmm1) id 1Ng94m-0000N6-HL (Exim 4.67)
	(return-path <nmm1@hermes.cam.ac.uk>); Sat, 13 Feb 2010 03:53:48 +0000
Received: from [216.241.51.98] by webmail.hermes.cam.ac.uk
	with HTTP (Prayer-1.3.2); 13 Feb 2010 03:53:48 +0000
Date: 13 Feb 2010 03:53:48 +0000
From: "N.M. Maclaren" <nmm1@cam.ac.uk>
To: fortran standards email list for J3 <j3@j3-fortran.org>,
	WG5 <sc22wg5@open-std.org>
Subject: IEEE 754 [was re letter ballot on interps]
Message-ID: <Prayer.1.3.2.1002130353480.26916@hermes-2.csi.cam.ac.uk>
In-Reply-To: <20100212194545.AD859C3BA0D@www2.open-std.org>
References: <20100201122928.54FB8C178E4@www2.open-std.org>
 <20100212194545.AD859C3BA0D@www2.open-std.org>
X-Mailer: Prayer v1.3.2
Mime-Version: 1.0
Content-Type: text/plain; format=flowed; charset=ISO-8859-1
Sender: owner-sc22wg5@open-std.org
Precedence: bulk

On Feb 12 2010, Toon Moene wrote:
>
>F03/0078: This answer might come back to haunt us.  People who want to
>           follow IEEE 754 strictly *need* the assurance that the
>           text of the program is followed verbatim, because, although
>           X(I) / A is mathematically equivalent to X(I) * (1/A), it
>           certainly isn't in IEEE 754 arithmetic (compilers do this to
>           turn division by a loop-invariant into a cheaper
>           multiplication).

No, it is the converse answer that would come back to haunt us.  If you
want strictly deterministic floating-point results, then you should be
using a portable assembler.  Oh, and not writing seriously parallel
code, either.  I am not joking :-(

If you want IEEE 754 determinism, then ask yourself which of the
following should X**N generate (in general, they are all different):

    1) The binary reduction code using IEEE 754, which is what almost
every library does, but sometimes inline code doesn't.

    2) The same result as X*X*X*...

    3) The correctly rounded result of X^N.

There is also a similar problem with (parallel) reductions and operation
ordering.  And, there, in general, solution (3) is intractable - but
virtually nobody uses general reductions.

One of the things that was in the original objectives of IEEE 754 was
to tackle the reasons that no programming language had adopted it in
a couple of decades.  There were some reasonable proposals to change it
in the general direction of where programming languages have been since
the 1960s (sic).  But they lost out in committee.

Regards,
Nick Maclaren.


