The FMath::TruncToInt() function takes a float parameter, but some calls to this function pass in a double value. For most use cases, this will probably work fine. However, if the integer values are larger than 2^24, such as a UNIX Timestamp, converting the value to a float before truncating results in a loss of precision since the float type cannot accurately store integer values larger than 2^24. It may be useful to have an overloaded version of TruncToInt() that takes a double parameter.
RESULT:
Integer values larger than 2^24 are not accurately returned from TruncToInt().
EXPECTED:
TruncToInt() accurately returns any integer value that can be stored as an int32.
Head over to the existing Questions & Answers thread and let us know what's up.
14 |
Component | UE - Foundation - Core |
---|---|
Affects Versions | 4.12.5, 4.14 |
Created | Aug 4, 2016 |
---|---|
Resolved | Aug 18, 2021 |
Updated | Aug 18, 2021 |