0

From a programing point of view, I have build a function that validates only positive numbers that contain only digits, what I mean by positive numbers is: 1, 2, 3, ... not allowed $+x$, $-x$, $x.y$, $0x$.

Q: What is the best name to give this function to reflect it's purpose, that would be mathematical correct ?

After googling and going trough wikipedia I tougth at isDecimal(), but decimals allows fractional and negative numbers. I thought at isDigit() but this name makes me think that the function accepts only "one" digit. Maibe isPositiveFiniteDecimal() ?

Thank you

Disclaimer: I am not very familiar with mathematical terms, so please accept my apologies if I mixed them up

2 Answers2

1

After reading a few more Wikipedia pages I found out that the name for this is Natural number. Based on the Wikipedia definition the natural number is used for counting:

In mathematics, the natural numbers are those used for counting ("there are six coins on the table")

Even if I did not fully understand the article I think this is the correct word I was looking for, and to answer the question the function name should be "isNaturalNumber()".

Additional information or constructive criticism is welcome.

Thank you

  • Yes, I think "natural number" is what you want, except that I'm a little worried about $\infty-1$, which is meaningless without further elaboration. – Gerry Myerson Mar 12 '13 at 12:04
  • @GerryMyerson I am not that good at math syntax, I just wanted people to know that any number is valid no mater how big it is (but not infinite), do you think "1, 2, 3, ... n" is better ? – Radu Maris Mar 12 '13 at 14:33
  • Radu, that would imply there's a largest number. I would just write, $1,2,3,\dots$. – Gerry Myerson Mar 12 '13 at 22:38
  • @GerryMyerson Updated the question, thank you. – Radu Maris Mar 13 '13 at 09:54
0

How about Is_Unsigned_Decimal(), which would return a TRUE or a FALSE.

My first thought was Is_Unsigned_Integer() which probably conflicts with a function that already exists. Is_Natural_Number works but does not emphasize that there cannot be a + or a -.

  • The question asks about how to name a (software) function, "no... fractions". The Question is three years old, without recent edits, and has a previous Answer. Perhaps a careful reading of information already discussed in the Question itself will convince you this suggestion adds little to the existing discussion. – hardmath Oct 23 '16 at 21:52
  • @hardmath Why do I care how old the question is? My first atempt was sloppy but I think my improved answer is better than the one provided. If not. I will take the hits to my reputation quietly. – Steven Alexis Gregory Oct 23 '16 at 22:12
  • Natural numbers are not negative. The age of the Question suggests you should make an effort to review what was written already. If you are engaged in trying to improve on that, I will withdraw my downvote. – hardmath Oct 23 '16 at 22:54
  • What bothers me is he said " I have build a function that validates only positive numbers that contain only digits". It seems to me that IsPositiveNumberThatContainsOnlyDigits() was what he wanted. But people tend to avoid long function names. I looked at what was already there and I didn't like it. So I came up with the answer as shown. Keep your downvote. It's what you think I deserve. I just wondered why. – Steven Alexis Gregory Oct 23 '16 at 23:40