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

Function IsLosslessDouble

rapidjson/document.h:965–982  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

963
964 // Checks whether a number can be losslessly converted to a double.
965 bool IsLosslessDouble() const {
966 if (!IsNumber()) return false;
967 if (IsUint64()) {
968 uint64_t u = GetUint64();
969 volatile double d = static_cast<double>(u);
970 return (d >= 0.0)
971 && (d < static_cast<double>(std::numeric_limits<uint64_t>::max()))
972 && (u == static_cast<uint64_t>(d));
973 }
974 if (IsInt64()) {
975 int64_t i = GetInt64();
976 volatile double d = static_cast<double>(i);
977 return (d >= static_cast<double>(std::numeric_limits<int64_t>::min()))
978 && (d < static_cast<double>(std::numeric_limits<int64_t>::max()))
979 && (i == static_cast<int64_t>(d));
980 }
981 return true; // double, int, uint are always lossless
982 }
983
984 // Checks whether a number is a float (possible lossy).
985 bool IsFloat() const {

Callers

nothing calls this directly

Calls 5

IsNumberFunction · 0.85
IsUint64Function · 0.85
GetUint64Function · 0.85
IsInt64Function · 0.85
GetInt64Function · 0.85

Tested by

no test coverage detected