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

✨ Proposal for Comprehensive Mathematical Module in Amber #451

Open
4 of 15 tasks
Ph0enixKM opened this issue Jun 13, 2024 · 3 comments
Open
4 of 15 tasks

✨ Proposal for Comprehensive Mathematical Module in Amber #451

Ph0enixKM opened this issue Jun 13, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@Ph0enixKM
Copy link
Member

Ph0enixKM commented Jun 13, 2024

We could start with a mininal version of such library and then we could extend it with other functions. Some of the most important ones could be the following:

Rounding

  • ceil(x: Num): Num - rounds up to the nearest integer
  • floor(x: Num): Num - rounds down to the nearest
  • round(x: Num): Num - rounds to the nearest integer

Absolute and sign

  • abs(x: Num): Num - absolute value
  • sign(x: Num): Num - sign function, returns -1, 0, or 1 depending on the sign of x

Min / Max

  • min(a: Num, b: Num): Num
  • max(a: Num, b: Num): Num

Optional: Power, root, exponential, logarithms and trigonometric

These can be easily evaluated using bc with flag -l

  • pow(base: Num, exponent: Num): Num - power function
  • sqrt(x: Num): Num - square root
  • exp(x: Num): Num - exponential function
  • log(x: Num): Num - natural logarithm
  • log10(x: Num): Num - base-10 logarithm
  • sin(x: Num): Num - sine
  • cos(x: Num): Num - cosine
  • tan(x: Num): Num - tangent
@Ph0enixKM Ph0enixKM linked a pull request Jun 13, 2024 that will close this issue
@Ph0enixKM Ph0enixKM added the enhancement New feature or request label Jun 13, 2024
@Ph0enixKM Ph0enixKM changed the title Proposal for Comprehensive Mathematical Module in Amber ✨ Proposal for Comprehensive Mathematical Module in Amber Jun 16, 2024
@FedericoCeratto
Copy link
Member

(perhaps exp, log, sin/cos, tan are not necessary)

@Ph0enixKM
Copy link
Member Author

You're right @FedericoCeratto. That's not the most important thing right now

@Mte90 Mte90 transferred this issue from amber-lang/amber Sep 3, 2024
@Ph0enixKM Ph0enixKM transferred this issue from another repository Sep 3, 2024
@Mte90
Copy link
Member

Mte90 commented Sep 12, 2024

As today we have some of them, it is enough?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants