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

Implement global math functions #43

Closed
sjbarag opened this issue Apr 24, 2018 · 2 comments
Closed

Implement global math functions #43

sjbarag opened this issue Apr 24, 2018 · 2 comments
Labels
enhancement Any addition to this project's existing capabilities good first issue A great place for newcomers to jump in! Usually doesn't involve a deep understanding of the project help wanted Any issue that's easily completed by someone without commit access stdlib Affects the standard library included with this BrightScript implementation

Comments

@sjbarag
Copy link
Owner

sjbarag commented Apr 24, 2018

The BrightScript language supports 17 global math functions:

  • Abs(x as Float) as Float
  • Atn(x as Float) as Float
  • Cdbl(x as Integer) as Float
  • Cint(x as Float) as Integer
  • Cos(x as Float) as Float
  • Csng(x as Integer) as Float
  • Exp(x as Float) as Float
  • Fix(x as Float) as Integer
  • Int(x as Float) as Integer
  • Log(x as Float) as Float
  • Rnd(range as Integer) as Integer
  • Rnd(0) as Float
  • Sgn(x as Float) as Integer
  • Sgn(x as Integer) as Integer
  • Sin(x as Float) as Float
  • Sqr(x as Float) as Float
  • Tan(x as Float) as Float

We should get those implemented! Luckily they seem to all be wrappers around JavaScript's Math native functions, so these should be relatively easy to implement as native functions. Also luckily: they all operate on either Float or Int32, so we shouldn't have to worry about dealing with 64-bit integer math!

@sjbarag sjbarag added help wanted Any issue that's easily completed by someone without commit access good first issue A great place for newcomers to jump in! Usually doesn't involve a deep understanding of the project stdlib Affects the standard library included with this BrightScript implementation labels Apr 24, 2018
@sjbarag
Copy link
Owner Author

sjbarag commented Apr 24, 2018

I've marked this as "Good first issue" because we have a pretty good pattern around global functions now. Also note that -- because this is a first issue -- a first-time contributor doesn't have to implement all of these at once. That's a pretty big undertaking. We can always split this into multiple issues to handle families of math functions (e.g. "all the trigonometry functions", etc.)

@sjbarag sjbarag added the enhancement Any addition to this project's existing capabilities label Apr 24, 2018
@sjbarag sjbarag added this to the Global math fu milestone Apr 24, 2018
@sjbarag
Copy link
Owner Author

sjbarag commented Apr 24, 2018

Closing in favor of https://github.com/sjbarag/brs/milestone/3 now that I've split this out

@sjbarag sjbarag closed this as completed Apr 24, 2018
@sjbarag sjbarag removed this from the Global math functions milestone May 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Any addition to this project's existing capabilities good first issue A great place for newcomers to jump in! Usually doesn't involve a deep understanding of the project help wanted Any issue that's easily completed by someone without commit access stdlib Affects the standard library included with this BrightScript implementation
Projects
None yet
Development

No branches or pull requests

1 participant