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

Add Num.infinityF32 and F64, Num.nanF32 and F64 #6709

Open
1 of 3 tasks
rtfeldman opened this issue May 2, 2024 · 0 comments
Open
1 of 3 tasks

Add Num.infinityF32 and F64, Num.nanF32 and F64 #6709

rtfeldman opened this issue May 2, 2024 · 0 comments
Labels
good first issue Good for newcomers

Comments

@rtfeldman
Copy link
Sponsor Contributor

rtfeldman commented May 2, 2024

Currently there's no way to directly ask for infinity, -infinity, or NaN. There should be:

  • Floating point special values #6711 Add builtins for Num.infinityF32 : F32, Num.infinityF64 : F64, Num.nanF32 : F32, and Num.nanF64 : F64 - at first, they can just be equal to expressions which evaluate to those (e.g. infinityF32 = 1 / 0, nanF64 = 0 / 0).
  • Make a separate issue to replace the = 1 / 0 implementations with compiler-generated numbers, since that will result in better runtime perf in dev builds.
  • Change the repl so that for infinity, we print out Num.infinityF32 or Num.infinityF64 instead of and -∞ today (use infinityF64 if the number's type is Frac *), and do the same for nan. For negative infinity, print out -Num.infinityF32 or -Num.infinityF64. Relevant code is here; some tests will also need to be updated.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant