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

Better way to handle precision + switch to km at 1000m #167

Merged
merged 1 commit into from
Feb 24, 2015

Conversation

pgiraud
Copy link
Contributor

@pgiraud pgiraud commented Feb 19, 2015

No description provided.

@pgiraud
Copy link
Contributor Author

pgiraud commented Feb 19, 2015

Please review.

if (length > 100) {
output = (Math.round(length / 1000 * 100) / 100) +
if (length > 1000) {
output = parseFloat((length / 1000).toPrecision(3)) +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is parseFloat necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In order not to get exponential notations.
(ie. 1e6)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understood. Please merge.

pgiraud pushed a commit that referenced this pull request Feb 24, 2015
Better way to handle precision + switch to km at 1000m
@pgiraud pgiraud merged commit b2be51e into camptocamp:master Feb 24, 2015
@pgiraud pgiraud deleted the measure_precision branch February 24, 2015 08:42
@sbrunner sbrunner added this to the Older milestone Aug 23, 2019
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

Successfully merging this pull request may close these issues.

None yet

3 participants