complex::isnan()

This commit is contained in:
Kelvin Sherlock 2013-10-20 20:04:38 -04:00
parent 00e519cdff
commit afdfbf7c33
1 changed files with 7 additions and 0 deletions

View File

@ -62,6 +62,11 @@ using std::to_string;
complex(uint64_t rhs) : _data(rhs)
{}
bool isnan() const
{
return _data == NaN;
}
complex &operator=(const complex &rhs)
{
_data = rhs._data;
@ -156,6 +161,8 @@ using std::to_string;
// then override SANE::to_string.
std::string to_string(complex c)
{
if (c.isnan()) return std::string("nan");
return std::to_string((int64_t)c);
}