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

Real number representation #1171

Open
dhess opened this issue Nov 8, 2023 · 0 comments
Open

Real number representation #1171

dhess opened this issue Nov 8, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@dhess
Copy link
Member

dhess commented Nov 8, 2023

Up until recently, we'd been thinking that, due to the vagaries of implementing real numbers on computers (e.g., float and double), we would avoid the problem by simply not having a primitive for them in Primer. But more recently, we've decided that we'd like to get to some kind of animation system sooner than later, so realistically, we'll need a primitive real number representation(s), after all.

Options would include:

  1. Just wrap double and be done with it.
  2. Some kind of symbolic computer algebra system (e.g., treat irrationals like 𝛑 symbolically)
  3. Something like Haskell's rounded

2 would be the ideal, but is completely unrealistic. 3 looks like a good middle ground, but our type system can't currently represent type-level numbers, so this would be a fairly large project.

Probably we'll just do 1 for now, and skirt around issues such as rounding, precision, etc. (Most students, and even most professional programmers, are probably never introduced to these issues, anyway.) However, it might be nice to support 3 in the longer term: not only would it be a more honest treatment of real number representations on computers, it would also be a powerful demonstration of how expressive types are helpful to solve tricky representational problems.

@dhess dhess added the enhancement New feature or request label Nov 8, 2023
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

No branches or pull requests

1 participant