mapbox / mapbox/mapbox-gl-js

Map#setBearing handles some floats and integers incorrectly

Open
#7,735 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

api :memo: needs discussion :speech_balloon:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

**mapbox-gl-js version**: 0.52.0

**browser**: Chrome 71.0.3578.98 (Official Build) (64-bit)

### Steps to Trigger Behavior

1. Make sure the map's bearing is set to an integer value
2. Set the bearing to a small float value
3. Read the bearing ‒ it's not the right value

### Link to Demonstration

https://jsbin.com/harefagilu/edit?html,console

### Expected Behavior

Bearing should equal `0.1`.

### Actual Behavior

Bearing equals `0.10000000000002274`.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the Map#setBearing implementation and reproduce the behavior using the linked JSBin demonstration in Chrome. Verify the bearing transition from an integer to 0.1 and confirm that the reported value equals 0.1 when the issue is resolved.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.