[Bf-committers] Precision and default range of IntProperty
irieshinsuke at yahoo.co.jp
Fri Oct 4 18:12:41 CEST 2013
Thanks, Brecht. Will report the issue in the tracker.
13/10/05, Brecht Van Lommel wrote:
> On Fri, Oct 4, 2013 at 4:45 PM, IRIE Shinsuke <irieshinsuke at yahoo.co.jp> wrote:
>> Hi devs,
>> In Python3, "int" type number has variable precision, but IntProperty
>> provides a fixed precision integer. So, if a Python script saves a
>> very large number in the intger property, the value may overflow and
>> cause unexpected results. Indeed, an error caused by such overflow
>> was reported in the tracker:
>> Why doesn't integer property use variable precision? Intentional?
> It's intentional. Blender is written in C/C++, and they used fixed
> precision, variable precision would be quite difficult to add.
>> One more thing,
>> The description of IntProperty says "... min=-sys.maxint, max=sys.maxint, ...".
>> Here, sys.maxint not existing in Python3 can be substituted with
>> sys.maxsize. However, IntProperty actually uses INT_MIN and INT_MAX
>> for the default range, and sys.maxsize is not same as INT_MAX.
>> On Ubuntu (64bit or 32bit),
>> sys.maxsize = 9223372036854775807 or 2147483647
>> INT_MAX = 2147483647
>> LONG_MAX = 9223372036854775807L or 2147483647L
>> LLONG_MAX = 9223372036854775807LL
>> We should correct the description or change the default range.
> Agreed, but this kind of thing is best reported in the bug tracker.
> Bf-committers mailing list
> Bf-committers at blender.org
More information about the Bf-committers