[Bug c++/35397] New: Problem handling denormalized numbers under AIX

efernandez at physiomics-plc dot com gcc-bugzilla@gcc.gnu.org
Thu Feb 28 09:02:00 GMT 2008


I face a problem when trying to convert string to double numbers, when the
string represents a denormalized number.

I use g++ 4.2.2 on powerpc-ibm-aix5.3.0.0.

Example:
-------------
#include <vector>
#include <sstream>
#include <iostream>

int main() {
  std::stringstream stream("5.6 0 0.205867 1.0809 7.22644 0.373206
-5.84675e-317 1.99995 0.00433641 1.45331e-45");
  std::vector<double> vals;
  double x;
  while (stream >> x) 
    {
      vals.push_back(x);
    }
  std::vector<double>::iterator it;
  for (it=vals.begin(); it<vals.end(); it++) {
    std::cout<<*it << " ";
  }
  return 0;
}
------------------

displays: 5.6 0 0.205867 1.0809 7.22644 0.373206
The denormalized number -5.84675e-317 is dropped and the loop ends.

Interestingly, if I use:
--------------
double x;
std::string st;
  while (stream >> st) {
      x = atof(st.c_str());
      vals.push_back(x);
    }
-------------

then that works, this displays: 5.6 0 0.205867 1.0809 7.22644 0.373206
-5.84675e-317 1.99995 0.00433641 1.45331e-45

I have seen there were some denormalized-related options for g++ on Alpha, but
they are not implemented on AIX. Moreover, I don't see this issue under
Linux/gcc 4.2.2.


-- 
           Summary: Problem handling denormalized numbers under AIX
           Product: gcc
           Version: 4.2.2
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: efernandez at physiomics-plc dot com
  GCC host triplet: powerpc-ibm-aix5.3.0.0
GCC target triplet: powerpc-ibm-aix5.3.0.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35397



More information about the Gcc-bugs mailing list