Description

A licensee reported a bug in rounding of a call to FJsonValue::TryGetNumber(int64&) with large values.  In investigating this, it appears that equivalent problems also exist in FMath:: rounding functions.

Steps to Reproduce

 

double DVal = 4580814166857753.0;
 
FMath::RoundHalfFromZero(DVal); // 4580814166857754.0 - wrong
FMath::RoundHalfToZero(DVal); // 4580814166857752.0 - wrong
std::llround(DVal) // 4580814166857753.0 - right
 
FJsonValueNumber JsonVal(DVal);
int64 IntVal;
((FJsonValue&)JsonVal).TryGetNumber(IntVal); // 4580814166857754.0 - wrong

 

 

Have Comments or More Details?

There's no existing public thread on this issue, so head over to AnswerHub just mention UE-71305 in the post.

0
Login to Vote

Fixed
ComponentCore
Affects Versions4.22
Target Fix4.23
Fix Commit5369636
CreatedMar 8, 2019
ResolvedJan 11, 2021
UpdatedJan 11, 2021