Moderator: Gehn Shard
Acorn wrote:I'll look at my logs if someone can tell me what I'm looking for! But you seem to have got onto some possible leads.
(03/25 19:18:55) Dni time: 1332695933, last growth: 1332243299
(03/25 19:18:55) Growsizes: 0
(03/25 19:18:55) CurrentValue: 31, size: 3, state 1
(03/25 19:18:55) psnlYeeshaPageChanges: Attempting to enable drawing and collision on PonderosaBig_03...
(03/25 19:18:55) Dni time: 1332695933, last growth: 1332243299
sizes = timeDelta / (dayLength * 15)
Deledrius wrote:Or there's something I'm not considering with the rounding in division operations (or was that in Python 3.x?)
johnsojc wrote: I can't tell if this is all integer math...
Idle thought: I am assuming the code
- Code: Select all
sizes = timeDelta / (dayLength * 15)
is integer math but just how is it handled internally in Python? Could it be rounding up an internal value of 1.5 to 2 causing the tree to jump 2 sizes if the last growth was something like 22 days ago? This would certainly explain what I saw. If this is what is happening, a growth would be triggerred every 7.5 days.
Deledrius wrote:Deledrius wrote:Or there's something I'm not considering with the rounding in division operations (or was that in Python 3.x?)johnsojc wrote: I can't tell if this is all integer math...
Idle thought: I am assuming the code
- Code: Select all
sizes = timeDelta / (dayLength * 15)
is integer math but just how is it handled internally in Python? Could it be rounding up an internal value of 1.5 to 2 causing the tree to jump 2 sizes if the last growth was something like 22 days ago? This would certainly explain what I saw. If this is what is happening, a growth would be triggerred every 7.5 days.
As I suspected, Python 2.2 changed division behaviour (Yay, ABM) and Python 3 was the endcap for those changes. Given that both timeDelta and dayLength should be integers, yeah... we're going to get rounding inaccuracies here. If I understand the PEP correctly we should be receiving a floor value for sizes, which should never be bumping things up early, and is actually the kind of result you want for counting the number of full sizes the timeDelta requires. Hmm...
sizes = timeDelta / (dayLength * 15.0) #Now it's floating-point math
Paradox wrote:To get an actual decimal value for sizes, change 15 to 15.0 (so that it's a float).
- Code: Select all
sizes = timeDelta / (dayLength * 15.0) #Now it's floating-point math
Users browsing this forum: No registered users and 3 guests