Hey All,
I wasn’t sure which category to post this under, so I did two identical posts to separate sections.
So I’ve found what I believe to be a bug in the BigInt class, but it may be specced this way. Basically, trying to initialize a BigInt with a hex FString gives me unexpected results when the value of the hex string is larger than 65,535.
The following code:
TBigInt<128> int128_1(“ffff”);
TBigInt<128> int128_2(“10000”);
UE_LOG(LogTemp, Warning, TEXT("%s"), *int128_1.ToString());
UE_LOG(LogTemp, Warning, TEXT("%s"), *int128_2.ToString());
Produces the output:
LogTemp:Warning: 0x0000ffff
LogTemp:Warning: 0x0000000100000000
Meaning that for values up to and including 65,535 (u16 max), this constructor works, but for any values past that, starting with 65,536, the constructor initializes the BigInt to 4,294,967,296 (u32 max). If this is intended behavior please let me know, because I need to be able to serialize these numbers in and out of a text file. Storing them as hex values works fine until they get larger than 65535. So if this is intended, I need to either write functionality into this class, write my own, or go with GMP.
Thanks!
Branden Turner