コード例 #1
0
ファイル: pgsNumber.cpp プロジェクト: Joe-xXx/pgadmin3
pgsOperand pgsNumber::pgs_plus(const pgsVariable &rhs) const
{
	if (rhs.is_number())
	{
		return pnew pgsNumber(pgsMapm::pgs_mapm_str(num(m_data)
		                      + num(rhs.value())), is_real() || rhs.is_real());
	}
	else
	{
		throw pgsArithmeticException(m_data, rhs.value());
	}
}
コード例 #2
0
ファイル: pgsNumber.cpp プロジェクト: Joe-xXx/pgadmin3
pgsOperand pgsNumber::pgs_over(const pgsVariable &rhs) const
{
	if (rhs.is_number())
	{
		if (num(rhs.value()) != 0)
		{
			if (is_real() || rhs.is_real())
				return pnew pgsNumber(pgsMapm::pgs_mapm_str(num(m_data)
				                      / num(rhs.value())), is_real() || rhs.is_real());
			else
				return pnew pgsNumber(pgsMapm::pgs_mapm_str(num(m_data)
				                      .div(num(rhs.value()))), is_real() || rhs.is_real());
		}
		else
		{
			throw pgsArithmeticException(m_data, rhs.value());
		}
	}
	else
	{
		throw pgsArithmeticException(m_data, rhs.value());
	}
}