Incorrect result of 1.0/-0.0

Tested under SUA and Windows

#include <stdio.h>
int main ()
{
  double zero=0.0;
  printf("1.0/0.0=%f\n",1.0/zero);
  printf("1.0/-0.0=%f\n",1.0/-zero);
  return 0;
}

Windows example (pgcc):

$ pgcc -V && pgcc -o fptest fptest.c && ./fptest
pgcc 7.2-3 64-bit target on Win64
Copyright 1989-2000, The Portland Group, Inc.  All Rights Reserved.
Copyright 2000-2008, STMicroelectronics, Inc.  All Rights Reserved.
1.0/0.0=1.#INF00
1.0/-0.0=1.#INF00

SUA example (pgcc):

$ pgcc -V && pgcc -o fptest fptest.c && ./fptest
pgcc 7.2-1 64-bit target on 64-bit SUA
Copyright 1989-2000, The Portland Group, Inc.  All Rights Reserved.
Copyright 2000-2008, STMicroelectronics, Inc.  All Rights Reserved.
1.0/0.0=Inf
1.0/-0.0=Inf

Result with gcc:

$ gcc --version && gcc -o fptest fptest.c && ./fptest
gcc (GCC) 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

1.0/0.0=inf
1.0/-0.0=-inf

Result with MS VC++ under SUA

$ cc -o fptest fptest.c && ./fptest
1.0/0.0=Inf
1.0/-0.0=-Inf

2developers: May I hope that you fix that error in your compiler as soon as possible? For example, libxml2 & libxslt got errors due “make check” because of this “particular” compiler.
Thanks,
Dmitry.

Hi Dmitry,

We have TPR # 3963 for this bug. We will keep you posted about its progress.


Thank you for reporting to us.
Hongyon