mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 06:32:30 +02:00
LibJS: Remove last use of DeprecatedString from Intl.MathematicalValue
This commit is contained in:
committed by
Linus Groh
parent
a65bf16cd5
commit
a824e1ac6a
Notes:
sideshowbarker
2024-07-17 11:30:05 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/a824e1ac6a Pull-request: https://github.com/SerenityOS/serenity/pull/17208 Reviewed-by: https://github.com/linusg ✅
@@ -229,17 +229,18 @@ bool MathematicalValue::modulo_is_zero(Checked<i32> mod) const
|
||||
[](auto) -> bool { VERIFY_NOT_REACHED(); });
|
||||
}
|
||||
|
||||
int MathematicalValue::logarithmic_floor() const
|
||||
ThrowCompletionOr<int> MathematicalValue::logarithmic_floor(VM& vm) const
|
||||
{
|
||||
return m_value.visit(
|
||||
[](double value) {
|
||||
[](double value) -> ThrowCompletionOr<int> {
|
||||
return static_cast<int>(floor(log10(value)));
|
||||
},
|
||||
[](Crypto::SignedBigInteger const& value) {
|
||||
[&](Crypto::SignedBigInteger const& value) -> ThrowCompletionOr<int> {
|
||||
// FIXME: Can we do this without string conversion?
|
||||
return static_cast<int>(value.to_base_deprecated(10).length() - 1);
|
||||
auto value_as_string = TRY_OR_THROW_OOM(vm, value.to_base(10));
|
||||
return static_cast<int>(value_as_string.bytes_as_string_view().length() - 1);
|
||||
},
|
||||
[](auto) -> int { VERIFY_NOT_REACHED(); });
|
||||
[](auto) -> ThrowCompletionOr<int> { VERIFY_NOT_REACHED(); });
|
||||
}
|
||||
|
||||
bool MathematicalValue::is_equal_to(MathematicalValue const& other) const
|
||||
|
||||
Reference in New Issue
Block a user