Editing 1275: int(pi)
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 10: | Line 10: | ||
This comic purports to provide a tip to programmers, that the number "{{w|3 (number)|3}}" is cursed and shouldn't be used. There is no explanation given as to why the number 3 is cursed, and it could well have been chosen arbitrarily. The title text hints that the consequence for using the cursed number is non-functioning code, a pain for any programmer. The absurdity of the number 3 somehow being cursed is part of the humor. | This comic purports to provide a tip to programmers, that the number "{{w|3 (number)|3}}" is cursed and shouldn't be used. There is no explanation given as to why the number 3 is cursed, and it could well have been chosen arbitrarily. The title text hints that the consequence for using the cursed number is non-functioning code, a pain for any programmer. The absurdity of the number 3 somehow being cursed is part of the humor. | ||
β | To assist the programmer, the comic gives an example of how to avoid the use of the number 3, by using a slightly convoluted method of | + | To assist the programmer, the comic gives an example of how to avoid the use of the number 3, by using a slightly convoluted method of tusing <code>int(pi)</code>, which means the {{w|integer}} part of {{w|pi}}, without the {{w|fractional part}}. Pi, an {{w|irrational number}}, has a value starting <code>3.14159...</code>, making <code>int(pi)</code> equal to 3. This is demonstrated in a formula to calculate the {{w|Sphere#Enclosed volume|volume of a sphere}}, normally (4/3)*pi*(r^3), but converted for avoidance of the number 3 to (4/int(pi))*pi*(r^int(pi)). |
For a number of reasons it is a good programming practice to use {{w|Variable (computer science)|variables}} and {{w|Constant (programming)|constants}} where a value is used in multiple places, however this is not typically used in the case of natural numbers. There are unusual situations where this type of programming is a valid method, however typically for more specific circumstances, and not a certain number being seen as cursed. | For a number of reasons it is a good programming practice to use {{w|Variable (computer science)|variables}} and {{w|Constant (programming)|constants}} where a value is used in multiple places, however this is not typically used in the case of natural numbers. There are unusual situations where this type of programming is a valid method, however typically for more specific circumstances, and not a certain number being seen as cursed. |