ViktorQvarfordt / Sublime-WolframLanguage

Sublime Text 3 support for the Wolfram Language, the language used in Mathematica.
MIT License
31 stars 10 forks source link

Some issues about numerical constants #23

Open shigma opened 5 years ago

shigma commented 5 years ago

built_in_numeric_constants defines some numerical constants for wolfram language, but here are some minor issues:

  1. Infinity and Indeterminate seems numerical constants to me, for they have mathematical meaning and we can just do any mathematical operations on them.
  2. MachinePrecision seems a little bit strange compared with other constants. It may be just have a numerical value. If accepted, should some other built-in symbols with numerical values (including but not limited to numbers defined here) be accepted too?
batracos commented 5 years ago
  1. All the symbols now in built_in_numeric_constants are NumericQ. Neither Infinity nor Indeterminate satisfy that. I see your point though. What do the other people think?
  2. MachinePrecision is a numerical constant, $MachinePrecision and other symbols is that page are numbers.
    
    In[21]:= Through[{NumberQ, NumericQ}[$MachinePrecision]]
    Out[21]= {True, True}

In[22]:= Through[{NumberQ, NumericQ}[MachinePrecision]] Out[22]= {False, True}

shigma commented 5 years ago

You've got a point here.

@chere005 @ViktorQvarfordt any ideas?

chere005 commented 5 years ago

I think Infinity and Indeterminate make sense in the same way as MachinePrecision. Perhaps calling these built_in_numeric_constants is the issue, and they should just be called built_in_math_constants or built_in_constants. I approach this more from the angle how do I want my code to look and I would like some visual identifier for these in the same way I would want an identifier for Pi

shigma commented 5 years ago
  1. All the symbols now in built_in_numeric_constants are NumericQ. Neither Infinity nor Indeterminate satisfy that. I see your point though. What do the other people think?
  2. MachinePrecision is a numerical constant, $MachinePrecision and other symbols is that page are numbers.
In[21]:= Through[{NumberQ, NumericQ}[$MachinePrecision]]
Out[21]= {True, True}

In[22]:= Through[{NumberQ, NumericQ}[MachinePrecision]]
Out[22]= {False, True}

If this is your definition for numeric constants, I should be removed from the list because NumberQ[I] returns True. Generally, I approve the idea that a rule should be set so that we can easily keep pace with every version of Mathematica, however !NumberQ[#] && NumericQ[#]& may be not qualified enough.

@chere005 any ideas?


(Sorry, there's some problem with my browser ...)

chere005 commented 5 years ago
  1. All the symbols now in built_in_numeric_constants are NumericQ. Neither Infinity nor Indeterminate satisfy that. I see your point though. What do the other people think?
  2. MachinePrecision is a numerical constant, $MachinePrecision and other symbols is that page are numbers.
In[21]:= Through[{NumberQ, NumericQ}[$MachinePrecision]]
Out[21]= {True, True}

In[22]:= Through[{NumberQ, NumericQ}[MachinePrecision]]
Out[22]= {False, True}

If this is your definition for numeric constants, I should be removed from the list because NumberQ[I] returns True. Generally, I approve the idea that a rule should be set so that we can easily keep pace with every version of Mathematica, however !NumberQ[#] && NumericQ[#]& may be not qualified enough.

@chere005 any ideas?

(Sorry, there's some problem with my browser ...)

I think my comment from 2 days ago covers this. I don't think we need to decide based on NumberQ or NumericQ but rather which symbols we want highlighted similarly because its convenient and helps understand the code

batracos commented 5 years ago

Let's move Infinity and Indeterminate then.