ios - Add together two UIAccelerationValue's? -


i not sure if stupid question or not please bear me here. anyway have 2 uiaccelerationvalue's. when individually nslog results values respectively:

1. value: -0.016186  2. value2: -0.033460 

however when add or subtract 2 uiaccelerationvalue's together, values this:

value: -571.142049 value: -1085.174017 value: -2061.834754 value: -3917.490156 value: -7443.235420 value: -14142.151420 

as can see values keep increasing exponentially.

anyway, how can add or subtract 2 uiaccelerationvalues without results getting now?

i think storing result of addition/subtraction , adding/subtracting on , on again, hence increased, large values

uiaccelerationvalue double (see uiaccelerometer.h):

typedef double uiaccelerationvalue; 

with following example expected output:

uiaccelerationvalue xone = -0.016186; uiaccelerationvalue xtwo = -0.033460;  nslog(@"%f", xone + xtwo); // prints out -0.049646 nslog(@"%f", xone - xtwo); // prints out 0.017274 

Comments