I'm using symengine in a C++ project and am confused how I can get C++ boolean values from the Gt, Lt, Ge, Le, etc. Because they seem to only actually return a boolean result in case which the expressions one is comparing fully reduce into a "number" node rather than as an expression tree that defines a number but not as a single node.
Consider the following
namespace se = SymEngine;
se::Expression eight("2 ** 3");
se::Expression phi("(1 + sqrt(5)) / 2");
std::cout << eight << " > " << three << " => " <<
((se::Gt(eight, three) == se::boolTrue) ? "true" : "false") << "\n"; // A
std::cout << one_hundred << " > " << phi << " => " <<
((se::Gt(one_hundred, phi) == se::boolTrue) ? "true" : "false") << "\n"; // B
A will return true but B will not because B returns some object, I believe, representing the relation since lhs and rhs are not both simple numbers. Is there some way to do a comparison like this and get back a C++ bool as expected.
Also looking at the code for se::Gt(...) I see this
RCP<const Boolean> Gt(const RCP<const Basic> &lhs, const RCP<const Basic> &rhs)
return Lt(rhs, lhs);
but this is incorrect math, (a > b) is the same thing as (b <= a) not (b < a). This mistake seems to be all over the file symengine\logic.cpp