5

I found this accepted answer which, despite being accepted, is wrong. I won't trouble you with the boring JS part, but the ~~ operator acts like a truncate function, not a floor, which may lead to people reading the answer and misunderstanding what ~~ really does, possibly inducing bugs in their algorithms (for negative numbers).

There is a comment pointing out that mistake but is buried under a lot of other comments.

I have read another question in the meta SO (Answers which are wrong), but the answer is old, and the author seems inactive, and will likely not edit their answer.

Should I edit the answer with the correct behavior (since people rarely reads the comments), or leave it as is?

1
  • 4
    I wouldn't call that answer wrong. It just doesn't mention a restriction. I wouldn't edit it since there are already other answers that state the negative number problem.
    – BDL
    Commented Aug 27, 2019 at 10:05

1 Answer 1

2

In my opinion, the +280 comment can be converted to an edit with proper attribution. For example:-

As @RightSaidFriend says:

Worth noting that it differs from .floor() in that it actually just removes anything to the right of the decimal. This makes a difference when used against a negative number. Also, it will always return a number, and will never give you NaN. If it can't be converted to a number, you'll get 0.

The number of comments is ... a confusing experience, some or all of them can disappear. After your edit, you can flag a comment (or a comment chain via a custom flag) for removal.

1
  • 2
    I have done this many times in the past (almost always for comments by the answer author) -- edit a substantial or length comment response into the answer and then flag said comment (and any related ones) for deletion. Moderators thus far have tended to mark such flags as helpful.
    – TylerH
    Commented Aug 27, 2019 at 16:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .