Skip to content

Query: Translate Math.PI #25049

Closed as not planned
Closed as not planned

Description

@bricelam

Activity

  1. added
    good first issue
    on Jun 7, 2021
  2. added this to the Backlog milestone on Jun 8, 2021
  3. Marusyk commented on Jun 17, 2021

    @Marusyk
    Member

    I will try to prepare a PR for this

  4. removed this from the Backlog milestone on Jul 9, 2021
  5. added and removed
    good first issue
    on Jul 9, 2021
  6. smitpatel commented on Jul 9, 2021

    @smitpatel
    Contributor

    In the associated PR, we came to know that Math.PI is inlined as a constant value inside expression by C# compiler directly. This makes us never see Math.PI member expression in tree itself so this is not something we can interpret and translate. The constant value will always be sent to server as constant, as we receive it from C# compiler.

  7. bricelam commented on Jul 25, 2023

    @bricelam
    ContributorAuthor

    Crazy idea: Replace Expression.Constant(Math.PI) with Expression.MakeMemberAccess(null, typeof(Math).GetField("PI")) in the preprocessor. Obviously, this would catch any constant that happens to equal .NET's approximation of PI, but is that really an issue?

    If we do this, we should also do it for E and Tau.

  8. ajcvickers commented on Jul 27, 2023

    @ajcvickers
    Contributor

    Note from triage: funcletization complicates this, and there seems to be very little value. Closing.

  9. roji commented on Jul 27, 2023

    @roji
    Member

    Technically the complication is even before ParameterExtractingEV (funcletization) - as above since Math.PI is a constant, the incoming expression tree doesn't even contain it, only the inlined constant value. So I think there's really nothing we can do here, even in theory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions