Skip to content

Improve double/float comparisons #25

@ElemarJR

Description

@ElemarJR

This generates a Warning diagnostic:

void Foo(double a, double b)
{
    if (a == b) {...} 

If we are able to make a code fix that will exhibit a snippet like behavior, where the user has to fill the value they want for the ellipsis, then we will also do a code fix, otherwise it will be only a diagnostic.
If it is possible to build the code fix this way, it should look like this:

void Foo(double a, double b)
{
    const float ELLIPSIS = MYELLIPSIS;
    if (Math.Abs(a-b) < ELLIPSIS) {...} 

Where the value MYELLIPSIS is highlighted for the user to fill in his value later.
The diagnostic id is: CC0036

@fholiveira will work on it.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions