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

combining typed arrays with decimal fraction #1

Closed
wojdyr opened this issue Aug 9, 2017 · 3 comments
Closed

combining typed arrays with decimal fraction #1

wojdyr opened this issue Aug 9, 2017 · 3 comments

Comments

@wojdyr
Copy link

wojdyr commented Aug 9, 2017

What would you think about combining decimal fractions (tag 4) with typed arrays from this proposal?

In a similar way as a single number can be stored as a pair of exponent and mantissa:

5.6 -> {C4}(-1, 56)

an array of numbers could be expressed as, for example, a single exponent and an array of mantissas:

[1.2, 3.4, 5.6, 7.8, 9.0] -> {C4}(-1, [12, 34, 56, 78, 90])

Decimal fractions are not as popular as integers and floating point numbers, which makes it not as important, but I think it'd be a neat extension.

@cabo
Copy link
Collaborator

cabo commented Feb 27, 2019

It seems to be that this also could be applied to arrays that do not follow the typed array representation. I'm not sure we can retroactively change tag 4 to apply to arrays of integers as well, but we could define one or more scale tags for this purpose. For the typed array draft on which this is a comment, I don't see a need for change.

Apologies for having missed this issue for so long. Still interested?

@wojdyr
Copy link
Author

wojdyr commented Mar 7, 2019

What I had in mind was a compact representation of an array of numbers, like this:

20.885,20.892,20.046,20.03,18.641,20.285,20.344,20.327,21.358,19.115,19.06,17.979,17.112,15.77,15.219,16.305,16.327,15.361,17.616,18.735,19.899,18.708,17.472,21.352,22.45,21.117

but with several thousands of elements.
My thinking was that to make it most compact it could be stored in a typed array of 16-bit integers, with exponent -3 stored only once.
It would be even more effective if combined with delta encoding, which would need to be another tag and proposal.
But since I don't have any immediate use for it, perhaps it's best if I close this issue.

@wojdyr wojdyr closed this as completed Mar 7, 2019
@cabo
Copy link
Collaborator

cabo commented Mar 7, 2019

Hi Marcin,

this is indeed not an issue on the array-tags document, but I would like to keep the issue alive. I just don't have a document to attach it to...

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

2 participants