Code: Select all
float d = - 0.625;
char tmp[80]; snprintf(tmp,20, "G:%g D:%f",d,d);
cout << tmp << endl;
ParsedJsonDataSet test;
test.StartBuilding();
test.Add("DBL",d);
test.DoneBuilding();
test.PrintObject();
cout << endl;
If variable "d" is set to -9.625, the output is the same.G:-0.625 D:-0.6250
{"DBL":625}
I think it can be traced back to the code in json_lexer.cpp starting at line 442 to 448 which are:
Code: Select all
442 case STATE_NUM_FIRST_NEG :
443 if((c>='1') && (c<'9'))
444 {
445 AddNumberChar(c);
446 m_state=STATE_NUM_FIRST_DIG;
447 }
448 break;
I changed line 443 to
Code: Select all
if((c>='0') && (c<='9'))
I am working in the field on a system controlling a pressure vessel and I don't want to blow it up if I am wrong about the bug. It is a good thing that the bug results in a high side temperature report. I can't do a lot of testing in the field, so I would appreciate if someone could have a look at this and let me know if my fix will not break something else.
Note that there are mechanical safety measures in place that would keep the system from actually causing harm (other than to my reputation).
Thanks
Ed.