1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 01:17:35 +00:00

LibCrypto: Add a way to compare a SignedBigInteger with a double

This supports any double value (except for NaNs) instead of having to
cast the double to some smaller type which doesn't work for very large
values.
This commit is contained in:
davidot 2022-08-19 23:45:36 +02:00 committed by Linus Groh
parent 14264ca022
commit b5c00830c2
3 changed files with 271 additions and 1 deletions

View file

@ -139,6 +139,14 @@ public:
[[nodiscard]] bool operator<(UnsignedBigInteger const& other) const;
[[nodiscard]] bool operator>(UnsignedBigInteger const& other) const;
enum class CompareResult {
DoubleEqualsBigInt,
DoubleLessThanBigInt,
DoubleGreaterThanBigInt
};
[[nodiscard]] CompareResult compare_to_double(double) const;
private:
void ensure_sign_is_valid()
{