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

}

{

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)?

@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).

Unfortunately there is no proper documentation for SymEngine.

@isuruf Which function should i use to extract the mpq( since it does not have a _get_ui type of a function)?

@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);

mpq_t testr;

mpq_init(testr);

rational_get_mpq(testr, e);

SYMENGINE_C_ASSERT(mpq_get_d(testr) == 0.5);

mpq_clear(testr);

SYMENGINE_C_ASSERT(mpq_cmp_ui(testr, 1, 2) == 0); ??