Re: possible new bug - relto tree
Posted: Sun Mar 25, 2012 11:25 pm
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.
In Python.0.elf look for these lines which is the tree growth update: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.
Code: Select all
(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
Code: Select all
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?)
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...johnsojc wrote: I can't tell if this is all integer math...
Idle thought: I am assuming the codeis 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.Code: Select all
sizes = timeDelta / (dayLength * 15)
To get an actual decimal value for sizes, change 15 to 15.0 (so that it's a float).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?)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...johnsojc wrote: I can't tell if this is all integer math...
Idle thought: I am assuming the codeis 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.Code: Select all
sizes = timeDelta / (dayLength * 15)
Code: Select all
sizes = timeDelta / (dayLength * 15.0) #Now it's floating-point math
Yeah, that's trivial. The problem is that we want the floor, so I don't think this is the issue (if there even is one).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