Consistency

Code style consistency:
* do not use a mix of prefix and postfix operators: use prefix whenever possible.
* use double instead of float everywhere. rationale:
 - speed of double and float is about the same (not on the hot path anyway)
 - double makes code prettier (no need to write 1.0f, just 1.0)
 - only practical advantage of float is to use less memory, but since we never store large arrays of double, we don't care.