Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upabs_sub is strangely named #30315
Comments
huonw
added
the
T-libs
label
Dec 11, 2015
This comment has been minimized.
This comment has been minimized.
|
I disagree |
This comment has been minimized.
This comment has been minimized.
|
Note that |
This comment has been minimized.
This comment has been minimized.
|
@ranma42 EDIT: This comment is stupid and wrong and horribly embarrassing |
This comment has been minimized.
This comment has been minimized.
|
@jFransham abs(-1) is 1, but max(-1, 0) is 0. Did you mean abs(x) = max(x, -x)? In any case, this playground demonstrates what @ranma42 stated. |
This comment has been minimized.
This comment has been minimized.
|
Good point, I guess |
This comment has been minimized.
This comment has been minimized.
|
I think one of the following names would fit better:
|
This comment has been minimized.
This comment has been minimized.
|
Monus as pointed out by sp3d on IRC. The page also mentions these names the operation is referred to:
|
This comment has been minimized.
This comment has been minimized.
|
Most of the methods name the result (e.g. |
huonw
added
the
I-nominated
label
May 9, 2016
This comment has been minimized.
This comment has been minimized.
|
The libs team discussed this issue during triage the other day and the conclusion was that this is so confusingly named and sparingly used that we should probably just document it. The deprecation message can indicate:
|
alexcrichton
removed
the
I-nominated
label
May 11, 2016
This comment has been minimized.
This comment has been minimized.
After the meetings, I realised this isn't quite true: |
This comment has been minimized.
This comment has been minimized.
|
I just wasted somewhere between 3-4 hours over the last day debugging my game, thinking that this was equivalent to I'm definitely in support of deprecation and renaming. |
huonw commentedDec 11, 2015
The C name is
fdim, and the operation is described as "positive difference" by e.g. the C function's man page, which isn't really suggested by "abs_sub" at all.