Skip to content

Rounding-Error: Use proper banker's rounding #153

Open
@orgua

Description

@orgua

Isn't that comparison (first line) wrong considering the following comment?

    if ((!(remainder < 0.5) || (remainder > 0.5)) && (number_.integral & 1)) {
      // exactly 0.5 and ODD, then round up
      // 1.5 -> 2, but 2.5 -> 2
      ++number_.integral;
    }

Link

I think it should be

    if (!((remainder < 0.5) || (remainder > 0.5)) && (number_.integral & 1)) {

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingresolved-on-developA changeset fixing this issue has been commiutted to the development branch

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions