You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
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.
Activity
Marusyk commentedon Jun 17, 2021
I will try to prepare a PR for this
smitpatel commentedon Jul 9, 2021
In the associated PR, we came to know that
Math.PIis inlined as a constant value inside expression by C# compiler directly. This makes us never seeMath.PImember 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.bricelam commentedon Jul 25, 2023
Crazy idea: Replace
Expression.Constant(Math.PI)withExpression.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
EandTau.ajcvickers commentedon Jul 27, 2023
Note from triage: funcletization complicates this, and there seems to be very little value. Closing.
roji commentedon Jul 27, 2023
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.