Skip to content

Commit

Permalink
[type casting & coercion] add note about bitshift and large integers. f…
Browse files Browse the repository at this point in the history
…ixes #109
  • Loading branch information
hshoff committed Nov 14, 2013
1 parent fa32d9a commit 8bab767
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -956,6 +956,7 @@
```
- If for whatever reason you are doing something wild and `parseInt` is your bottleneck and need to use Bitshift for [performance reasons](http://jsperf.com/coercion-vs-casting/3), leave a comment explaining why and what you're doing.
- **Note** Be careful when using bitshift operations. Numbers are represented as [64-bit values](http://es5.github.io/#x4.3.19), but Bitshift operations always return a 32-bit integer [source](http://es5.github.io/#x11.7). Bitshift can lead to unexpected behavior for integer values larger than 32 bits. [Discussion](https://github.com/airbnb/javascript/issues/109)

```javascript
// good
Expand Down

0 comments on commit 8bab767

Please sign in to comment.