ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 24 Dec 2019 00:29:32 +0100Standard use of underscores in numeralshttps://ask.sagemath.org/question/48926/standard-use-of-underscores-in-numerals/ Hello, Sage Community!
Since Python (and pretty soon Sage) supports underscores in numbers, like in `11_000_000`, as an alternative to `11000000`, I was wondering if Sage or Python have any requirement or standard style for their use.
Let me explain, in English, the 11000000 is written 11,000,000, so i could write it as `11_000_000` in Sage. However, in Spanish, we use a small space after every thee-digit group, except if the number is four digits long. Also, the integer and the decimal parts are treated separatedly. For example:
- 4,321 is written as 4321, because it only has four digits, so I should write `4321` in Sage.
- 54,321 is written as 54 321 (with a small space between 4 and 3), so I should write `54_321` in Sage.
- 21, 1234 is written as 21,123 (because the integer part has only two digits, and the decimal part has only four), so I should write `21.1234` in Sage.
However, if I were to work with an international team of people, I suppose there should be some standard, because some will write `4_321` and `21.123_4`, while I will write `4321` and `21.1234`.
Is there any standard for using underscores in Sage numerals?
Thanks in advance for your answers!
32.12345 is written as Sun, 01 Dec 2019 21:47:05 +0100https://ask.sagemath.org/question/48926/standard-use-of-underscores-in-numerals/Comment by Iguananaut for <p>Hello, Sage Community!</p>
<p>Since Python (and pretty soon Sage) supports underscores in numbers, like in <code>11_000_000</code>, as an alternative to <code>11000000</code>, I was wondering if Sage or Python have any requirement or standard style for their use.</p>
<p>Let me explain, in English, the 11000000 is written 11,000,000, so i could write it as <code>11_000_000</code> in Sage. However, in Spanish, we use a small space after every thee-digit group, except if the number is four digits long. Also, the integer and the decimal parts are treated separatedly. For example:</p>
<ul>
<li>4,321 is written as 4321, because it only has four digits, so I should write <code>4321</code> in Sage.</li>
<li>54,321 is written as 54 321 (with a small space between 4 and 3), so I should write <code>54_321</code> in Sage.</li>
<li>21, 1234 is written as 21,123 (because the integer part has only two digits, and the decimal part has only four), so I should write <code>21.1234</code> in Sage.</li>
</ul>
<p>However, if I were to work with an international team of people, I suppose there should be some standard, because some will write <code>4_321</code> and <code>21.123_4</code>, while I will write <code>4321</code> and <code>21.1234</code>.</p>
<p>Is there any standard for using underscores in Sage numerals?</p>
<p>Thanks in advance for your answers!</p>
<p>32.12345 is written as </p>
https://ask.sagemath.org/question/48926/standard-use-of-underscores-in-numerals/?comment=48944#post-id-48944It doesn't seem all that worth worrying about to me. How much is this actually used? I don't think having thousands separators are all that useful for numbers beyond a certain size anyways (I think above trillions it starts to get hard to comprehend even with them). But maybe I'm wrong.Thu, 05 Dec 2019 12:09:57 +0100https://ask.sagemath.org/question/48926/standard-use-of-underscores-in-numerals/?comment=48944#post-id-48944Answer by tmonteil for <p>Hello, Sage Community!</p>
<p>Since Python (and pretty soon Sage) supports underscores in numbers, like in <code>11_000_000</code>, as an alternative to <code>11000000</code>, I was wondering if Sage or Python have any requirement or standard style for their use.</p>
<p>Let me explain, in English, the 11000000 is written 11,000,000, so i could write it as <code>11_000_000</code> in Sage. However, in Spanish, we use a small space after every thee-digit group, except if the number is four digits long. Also, the integer and the decimal parts are treated separatedly. For example:</p>
<ul>
<li>4,321 is written as 4321, because it only has four digits, so I should write <code>4321</code> in Sage.</li>
<li>54,321 is written as 54 321 (with a small space between 4 and 3), so I should write <code>54_321</code> in Sage.</li>
<li>21, 1234 is written as 21,123 (because the integer part has only two digits, and the decimal part has only four), so I should write <code>21.1234</code> in Sage.</li>
</ul>
<p>However, if I were to work with an international team of people, I suppose there should be some standard, because some will write <code>4_321</code> and <code>21.123_4</code>, while I will write <code>4321</code> and <code>21.1234</code>.</p>
<p>Is there any standard for using underscores in Sage numerals?</p>
<p>Thanks in advance for your answers!</p>
<p>32.12345 is written as </p>
https://ask.sagemath.org/question/48926/standard-use-of-underscores-in-numerals/?answer=48927#post-id-48927Sage does not have any recommandation about that. I guess you should just follow Python's [PEP 515/](https://www.python.org/dev/peps/pep-0515/), which is not that strict either.Sun, 01 Dec 2019 22:19:32 +0100https://ask.sagemath.org/question/48926/standard-use-of-underscores-in-numerals/?answer=48927#post-id-48927Comment by tmonteil for <p>Sage does not have any recommandation about that. I guess you should just follow Python's <a href="https://www.python.org/dev/peps/pep-0515/">PEP 515/</a>, which is not that strict either.</p>
https://ask.sagemath.org/question/48926/standard-use-of-underscores-in-numerals/?comment=49150#post-id-49150done :)Tue, 24 Dec 2019 00:29:32 +0100https://ask.sagemath.org/question/48926/standard-use-of-underscores-in-numerals/?comment=49150#post-id-49150Comment by John Palmieri for <p>Sage does not have any recommandation about that. I guess you should just follow Python's <a href="https://www.python.org/dev/peps/pep-0515/">PEP 515/</a>, which is not that strict either.</p>
https://ask.sagemath.org/question/48926/standard-use-of-underscores-in-numerals/?comment=48928#post-id-48928I would remove the word "precise" from your answer.Mon, 02 Dec 2019 04:17:33 +0100https://ask.sagemath.org/question/48926/standard-use-of-underscores-in-numerals/?comment=48928#post-id-48928