View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0000049 | OpenFOAM | Bug | public | 2010-09-28 16:10 | 2010-10-07 18:01 |
Reporter | Assigned To | henry | |||
Priority | normal | Severity | minor | Reproducibility | have not tried |
Status | resolved | Resolution | fixed | ||
Platform | Linux | OS | Ubuntu | OS Version | 10.04 |
Summary | 0000049: wrong data load from a file (input stream bug) | ||||
Description | When 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 Reproduce | in 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 | ||||
Tags | Input/output, Modelling | ||||
|
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. |
|
This issue is now fixed in our development line: commit 4ddaba59f33f999a41f560a6ba321f403aae4444 and will be included in the next release. |
Date Modified | Username | Field | Change |
---|---|---|---|
2010-09-28 16:10 |
|
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 |
|
Note Added: 0000056 | |
2010-09-29 12:09 | henry | Note Edited: 0000056 | |
2010-10-07 18:01 |
|
Tag Attached: Input/output | |
2010-10-07 18:01 |
|
Tag Attached: Modelling |