@turf/lineSlice expected precision
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 10.5k
- Forks
- 1k
- Avg merge
- 1h 11m
- Merged PRs (30d)
- 4
Description
What is the expected precision of utilities like @turf/lineSlice. I certainly expect some floating point issues, but I noticed one relatively glaring
{
"startPt": {
"type": "Point",
"coordinates": [
1,
2
]
},
"endPt": {
"type": "Point",
"coordinates": [
4,
2
]
},
"line": {
"type": "LineString",
"coordinates": [
[
-1,
2
],
[
5,
2
]
]
},
"result": {
"type": "Feature",
"properties": {},
"geometry": {
"type": "LineString",
"coordinates": [
[
0.9999985123144755,
2.0024376784603275
],
[
4.000001859181029,
2.0015234321498467
]
]
}
}
}
The distance between [1,2] and [0.9999985123144755, 2.0024376784603275] is 0.17 miles, which is significant and much larger than I would have expected for a floating point precision drift in a single calculation.
This may be expected behavior, but if it is, I'd request that the library includes some documentation of the expected tolerances.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the @turf/lineSlice utility and reproduce the supplied start point, end point, and line coordinates. Investigate whether the 0.17-mile discrepancy is expected algorithmic behavior or an error; done means the behavior is corrected or its expected precision and tolerances are documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- data
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100