From: Ben B. <ben...@jp...> - 2006-06-01 14:12:54
|
Hi Rainer, Mike, Parameters are stored as C doubles so they need to store *some* value even when they're not set. This value is set to NaN if you call unsetValue(), but when an SBML Parameter structure is first created / initialized, it's apparently zero. Sorry, this is an implementation inconsistency on my part. That said, the value returned by getValue() should *not* be used / trusted if isSetValue() returns false (zero). LibSBML can't stop a programmer from calling getValue() (unless it throws an exception, but this wouldn't work for the C API). This error should be caught by XML Schema validation, which is one reason why we never added a check to libSBML 2. LibSBML 3 performs the check, since one of its design goals is to subsume all XML Schema checks. Thanks. Ben On May 29, 2006, at 2:37 AM, Rainer Machne wrote: > The non-constant parameters a and b in the example file have no > initial value, but are interpreted as 0 by SOSlib. > > I have attached a simple example program, which I compiled with > libsbml 2.3.4, probably from a version that was updated from CVS on > Feb 14 this year. > > It shows that Parameter_getValue returns 0 for both parameters even > though Parameter_isSetValue correctly returns "no" for both > parameters. > No errors are reported by the consistency check. > > > It is quite some bug in SOSlib. > Unfortunately, we didn't think earlier of this problem. > > So I'd have some questions to start repairing SOSlib: > > Does this happen on purpose, i.e. is 0 the default value to return, > if no value is set? > > For which other values (species, compartments) does this happen? > > and: > > Should there be a test in the consistency check? |