mirror of
https://github.com/ksherlock/mpw.git
synced 2024-11-25 19:30:50 +00:00
complex::isnan()
This commit is contained in:
parent
00e519cdff
commit
afdfbf7c33
@ -62,6 +62,11 @@ using std::to_string;
|
|||||||
complex(uint64_t rhs) : _data(rhs)
|
complex(uint64_t rhs) : _data(rhs)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
bool isnan() const
|
||||||
|
{
|
||||||
|
return _data == NaN;
|
||||||
|
}
|
||||||
|
|
||||||
complex &operator=(const complex &rhs)
|
complex &operator=(const complex &rhs)
|
||||||
{
|
{
|
||||||
_data = rhs._data;
|
_data = rhs._data;
|
||||||
@ -156,6 +161,8 @@ using std::to_string;
|
|||||||
// then override SANE::to_string.
|
// then override SANE::to_string.
|
||||||
std::string to_string(complex c)
|
std::string to_string(complex c)
|
||||||
{
|
{
|
||||||
|
if (c.isnan()) return std::string("nan");
|
||||||
|
|
||||||
return std::to_string((int64_t)c);
|
return std::to_string((int64_t)c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user