int64 f_bccomp(CStrRef left, CStrRef right, int64 scale /* = -1 */) { if (scale < 0) scale = BCG(bc_precision); bc_num first, second; bc_init_num(&first); bc_init_num(&second); bc_str2num(&first, (char*)left.data(), scale); bc_str2num(&second, (char*)right.data(), scale); int64 ret = bc_compare(first, second); bc_free_num(&first); bc_free_num(&second); return ret; }
static int64_t HHVM_FUNCTION(bccomp, const String& left, const String& right, int64_t scale /* = -1 */) { if (scale < 0) scale = BCG(bc_precision); bc_num first, second; bc_init_num(&first); bc_init_num(&second); bc_str2num(&first, (char*)left.data(), scale); bc_str2num(&second, (char*)right.data(), scale); int64_t ret = bc_compare(first, second); bc_free_num(&first); bc_free_num(&second); return ret; }
// compare equal with another BigNumber bool BigNumber::operator== (const BigNumber & rhs) const { return bc_compare (num_, rhs.num_) == 0; } // end of BigNumber::operator==