From: Thomas Koenig on
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
"Thomas Koenig" <tkoenig(a)netcologne.de> 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
> 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
"FX" <coudert(a)alussinan.org> 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
On May 16, 9:07 pm, Thomas Koenig <tkoe...(a)netcologne.de> 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