dingo
11-02-2010 11:30:00
I've found the following strange problem in python-ogre 1.6.4:
I'have created an application which is based on sf_OIS.py (like most samples in the demo folder). After the line self.renderWindow = self.root.initialise(True,windowTitle)
in _configure the python changes the way it does floating point calculations. It looks as if the precision is reduced if properties are involved. The behaviour can be reproduced as follows:
Changes to sf_OIS.py:
Add test class:
Changes to _configure:
When I now run a demo (e.g. Demo_SkyBoy.py) I find the following lines in the console output:
Test: 1000.00001 1000.9
...
Test: 1000.0 1000.9000244140625
The second calculation after intitialise() is clearly wrong.
I'have created an application which is based on sf_OIS.py (like most samples in the demo folder). After the line self.renderWindow = self.root.initialise(True,windowTitle)
in _configure the python changes the way it does floating point calculations. It looks as if the precision is reduced if properties are involved. The behaviour can be reproduced as follows:
Changes to sf_OIS.py:
Add test class:
class Tester:
def __init__(self):
self.test=1000
def show(self):
print "\nTest: ",repr(self.test*1.00000001),repr(self.test+0.9),"\n"
Changes to _configure:
Tester().show()
self.renderWindow = self.root.initialise(True,windowTitle)
Tester().show()
When I now run a demo (e.g. Demo_SkyBoy.py) I find the following lines in the console output:
Test: 1000.00001 1000.9
...
Test: 1000.0 1000.9000244140625
The second calculation after intitialise() is clearly wrong.