On 15/03/2013 17:42, baloo wrote:
> Thank you for your attention!
>
> Seems like the bug is still not fixed by your patch. Trying
> /obabel -isdf test.sdf -osdf --filter "MyProp<-1 & MyProp<-1.5"/
> with the same SDF file still gives "0 molecules converted".
>
> In this example, while parsing the first statement of the filter
> (/MyProp<-1/), after line 267 in descriptor.cpp (/optionText >> val;/), the
> filter stream (/optionText/) is
> /&MyProp<-1.5/
> so it neither has EOF bit set, nor starts with ')'. This leads (again) to
> setting /val/ to NAN, which in turn causes identification of the value as
> string.
>
> What is actually the purpose of these lines?
> /if(!optionText.eof() && optionText.peek()!=')')
> val = std::numeric_limits<double>::quiet_NaN();/
They are intended to determine what kind of comparison to apply: numeric
(return is real) or string (return is NaN).
This does much better (see if you agree):
if(!optionText.eof() && isalpha(optionText.peek()))
val = std::numeric_limits<double>::quiet_NaN();
The code has the common problem of being written progressively:
originally aiming to do a simple comparison but then successively being
modified to apply to more general cases. With hindsight, it would have
been better to have started with a systematic parser with definitions of
numbers, identifiers, expressions etc. But, unless you have lots of
enthusiasm, it is probably too late for that.
Chris
>
> Oleksii
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
OpenBabel-Devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbabel-devel