ios - Not enough precision for points in CGPoint type -


i'm developing map-based game using cocos2d v3.

i have map size of 2^19 points. on map have object should move on time in short distance. 60-70 points.

    cgpoint offset = [_trajectorypath offsetfornextposition];      cgfloat x = self.position.x + offset.x;     cgfloat y = self.position.y + offset.y;      self.position = cgpointmake(x, y); 

at such map size map position can {300000, 40000} points. when try add small step, lets {0.002f, 0.004f}, animate object position end still same {300000, 40000} points...

i understand happens because of precision of float. values normalised map size, between 0 , 1.0, don't work either.

is possible somehow increase precision of float type on ios? or may cam give hint possible workaround problem?

thanks.

mightee.cactus, remember had similar issue while adding small numbers large ones float in c.

the solution follows: changed types double preserve accuracy; in case can make arithmetic operations doubles , translate them cgfloat before use in cgpointmake.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -