1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:17:36 +00:00

LibWasm: Implement fx.nearest using nearbyint() instead of round()

This instruction wants RoundingMode::ToEven, so let's use the correct
function.
This commit is contained in:
Ali Mohammad Pur 2021-08-30 16:21:21 +04:30 committed by Andreas Kling
parent e93c740df5
commit 2c7e2e351a
2 changed files with 5 additions and 5 deletions

View file

@ -271,14 +271,14 @@ struct Truncate {
static StringView name() { return "truncate"; }
};
struct Round {
struct NearbyIntegral {
template<typename Lhs>
auto operator()(Lhs lhs) const
{
if constexpr (IsSame<Lhs, float>)
return roundf(lhs);
return nearbyintf(lhs);
else if constexpr (IsSame<Lhs, double>)
return round(lhs);
return nearbyint(lhs);
else
VERIFY_NOT_REACHED();
}