Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add helper methods NaN/Infinity for Complex type #27363

Closed
kant2002 opened this issue Sep 11, 2018 · 3 comments
Closed

Add helper methods NaN/Infinity for Complex type #27363

kant2002 opened this issue Sep 11, 2018 · 3 comments
Labels
api-approved API was approved in API review, it can be implemented area-System.Numerics
Milestone

Comments

@kant2002
Copy link
Contributor

Overview

When working with Complex numbers there now helper methods for dealing with NaN and Infinity values. For example with double it is possible check is value is NaN or Infinity

API

This is an example of how the API could look like.

public class Complex
{
    public static bool IsFinite(Complex value);
    public static bool IsNaN(Complex value);
    public static bool IsInfinity(Complex value);

    public static Complex  NaN { get; }
    public static Complex  Inifinity { get; }
}

/cc: @tannergooding

@tannergooding
Copy link
Member

What is the proposed value for Infinity and NaN?

@kant2002
Copy link
Contributor Author

I'm almost sure that only one sane way to return NaN is to return (NaN, NaN). For Infinity is more likely personal opinion. I think that current implementation of Complex really model just single Infinity which happens to be represented in different ways. so I propose (+Inf, +Inf)

@tannergooding
Copy link
Member

Resolved in dotnet/corefx#33184

@msftgits msftgits transferred this issue from dotnet/corefx Jan 31, 2020
@msftgits msftgits added this to the 3.0 milestone Jan 31, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api-approved API was approved in API review, it can be implemented area-System.Numerics
Projects
None yet
Development

No branches or pull requests

3 participants