These are chat archives for symengine/symengine

27th
Oct 2016
Shikhar Jaiswal
@ShikharJ
Oct 27 2016 07:58
CWRAPPER_OUTPUT_TYPE rational_get_mpq(mpq_t a, const basic s)
{
CWRAPPER_BEGIN
SYMENGINE_ASSERT(is_a<Rational>(*(s->m)));
mpq_set(a, get_mpq_t(
(rcp_static_cast<const Rational>(s->m))->as_rational_class()));
CWRAPPER_END
}
@isuruf Is this the type of implementation expected for Issue #1088 (the first feature)?
Isuru Fernando
@isuruf
Oct 27 2016 11:36
@ShikharJ, yes
Shikhar Jaiswal
@ShikharJ
Oct 27 2016 12:42
@isuruf Thanks! By the way, could you suggest me some resources from where I can learn about the entire SymEngine Codebase (I couldn't find a proper documentation, and hence as a newbie, I am overwhelmed by the number of functions that the repository currently has).
Isuru Fernando
@isuruf
Oct 27 2016 14:06
Unfortunately there is no proper documentation for SymEngine.
Shikhar Jaiswal
@ShikharJ
Oct 27 2016 17:41
@isuruf Which function should i use to extract the mpq( since it does not have a _get_ui type of a function)?
Shikhar Jaiswal
@ShikharJ
Oct 27 2016 18:12
@isuruf @certik Does this test make sense? (Issue #1088 Adding rational_get_mpq())
rational_set_ui(e, 2, 4);
mpq_t testr;
mpq_init(testr);
rational_get_mpq(testr, e);
SYMENGINE_C_ASSERT(mpq_get_d(testr) == 0.5);
mpq_clear(testr);
Shikhar Jaiswal
@ShikharJ
Oct 27 2016 18:25
or a test like this
SYMENGINE_C_ASSERT(mpq_cmp_ui(testr, 1, 2) == 0); ??