What is the best way to call the smallest value (absolute value, |x|) of x if all x are negative?

If we call it minimum, then it could be meaning the biggest absolute value...


I am looking for a suitable name for my variable in the code I am writing.

  • Usually there is precedence in the operators so MIN(ABS(X)) would give you the generalised solution for the smallest absolute value (largest negative X, smallest positive X). ABS(MAX(X)) would be the case for only negative numbers. – Peter Mar 14 '16 at 15:52
  • 1
    @Peter isn't he only asking for terminology ? – MAKZ Mar 14 '16 at 17:07
  • If you're speaking about values of |x|, then it's fine to say the minimum value of |x|. If you're speaking about values of x, you should use magnitude as in apsillers' answer. – Era Mar 14 '16 at 18:01
  • Sorry for not being clearer... I am looking for a suitable name for the variable that I want to create. – Boon Mar 21 '16 at 9:40
  • From Python Documentation: min_mag(x, y): Compares the values numerically with their sign ignored. -- By the way, I don't think a variable name in your code is really on-topic. – Damkerng T. Mar 21 '16 at 11:51

In a formal mathematics setting, you would say you want the number with the smallest magnitude. For real numbers, magnitude is the number's distance from zero on the number line. You could also say you want the number with the smallest absolute value, but that's slightly longer to say.

Other notes:

  • Using "minimum" is incorrect, since for real numbers, "minimum" means "leftmost on the number line" -- so, in your case, the negative number with the largest magnitude is the minimum.

  • Using "smallest" for negative numbers causes ambiguity about whether you mean "smallest magnitude" or "lowest value" (i.e., leftmost on the number line).

| improve this answer | |
  • If we're being pedantic, shouldn't that be "lowest magnitude" and not "smallest magnitude?" – Mahmoud Al-Qudsi Mar 14 '16 at 23:23
  • @MahmoudAl-Qudsi You're probably right, since magnitude appears to be a value's position in an ordering. (I haven't done much advanced math recently.) I'll double-check tomorrow and edit accordingly. – apsillers Mar 15 '16 at 2:50
  • please don't let that detract from your excellent answer, though :) +1 – Mahmoud Al-Qudsi Mar 15 '16 at 4:59

I'd call it the closest value to zero. Its meaning is clear and unambiguous, and it's less likely to scare off non-technical people than words like 'magnitude'.

| improve this answer | |
-1, -2, -3, -4

Specifically, to answer your question, if all x are negative then the x with min(abs(x)) is the least negative.

| improve this answer | |
  • Why downvoted ? – MAKZ Mar 14 '16 at 19:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.