[Commits] [wesnoth/wesnoth] 520e61: Clarify by-hand rounded %0.1f formatting

GitHub noreply at github.com
Tue Oct 31 19:39:31 UTC 2017


  Branch: refs/heads/master
  Home:   https://github.com/wesnoth/wesnoth
  Commit: 520e617d8aeea17521332f635d399df15c319845
      https://github.com/wesnoth/wesnoth/commit/520e617d8aeea17521332f635d399df15c319845
  Author: Gregory A Lundberg <gregory_lundberg at gmx.com>
  Date:   2017-10-31 (Tue, 31 Oct 2017)

  Changed paths:
    M src/gui/dialogs/statistics_dialog.cpp

  Log Message:
  -----------
  Clarify by-hand rounded %0.1f formatting

Coverity is rightly pointing out that it is not clear that `double` math is wanted, where the conversion from `long long` to `double` should occur, and where integer remainders are discarded.

Most compilers will get it right, but humans may find it confusing or unexpected.

* Did some algebra to reduce half-bit errors.

* Added a cast to make the conversion explicit.

* Aligned turn expected damage with running expected damage so both are the same representation.

Closes CID 1380164





More information about the Commits mailing list