Skip to content

Conversation

@udohjeremiah
Copy link
Contributor

@udohjeremiah udohjeremiah commented Sep 24, 2022

The << operator says this and its clearly understandable:

help?> <<

  <<(x, n)

  Left bit shift operator, x << n. For n >= 0, the result is x shifted left
  by n bits, filling with 0s. This is equivalent to x * 2^n. For n < 0,
  this is equivalent to x >> -n.

But then the >> and >>> operator both use the word where n >= 0, even after stating For n >= 0 in the beginning:

help?> >>

  >>(x, n)

  Right bit shift operator, x >> n. For n >= 0, the result is x shifted
  right by n bits, where n >= 0, filling with 0s if x >= 0, 1s if x < 0,
  preserving the sign of x. This is equivalent to fld(x, 2^n). For n < 0,
  this is equivalent to x << -n.

help?> >>>

  >>>(x, n)

  Unsigned right bit shift operator, x >>> n. For n >= 0, the result is x
  shifted right by n bits, where n >= 0, filling with 0s. For n < 0, this
  is equivalent to x << -n.

The << does not have this where n >= 0 confusion, so I don't know why it's coming into >> and >>> even after stating For n >= 0 in the beginning of the statement.

The For n >= 0 already states what's happening, so the where n >= 0 complicates things, and gets one confused, which I think was a typo error.

@udohjeremiah udohjeremiah added the docs This change adds or pertains to documentation label Sep 24, 2022
@LilithHafner
Copy link
Member

Agreed. This is a clear case of redundancy.

@LilithHafner LilithHafner changed the title typo error on >>, >>> operator Remove redundancy in docstrings for >> and >>> Oct 2, 2022
@LilithHafner LilithHafner merged commit 80df2c2 into JuliaLang:master Oct 2, 2022
@udohjeremiah udohjeremiah deleted the patch-24 branch October 2, 2022 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs This change adds or pertains to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants