Beispiel #1
0
int sg_big_float_try_to_get_c_int_type(sg_big_float_t *src, enum sg_c_int_type *type)
{
    if (!src || !type)
        return -1;

    if (mpf_fits_sshort_p(src->mpf))
        *type = SGCINTTYPE_SSHORT;
    else if (mpf_fits_ushort_p(src->mpf))
        *type = SGCINTTYPE_USHORT;
    else if (mpf_fits_sint_p(src->mpf))
        *type = SGCINTTYPE_SINT;
    else if (mpf_fits_uint_p(src->mpf))
        *type = SGCINTTYPE_UINT;
    else if (mpf_fits_slong_p(src->mpf))
        *type = SGCINTTYPE_SLONG;
    else if (mpf_fits_ulong_p(src->mpf))
        *type = SGCINTTYPE_ULONG;

    return 0;
}
Beispiel #2
0
static int
e_mpf_ulong_p (mpf_srcptr f)
{
  return mpf_integer_p (f) && mpf_fits_ulong_p (f);
}