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

Fixed point #1

Open
4 of 11 tasks
kiedtl opened this issue Feb 14, 2024 · 2 comments
Open
4 of 11 tasks

Fixed point #1

kiedtl opened this issue Feb 14, 2024 · 2 comments
Labels
lang-new New language feature proposal stdlib

Comments

@kiedtl
Copy link
Owner

kiedtl commented Feb 14, 2024

In-progress on the fixpt branch.

TODO:

  • Basic addition/subtraction
  • Multiplication, division
  • Printing
  • Better division routine that uses multi-word division rather than multiplying by the reciprocal
  • CORDIC sin/cos
  • Wrapper for CORDIC sin/cos that has a larger domain
  • Natural log
  • Exponentiation
  • Powers
  • Ceil, floor, round
  • Lexer/parser support for fixed point literals(?)
@kiedtl kiedtl added lang-new New language feature proposal stdlib labels Feb 14, 2024
@kiedtl
Copy link
Owner Author

kiedtl commented Feb 14, 2024

Unsure if fixed point literals baked into the compiler are a good idea. If there's a way for modules to "claim" a literal suffix, with custom parsing code, that would be nice. Would probably be too complicated to implement however.

As for the syntax, if it is added: 3.14fs or 3.14xs? F for fixed point, x for... fixed point. (Reserving f for a future half-float type.) S for short, of course.

@kiedtl kiedtl changed the title [stdlib] Fixed point Fixed point Feb 14, 2024
@kiedtl
Copy link
Owner Author

kiedtl commented Sep 9, 2024

https://git.phial.org/d6/nxu/src/branch/main/fix16.tal

Will probably drop this feature after doing a comparison. Need to first work on the assembler/TAL imports first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lang-new New language feature proposal stdlib
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

1 participant