From: Thomas Koenig on 16 May 2010 15:07 Consider the following program: program main implicit none real, dimension(1) :: a, b real, dimension(1,1) :: aa, bb a(1) = -1.0 b(1) = 0.0 print *,a(1)*b(1) print *,dot_product(a,b) aa(1,1) = -1.0 bb(1,1) = 0.0 print *,matmul(aa,bb) end program main Assuming that the processor supports signed zeros, is the following result OK? -0.0000000 0.0000000 0.0000000 From: robin on 16 May 2010 23:01 "Thomas Koenig" wrote in message news:hspfou\$ofo\$1(a)newsreader5.netcologne.de... | Consider the following program: | | program main | implicit none | real, dimension(1) :: a, b | real, dimension(1,1) :: aa, bb | a(1) = -1.0 | b(1) = 0.0 | print *,a(1)*b(1) | print *,dot_product(a,b) | aa(1,1) = -1.0 | bb(1,1) = 0.0 | print *,matmul(aa,bb) | end program main | | Assuming that the processor supports signed zeros, is the following | result OK? | | -0.0000000 | 0.0000000 | 0.0000000 Have you tried multiplying the result of a(1)*b(1) by, say, 1000, or of printing 15 digits for a(1)*b(1)? From: FX on 17 May 2010 02:24 > Have you tried multiplying the result of a(1)*b(1) by, say, 1000, or of> printing 15 digits for a(1)*b(1)? You are misled. The result really is a zero with a minus sign, and not a very small negative number. -- FX From: robin on 17 May 2010 06:06 "FX" wrote in message news:hsqnf4\$3v9\$1(a)nef.ens.fr... |> Have you tried multiplying the result of a(1)*b(1) by, say, 1000, or of | > printing 15 digits for a(1)*b(1)? | | You are misled. No. It has not yet been determined that there is no compiler bug. | The result really is a zero with a minus sign, and not a | very small negative number. You don't know that until you try what I suggested above. From: m_b_metcalf on 17 May 2010 06:20 On May 16, 9:07 pm, Thomas Koenig wrote:> Consider the following program: > > program main >   implicit none >   real, dimension(1) :: a, b >   real, dimension(1,1) :: aa, bb >   a(1) = -1.0 >   b(1) = 0.0 >   print *,a(1)*b(1) >   print *,dot_product(a,b) >   aa(1,1) = -1.0 >   bb(1,1) = 0.0 >   print *,matmul(aa,bb) > end program main > > Assuming that the processor supports signed zeros, is the following > result OK? > >   -0.0000000 >    0.0000000 >    0.0000000 The standard states; "Processors that distinguish between positive and negative zeros shall treat them as equivalent ... as actual arguments to intrinsic functions other than SIGN ..." Thus, the result seems correct (and I haven't a clue what Robin is wittering on about). Regards, Mike Metcalf