Answers for "My statistic exceed int32 value limit."
https://community.playfab.com/questions/6017/my-statistic-exceed-int32-value-limit.html
The latest answers for the question "My statistic exceed int32 value limit."Answer by Andrew Garrahan
https://community.playfab.com/answers/69057/view.html
<p>Here is the code nerds. You can store a double into int, however you lose a little precision. </p>
<pre><code> public static int encode(double num)
{
int exp = (int)Math.Floor(Math.Log10(num));
int mantissa = (int)Math.Round((num / Math.Pow(10, exp)) * 100000);
return exp * 1000000 + mantissa;
}
public static double decode(int num)
{
double exp = Math.Floor( num/ 1000000f);
double mantissa = (num - exp * 1000000) / 100000;
return mantissa * Math.Pow(10, exp);
}
</code></pre>Tue, 28 Feb 2023 06:52:27 GMTAndrew GarrahanAnswer by Brendan
https://community.playfab.com/answers/6018/view.html
<p>Due to the limitations of some languages/platforms, the statistics are indeed uint32 values. We may in future provide a different form of statistic that's 64 bit (or higher), but if you're specifically asking how to represent values that exceed 32 bits, while maintaining the same granularity (so, being able to differentiate values which are off by 1 from each other), that's not technically possible using 32 bit values. It's possible to store any size value as user data, but (of course) that wouldn't provide you with a leaderboard system for those values. I would have to recommend that you use an external data table for leaderboards, if that's a hard requirement for your title.</p>Fri, 21 Oct 2016 04:29:56 GMTBrendan