My preference is to allow the user to specify what transformations they would like to permit the implementation to perform in what contexts, as recommended by ieee 754 (sec 10.4). Perhaps an adverb S., such that [x] u S. y applies u with strict fp semantics. Or perhaps a function attribute, specified in similar manner to associativity (howsoever that is specified).

On Mon, 9 Jan 2023, Marshall Lochbaum wrote:

Well, true, I'm not in favor of rearranging +/ either. The dangers of
floating point don't include nondeterminism, unless you make them.

However, I also think matrix products have it worse. Numbers with widely
varying exponents are a bit of an edge case. But when you're multiplying
a few large matrices together they can show up naturally, so I expect
it's not so rare to have a product that's numerically stable in one
direction and not in the other.

Marshall

On Mon, Jan 09, 2023 at 05:52:34PM -0600, Omar Antolín Camarena wrote:
But that's just normal floating non-associativity. It happens even for addition of 
"integers":

   1 + (_1e19 + 1e19)
1
   (1 + _1e19) + 1e19
0

People using floating point are probably aware of the dangers or at least 
should be.

--
Omar
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to