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

[Discussion] Should Data values be stored to their precision? #53

Open
jimmykane opened this issue Mar 10, 2020 · 2 comments
Open

[Discussion] Should Data values be stored to their precision? #53

jimmykane opened this issue Mar 10, 2020 · 2 comments
Assignees
Labels
help wanted Extra attention is needed

Comments

@jimmykane
Copy link
Collaborator

jimmykane commented Mar 10, 2020

Due to several calculations eg adding up distance the result can have many decimal places

eg

1.2348292993

During the Strava compliance tests eg strava reports distance with 1 decimal

1.2

  • Should this rounding be applied on the consumer (App using this lib)?
  • Should this rounding be defined at least in this library eg getValue(precise)?
  • Should it all fall to the side of the consumer (App using this lib)
@jimmykane jimmykane added the help wanted Extra attention is needed label Mar 10, 2020
@jimmykane jimmykane changed the title Should Data values be stored to their precision? [Discussion] Should Data values be stored to their precision? Mar 10, 2020
@guy-keller
Copy link

As a user of the lib.
I would prefer to receive the full value (no rounding).
So that I can round the results on my end.

However, it would be nice to have a helper function that would allow me to specify the precision.
PS: great project, thanks for making it public, and publishing to npmjs cheers!

@jimmykane
Copy link
Collaborator Author

@guikeller Agreed. I ll look into this. Currently you can:

distance = new DataDistance(1.222222222)
distance.getValue() // Gives back the full precision
distance.getDisplayValue() // Gives back a predifined precision 

One could for now at least do something like distance.getValue().toFixed(2) for example

(The above applies to all data)

I ll take a look how this can become more robust

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants