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 more number types #192

Open
4 tasks
oxinabox opened this issue Aug 10, 2020 · 2 comments
Open
4 tasks

Add more number types #192

oxinabox opened this issue Aug 10, 2020 · 2 comments

Comments

@oxinabox
Copy link
Contributor

Following up on #191
It would be useful to have a few more number types.
In particular it would be useful to have Rational numbers and 128 bit integers.
Calculating grid-coefficients for higher-order finite differencingusing Rational{Int128} for intermidiate values before converting to Float64 at the end gained me several orders of magnitude in accuracy;
and presumably has other applications.

And I know people working in astronomy like there rediculously high precision floats because of working at different scales.

I suggest:

  • Rational numbers
  • Int128
  • BigInt (GMP equiv)
  • BigFloat (MPFR equiv)
@dougalm
Copy link
Collaborator

dougalm commented Aug 10, 2020

Good idea. There's a question of whether to do these in the compiler or at the library level. Where there's no special hardware support I tend to lean towards doing things at the library level. What does Julia do?

@oxinabox
Copy link
Contributor Author

oxinabox commented Aug 10, 2020

All* types in Julia are at the library level.
Including Float64 etc..
Julia provides the primative keyword to create words-of-bits,
which one then might use llvmcall (or ccall) to define the fundermental operations (that will in many cases have hardware support).
Some exceptions like Int64 are not literally defined at the library level because of bootstrapping reasons.

The types I mentioned above all in the julia standard library.
In packages there are a bunch more like ArbNumerics.jl and BitIntegers.jl and BFloat16.jl

*not technically true but close enough. One can get into semantic arguments easily enough.

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

No branches or pull requests

3 participants