Closed cdeil closed 6 years ago
This module uses many bit-wise operations. Bit-wise operations in JS deal with only 32bit integers. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators
So this module deals with only numbers less than 32bit integers.
@michitaro - Then do you understand why the functions work for norder
up to 16?
With 32 bit (or 31 bit for unsigned) I would have expected only order up to 13 or 14 to work properly:
>>> import healpy as hp
>>> hp.nside2npix(hp.order2nside(16)) / (2 ** 32)
12.0
>>> hp.nside2npix(hp.order2nside(15)) / (2 ** 32)
3.0
>>> hp.nside2npix(hp.order2nside(14)) / (2 ** 32)
0.75
>>> hp.nside2npix(hp.order2nside(14)) / (2 ** 31)
1.5
>>> hp.nside2npix(hp.order2nside(13)) / (2 ** 31)
0.375
I may misunderstand you question, but...
The real limit is on ipix not on nside. The limit comes from these 2 functions. https://github.com/michitaro/healpix/blob/6d512edef4803d88a1a6794309730342c1e7c9cc/src/index.ts#L503 https://github.com/michitaro/healpix/blob/6d512edef4803d88a1a6794309730342c1e7c9cc/src/index.ts#L524
While calculating ipix with norder >= 16 hit these limits, alculating nside with norder doesn't hit the limit.
So if higher norder
support is not easily added, could you please document the limit in the README (after #9)?
I'm new to TS / JS and number crunching there, so I don't know, but this might be relevant? https://github.com/Microsoft/TypeScript/issues/15096 https://github.com/Microsoft/TypeScript/wiki/Roadmap#30-july-2018
So if higher norder support is not easily added, could you please document the limit in the README (after #9)?
Support for higher norder
is not easy. I'll document the limitation.
I'm new to TS / JS and number crunching there, so I don't know, but this might be relevant?
Yes.
After most browsers support Bigint, we can use Bigint for higher norder
.
I'll document the limitation.
I see https://github.com/michitaro/healpix#limitations
@michitaro - Thank you!
@michitaro - What is the maximum supported
norder
?I see 16 here: https://github.com/michitaro/healpix/blob/90c15ade239c525c0966e34f5022bb792ea45a47/spec/generate-testcase.py#L39
Why is that?
Naively I would think that orders up to 24 can be supported, given that JS has numbers that can represent int up to 53 bit:
I think healpy supports up to order 29, because they have 64 bit integers available.
CC @tboch