View Issue Details

IDProjectCategoryView StatusLast Update
0000049OpenFOAMBugpublic2010-10-07 18:01
Reporteruser38Assigned Tohenry  
PrioritynormalSeverityminorReproducibilityhave not tried
Status resolvedResolutionfixed 
PlatformLinuxOSUbuntuOS Version10.04
Summary0000049: wrong data load from a file (input stream bug)
DescriptionWhen I read a very big scalar with no "." and without scientific notation, 1111111111111111 for instance, from a file (dictiontary lookup, or using IFstream) I found that the data is always 2.14748e+09.

ifstream in standard c++ works.
Steps To Reproducein ktr.txt 11111111111111

code segment:

ifstream out;
out.open("ktr.txt");
double varr;
out>> varr;

std::cout<<"varr="<<varr<<endl;

IFstream In("ktr.txt");
In>>varr;
Info<<varr<<endl;


output:
varr=1.11111e+12 //good for ifstream
2.14748e+09 // bad for IFstream
TagsInput/output, Modelling

Activities

henry

2010-09-28 16:41

manager   ~0000054

The number 11111111111111 appears to the reader as a label and is initially read as such and converted to a scalar in an automatic conversion. The problem is that the 4byte integer we usually use to represent labels is not sufficient to store 11111111111111.

If you recompile OpenFOAM to use an 8byte integer for label then 11111111111111 could be read correctly as a label and converted.

Alternatively change the format of your input numbers to be unambiguous, i.e. include a "." in scalars which will avoid the above overflow and improve read efficiency.

user4

2010-09-29 11:57

  ~0000056

Last edited: 2010-09-29 12:09

This issue is now fixed in our development line: commit 4ddaba59f33f999a41f560a6ba321f403aae4444 and will be included in the next release.

Issue History

Date Modified Username Field Change
2010-09-28 16:10 user38 New Issue
2010-09-28 16:33 henry Assigned To => henry
2010-09-28 16:33 henry Status new => assigned
2010-09-28 16:41 henry Note Added: 0000054
2010-09-28 16:41 henry Status assigned => resolved
2010-09-28 16:41 henry Resolution open => fixed
2010-09-29 11:57 user4 Note Added: 0000056
2010-09-29 12:09 henry Note Edited: 0000056
2010-10-07 18:01 user2 Tag Attached: Input/output
2010-10-07 18:01 user2 Tag Attached: Modelling