Skip to content

Some codes failed -Werror=float-equal compiler flag, please fix it. #741

@jymchng

Description

@jymchng

Example error message.

/root/c_projects/c_template_two/build/coverage/_deps/unity-src/src/unity.c: In function ‘UnityPrintFloat’:
/root/c_projects/c_template_two/build/coverage/_deps/unity-src/src/unity.c:355:16: error: comparing floating-point with ‘==’ or ‘!=’ is unsafe [-Werror=float-equal]
  355 |     if (number == 0.0f)
      |                ^~
/root/c_projects/c_template_two/build/coverage/_deps/unity-src/src/unity.c:422:52: error: comparing floating-point with ‘==’ or ‘!=’ is unsafe [-Werror=float-equal]
  422 |         if ((n & 1) && (((UNITY_DOUBLE)n - number) == 0.5f))
      |                                                    ^~

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions