What is the most efficient way to continually add two numbers together?
For instance, I have something like the following:
totalFloat = totalFloat + someFloatVar
There's gotta be a more efficient way, right? These numbers are continually added up until the user decides to stop the task. Also, someFloatVar
is different each time around.
I know that I could do totalFloat += someFloatVar
, but I was under the impression that it was the same thing efficiency wise. What I'm looking for is something that will not decrease the overall speed and performance of the application.
If not, is this the best way to add two numbers (that can be potentially quite large?)
In this context, I'm continually updating a mileage. Therefore this could be 5.678 meters or 895.67 meters, or larger.