mirror of
https://github.com/zebrajr/ladybird.git
synced 2025-12-06 00:19:53 +01:00
LibWasm: Cast to long double before checking if trunactions is in range
I found that this fixes some precision issues while comparing to values on the edge of the limits. Fixes 6 tests in conversions.wast on WPT.
This commit is contained in:
parent
11a1e97e40
commit
692195ae88
|
|
@ -1046,7 +1046,7 @@ struct CheckedTruncate {
|
|||
// FIXME: This function assumes that all values of ResultT are representable in Lhs
|
||||
// the assumption comes from the fact that this was used exclusively by LibJS,
|
||||
// which only considers values that are all representable in 'double'.
|
||||
if (!AK::is_within_range<ResultT>(truncated))
|
||||
if (!AK::is_within_range<ResultT>(static_cast<long double>(truncated)))
|
||||
return "Truncation out of range"sv;
|
||||
|
||||
return static_cast<ResultT>(truncated);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user