MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / IsLosslessFloat

Function IsLosslessFloat

rapidjson/document.h:992–1000  ·  view source on GitHub ↗

Checks whether a number can be losslessly converted to a float.

Source from the content-addressed store, hash-verified

990 }
991 // Checks whether a number can be losslessly converted to a float.
992 bool IsLosslessFloat() const {
993 if (!IsNumber()) return false;
994 double a = GetDouble();
995 if (a < static_cast<double>(-std::numeric_limits<float>::max())
996 || a > static_cast<double>(std::numeric_limits<float>::max()))
997 return false;
998 double b = static_cast<double>(static_cast<float>(a));
999 return a >= b && a <= b; // Prevent -Wfloat-equal
1000 }
1001
1002 //@}
1003

Callers

nothing calls this directly

Calls 2

IsNumberFunction · 0.85
GetDoubleFunction · 0.85

Tested by

no test coverage detected