this post was submitted on 13 Sep 2023
22 points (95.8% liked)

Ask Science

8633 readers
2 users here now

Ask a science question, get a science answer.


Community Rules


Rule 1: Be respectful and inclusive.Treat others with respect, and maintain a positive atmosphere.


Rule 2: No harassment, hate speech, bigotry, or trolling.Avoid any form of harassment, hate speech, bigotry, or offensive behavior.


Rule 3: Engage in constructive discussions.Contribute to meaningful and constructive discussions that enhance scientific understanding.


Rule 4: No AI-generated answers.Strictly prohibit the use of AI-generated answers. Providing answers generated by AI systems is not allowed and may result in a ban.


Rule 5: Follow guidelines and moderators' instructions.Adhere to community guidelines and comply with instructions given by moderators.


Rule 6: Use appropriate language and tone.Communicate using suitable language and maintain a professional and respectful tone.


Rule 7: Report violations.Report any violations of the community rules to the moderators for appropriate action.


Rule 8: Foster a continuous learning environment.Encourage a continuous learning environment where members can share knowledge and engage in scientific discussions.


Rule 9: Source required for answers.Provide credible sources for answers. Failure to include a source may result in the removal of the answer to ensure information reliability.


By adhering to these rules, we create a welcoming and informative environment where science-related questions receive accurate and credible answers. Thank you for your cooperation in making the Ask Science community a valuable resource for scientific knowledge.

We retain the discretion to modify the rules as we deem necessary.


founded 1 year ago
MODERATORS
top 4 comments
sorted by: hot top controversial new old
[–] Serdan@lemm.ee 54 points 1 year ago (1 children)

Negative integers are also whole.

You may be thinking of "natural numbers", and the reason is that there's no universal rule on whether to include zero or not.

[–] infinity11@infosec.pub 7 points 1 year ago

OK, thanks!

[–] Fondots@lemmy.world 26 points 1 year ago* (last edited 1 year ago)

An "integer" is a whole number- a number that isn't a fraction/decimal. You can have negative integers/whole numbers, and 0 is also an integer that isn't truly positive or negative.

If you specify that you want a positive whole number/integer that technically wouldn't include 0, same if you specify a negative number.

So if you're looking for a value that is a whole number that is either zero or positive "non-negative integer" is probably the most succinct way to phrase it.

They can also be called "natural numbers" but depending on context, that may not always include 0.

[–] motsu@lemmy.world 0 points 1 year ago

Can you give more context to where the phrasing is used? Coming from a computer science angle, there are different data types for different things. For instance, you would use a "float" (floating point) data type to store a number like 7.12. Likewise, you use an "int" to store a whole number (such as 7). Because computers use a certain number of bits to store information, this means there's a max size to your data. int data types specifically have a "signed int" option as well as an "unsigned int" (the latter being a non negative integer). The benefit there is that by not storing a sign, the int can store numbers about 2x as large as a signed int.

If I dont need to ever store a negative value, I might explicitly call out that when writing out an algorithm