Follow TV Tropes

Following

History MediaNotes / PowersOfTwoMinusOne

Go To

OR

Is there an issue? Send a MessageReason:
None


Computers also have a limit to the maximum size a variable can be. It's not a hard limit, but using bigger numbers slows down computation considerably. Whenever you hear about the "number of bits" of a video game console (e.g., the UsefulNotes/NintendoEntertainmentSystem being "8-bit"), that's what they're referring to. The NES has an 8-bit data bus; it can only move 8 bits of data around at a time. If it has to move any more, it has to do it in more than one cycle. In technical terms, this is called "word size."

to:

Computers also have a limit to the maximum size a variable can be. It's not a hard limit, but using bigger numbers slows down computation considerably. Whenever you hear about the "number of bits" of a video game console (e.g., the UsefulNotes/NintendoEntertainmentSystem being "8-bit"), that's what they're referring to. The NES has an 8-bit data bus; it can only move 8 bits of data around at a time. If it has to move any more, it has to do it in more than one cycle.cycle (and if it has to do math on them, it needs to CarryTheOne). In technical terms, this is called "word size."
Is there an issue? Send a MessageReason:
None


* '''12 bits''' can hold a value as high as 4095. Some NES games like ''VideoGame/FinalFantasyI'' used hacks to get values this large.

to:

* '''12 bits''' can hold a value as high as 4095. Some NES games like ''VideoGame/FinalFantasyI'' and ''VideoGame/{{Rygar}}'' used hacks to get values this large.
Is there an issue? Send a MessageReason:
None


* '''128 bits''' can hold a value as high as 340.2 undecillion (or 3.4×10[[superscript:38]]). Computers usually do not have 128-bit general-purpose registers, but the [[UsefulNotes/PlayStation3 PS3]]'s Cell, the UsefulNotes/Xbox360's CPU, and modern x64 [=CPUs=] (used both in [[UsefulNotes/IBMPersonalComputer [=PCs=]]] and [[UsefulNotes/AppleMacintosh Macs]]) do have 128-bit vector registers (holding 4 32-bit values). These are used for [[VectorUnit vector math]].

to:

* '''128 bits''' can hold a value as high as 340.2 undecillion (or 3.4×10[[superscript:38]]). Computers usually do not have 128-bit general-purpose registers, but the [[UsefulNotes/PlayStation3 PS3]]'s Cell, the UsefulNotes/Xbox360's CPU, and modern x64 [=CPUs=] (used both in [[UsefulNotes/IBMPersonalComputer [=PCs=]]] and [[UsefulNotes/AppleMacintosh Macs]]) do have 128-bit vector registers (holding 4 32-bit values). These are used for [[VectorUnit [[UsefulNotes/FlynnsTaxonomy vector math]].
Is there an issue? Send a MessageReason:
None


** That's a part of the reasoning for the whole concept of "magic numbers" in engineering. When you are making something you need to decide on some properties (like plank size or ceiling height, for example) anyway, so why not use the ones that someone [[FollowTheLeader has already used before]]? And then it happens that the similar sizes allow for compatibility and interoperability, it becomes a self-reinforcing convention, and we all end up with 2×4's[[note]]Which, it should be noted, are [[NonIndicativeName actually 1½×3½]]. Aren't standards fun?[[/note]]. The same logic applies to the programming too.

to:

** That's a part of the reasoning for the whole concept of "magic numbers" in engineering. When you are making something you need to decide on some properties (like plank size or ceiling height, for example) anyway, so why not use the ones that someone [[FollowTheLeader has already used before]]? And then it happens that the similar sizes allow for compatibility and interoperability, it becomes a self-reinforcing convention, and we all end up with 2×4's[[note]]Which, 2×4's[[note]]Dimensional lumber, used in United States and Canada. They are named after the lumber's profile thickness, in inches. 2×4's, it should be noted, are [[NonIndicativeName actually 1½×3½]]. Aren't standards fun?[[/note]]. The same logic applies to the programming too.
Is there an issue? Send a MessageReason:
None


* '''64 bits''' can hold a value as high as 18.4 quintillion (or 1.84×10[[superscript:19]]). The UsefulNotes/{{Nintendo 64}}, UsefulNotes/GameCube[[note]]Although with some 32-bit components[[/note]], Sony UsefulNotes/PlayStation2, and modern desktop [=PCs=] are all 64-bit, with 64-bit operating systems becoming rather commonplace in 2010 (at least, on new computers).

to:

* '''64 bits''' can hold a value as high as 18.4 quintillion (or 1.84×10[[superscript:19]]). The UsefulNotes/{{Nintendo 64}}, UsefulNotes/GameCube[[note]]Although UsefulNotes/GameCube,[[note]]Although with some 32-bit components[[/note]], components[[/note]] Sony UsefulNotes/PlayStation2, and modern desktop [=PCs=] are all 64-bit, with 64-bit operating systems becoming rather commonplace in 2010 (at least, on new computers).
Is there an issue? Send a MessageReason:
None


Computers also have a limit to the maximum size a variable can be. It's not a hard limit, but using bigger numbers slows down computation considerably. Whenever you hear about the "number of bits" of a video game console (e.g., the NintendoEntertainmentSystem being "8-bit"), that's what they're referring to. The NES has an 8-bit data bus; it can only move 8 bits of data around at a time. If it has to move any more, it has to do it in more than one cycle. In technical terms, this is called "word size."

to:

Computers also have a limit to the maximum size a variable can be. It's not a hard limit, but using bigger numbers slows down computation considerably. Whenever you hear about the "number of bits" of a video game console (e.g., the NintendoEntertainmentSystem UsefulNotes/NintendoEntertainmentSystem being "8-bit"), that's what they're referring to. The NES has an 8-bit data bus; it can only move 8 bits of data around at a time. If it has to move any more, it has to do it in more than one cycle. In technical terms, this is called "word size."
Is there an issue? Send a MessageReason:
None


* Floating point. This works like scientific notation; one bit is used to store the sign, some number of bits (called the mantissa) are used to store the number to the right of the decimal point, and the remaining bits (called the exponent) are, predictably, used to store the power of 2 to multiply by. (We use 2 instead of 10 because, again, computers work in binary.) It should be noted that this is a gross oversimplification.

to:

* Floating point. This works like scientific notation; one bit is used to store the sign, some number of bits (called the mantissa) are used to store the number to the right of the decimal point, and the remaining bits (called the exponent) are, predictably, used to store the power of 2 to multiply by. (We use 2 instead of 10 because, again, computers work in binary.) It should be noted that this is a gross oversimplification.oversimplification -- if you've got ten minutes to kill and like ''VideoGame/SuperMario64'', [[https://www.youtube.com/watch?v=9hdFG2GcNuA a speedrunner for that game goes into more detail]].
Is there an issue? Send a MessageReason:
None


* '''128 bits''' can hold a value as high as 340.2 undecillion (or 3.4×10[[superscript:38]]). Computers usually do not have 128-bit general-purpose registers, but the [[UsefulNotes/PlayStation3 PS3]]'s Cell, the [[UsefulNotes/Xbox360]]'s CPU, and modern x64 [=CPUs=] (used both in [[UsefulNotes/IBMPersonalComputer [=PCs=]]] and [[UsefulNotes/AppleMacintosh Macs]]) do have 128-bit vector registers (holding 4 32-bit values). These are used for [[VectorUnit vector math]].

to:

* '''128 bits''' can hold a value as high as 340.2 undecillion (or 3.4×10[[superscript:38]]). Computers usually do not have 128-bit general-purpose registers, but the [[UsefulNotes/PlayStation3 PS3]]'s Cell, the [[UsefulNotes/Xbox360]]'s UsefulNotes/Xbox360's CPU, and modern x64 [=CPUs=] (used both in [[UsefulNotes/IBMPersonalComputer [=PCs=]]] and [[UsefulNotes/AppleMacintosh Macs]]) do have 128-bit vector registers (holding 4 32-bit values). These are used for [[VectorUnit vector math]].
Is there an issue? Send a MessageReason:
None


* '''128 bits''' can hold a value as high as 340.2 undecillion (or 3.4×10[[superscript:38]]). Computers usually do not have 128-bit general-purpose registers, but the [[UsefulNotes/PlayStation3 PS3]]'s Cell, the X-Box 360's CPU, and modern x64 [=CPUs=] (used both in [[UsefulNotes/IBMPersonalComputer [=PCs=]]] and [[UsefulNotes/AppleMacintosh Macs]]) do have 128-bit vector registers (holding 4 32-bit values). These are used for [[VectorUnit vector math]].

Note that in addition to the above, most recent processors have additional "vector" processors for dealing with multiple calculations in parallel; these have so far been up to 256 bits wide. Also floating point calculations are often done at different sizes.

to:

* '''128 bits''' can hold a value as high as 340.2 undecillion (or 3.4×10[[superscript:38]]). Computers usually do not have 128-bit general-purpose registers, but the [[UsefulNotes/PlayStation3 PS3]]'s Cell, the X-Box 360's [[UsefulNotes/Xbox360]]'s CPU, and modern x64 [=CPUs=] (used both in [[UsefulNotes/IBMPersonalComputer [=PCs=]]] and [[UsefulNotes/AppleMacintosh Macs]]) do have 128-bit vector registers (holding 4 32-bit values). These are used for [[VectorUnit vector math]].

Note that in addition to the above, most recent processors have additional "vector" processors for dealing with multiple calculations in parallel; these have so far been up to 256 bits wide. Also Also, floating point calculations are often done at different sizes.
Is there an issue? Send a MessageReason:
None


* '''32 bits''' can hold a value as high as 4,294,967,295. The UsefulNotes/SegaSaturn and [[UsefulNotes/SegaDreamcast Dreamcast]], Sony UsefulNotes/{{PlayStation}}, Microsoft UsefulNotes/{{XBox}} and the UsefulNotes/{{Wii}} are all 32-bit. So are desktop [=PCs=] made from 1987 to 2007. Most smartphones are 32-bit, with 64-bit phones starting to trickle out in 2013 and 2014.
* '''64 bits''' can hold a value as high as 18.4 quintillion (or 1.84×10[[superscript:19]]). The UsefulNotes/{{Nintendo64}}, UsefulNotes/GameCube[[note]]Although with some 32-bit components[[/note]], Sony UsefulNotes/PlayStation2, and modern desktop [=PCs=] are all 64-bit, with 64-bit operating systems becoming rather commonplace in 2010 (at least, on new computers).
* '''128 bits''' can hold a value as high as 340.2 undecillion (or 3.4×10[[superscript:38]]). Computers usually do not have 128-bit general-purpose registers, but the [[UsefulNotes/PlayStationThree PS3]]'s Cell, the X-Box 360's CPU, and modern x64 [=CPUs=] (used both in [[UsefulNotes/IBMPersonalComputer [=PCs=]]] and [[UsefulNotes/AppleMacintosh Macs]]) do have 128-bit vector registers (holding 4 32-bit values). These are used for [[VectorUnit vector math]].

to:

* '''32 bits''' can hold a value as high as 4,294,967,295. The UsefulNotes/SegaSaturn and [[UsefulNotes/SegaDreamcast Dreamcast]], Sony UsefulNotes/{{PlayStation}}, Microsoft UsefulNotes/{{XBox}} UsefulNotes/{{Xbox}} and the UsefulNotes/{{Wii}} are all 32-bit. So are desktop [=PCs=] made from 1987 to 2007. Most smartphones are 32-bit, with 64-bit phones starting to trickle out in 2013 and 2014.
* '''64 bits''' can hold a value as high as 18.4 quintillion (or 1.84×10[[superscript:19]]). The UsefulNotes/{{Nintendo64}}, UsefulNotes/{{Nintendo 64}}, UsefulNotes/GameCube[[note]]Although with some 32-bit components[[/note]], Sony UsefulNotes/PlayStation2, and modern desktop [=PCs=] are all 64-bit, with 64-bit operating systems becoming rather commonplace in 2010 (at least, on new computers).
* '''128 bits''' can hold a value as high as 340.2 undecillion (or 3.4×10[[superscript:38]]). Computers usually do not have 128-bit general-purpose registers, but the [[UsefulNotes/PlayStationThree [[UsefulNotes/PlayStation3 PS3]]'s Cell, the X-Box 360's CPU, and modern x64 [=CPUs=] (used both in [[UsefulNotes/IBMPersonalComputer [=PCs=]]] and [[UsefulNotes/AppleMacintosh Macs]]) do have 128-bit vector registers (holding 4 32-bit values). These are used for [[VectorUnit vector math]].



* As a {{Cap}}. Programming for older systems is really ''really'' hard; these systems were relatively good at graphics processing, but very bad at calculations, so every CPU cycle saved was a big deal.[[note]]UsefulNotes/{{Atari 2600}} was hit the hardest: it had ''no'' UsefulNotes/VideoRAM, so programmers had to create the picture by timely manipulation of the graphic output registers, but as it also had no interrupt lines in the {{CPU}}, this was possible only by the careful timing of the program itself and inserting graphical output commands into the correct places.[[/note]] If you cap a value to the actual limit of your variable, you can enforce the cap with a "did previous instruction overflow" test, which is usually faster than a "is X greater than Y" test (the latter often involves hidden subtraction, even on newer processors).

to:

* As a {{Cap}}. Programming for older systems is really ''really'' hard; these systems were relatively good at graphics processing, but very bad at calculations, so every CPU cycle saved was a big deal.[[note]]UsefulNotes/{{Atari 2600}} [[note]]UsefulNotes/{{Atari|2600}} was hit the hardest: it had ''no'' UsefulNotes/VideoRAM, so programmers had to create the picture by timely manipulation of the graphic output registers, but as it also had no interrupt lines in the {{CPU}}, this was possible only by the careful timing of the program itself and inserting graphical output commands into the correct places.[[/note]] If you cap a value to the actual limit of your variable, you can enforce the cap with a "did previous instruction overflow" test, which is usually faster than a "is X greater than Y" test (the latter often involves hidden subtraction, even on newer processors).



** That's a part of the reasoning for the whole concept of "magic numbers" in engineering. When you are making something you need to decide on some properties (like plank size or ceiling height, for example) anyway, so why not use the ones that someone [[FollowTheLeader has already used before]]? And then it happens that the similar sizes allow for compatibility and interoperability, it becomes a self-reinforcing convention, and we all end up with 2×4's[[note]]Which, it should be noted, are [[MindScrew actually 1½×3½]]. Aren't standards fun?[[/note]]. The same logic applies to the programming too.

to:

** That's a part of the reasoning for the whole concept of "magic numbers" in engineering. When you are making something you need to decide on some properties (like plank size or ceiling height, for example) anyway, so why not use the ones that someone [[FollowTheLeader has already used before]]? And then it happens that the similar sizes allow for compatibility and interoperability, it becomes a self-reinforcing convention, and we all end up with 2×4's[[note]]Which, it should be noted, are [[MindScrew [[NonIndicativeName actually 1½×3½]]. Aren't standards fun?[[/note]]. The same logic applies to the programming too.
Is there an issue? Send a MessageReason:
None


* '''32 bits''' can hold a value as high as 4,294,967,295. The UsefulNotes/SegaSaturn and UsefulNotes/{{Dreamcast}}, Sony UsefulNotes/{{PlayStation}}, Microsoft UsefulNotes/{{XBox}} and the UsefulNotes/{{Wii}} are all 32-bit. So are desktop [=PCs=] made from 1987 to 2007. Most smartphones are 32-bit, with 64-bit phones starting to trickle out in 2013 and 2014.

to:

* '''32 bits''' can hold a value as high as 4,294,967,295. The UsefulNotes/SegaSaturn and UsefulNotes/{{Dreamcast}}, [[UsefulNotes/SegaDreamcast Dreamcast]], Sony UsefulNotes/{{PlayStation}}, Microsoft UsefulNotes/{{XBox}} and the UsefulNotes/{{Wii}} are all 32-bit. So are desktop [=PCs=] made from 1987 to 2007. Most smartphones are 32-bit, with 64-bit phones starting to trickle out in 2013 and 2014.



----

to:

----
Is there an issue? Send a MessageReason:
None


However, that's not the end of the story. All of those values assume that the variable is unsigned, meaning it can't hold a negative number. Signed numbers essentially throw away one bit in order to be able to store both positive ''and'' negative numbers. Zero is taken to be the first "positive" number, whereas negative numbers start at -1, which makes the negative limit higher (absolutely speaking). This effectively reduces by half the maximum number that the value can hold for the sake of representing negative numbers. Here are some revised tables:

to:

However, that's not the end of the story. All of those values assume that the variable is unsigned, meaning it can't hold a negative number. Signed numbers essentially throw away sacrifice one bit in order to be able to store both positive ''and'' negative numbers. Zero is taken to be the first "positive" number, whereas negative numbers start at -1, which makes the negative limit higher (absolutely speaking). This effectively reduces by half the maximum number that the value can hold for the sake of representing negative numbers. Here are some revised tables:
Is there an issue? Send a MessageReason:
None


* '''64 bits''' can hold a value as high as 18.4 quintillion (or 1.84×10[[superscript:19]]). The UsefulNotes/{{Nintendo64}}, UsefulNotes/GameCube[[note]]Although with some 32-bit components[[/note]], Sony [[UsefulNotes/PlayStationTwo PlayStation 2]], and modern desktop [=PCs=] are all 64-bit, with 64-bit operating systems becoming rather commonplace in 2010 (at least, on new computers).

to:

* '''64 bits''' can hold a value as high as 18.4 quintillion (or 1.84×10[[superscript:19]]). The UsefulNotes/{{Nintendo64}}, UsefulNotes/GameCube[[note]]Although with some 32-bit components[[/note]], Sony [[UsefulNotes/PlayStationTwo PlayStation 2]], UsefulNotes/PlayStation2, and modern desktop [=PCs=] are all 64-bit, with 64-bit operating systems becoming rather commonplace in 2010 (at least, on new computers).
Is there an issue? Send a MessageReason:
None


* '''64 bits''' can hold a value as high as 18.4 quintillion (or 1.84×10[[superscript:19]]). The UsefulNotes/Nintendo64, UsefulNotes/GameCube[[note]]Although with some 32-bit components[[/note]], Sony [[UsefulNotes/PlayStationTwo PlayStation 2]], and modern desktop [=PCs=] are all 64-bit, with 64-bit operating systems becoming rather commonplace in 2010 (at least, on new computers).

to:

* '''64 bits''' can hold a value as high as 18.4 quintillion (or 1.84×10[[superscript:19]]). The UsefulNotes/Nintendo64, UsefulNotes/{{Nintendo64}}, UsefulNotes/GameCube[[note]]Although with some 32-bit components[[/note]], Sony [[UsefulNotes/PlayStationTwo PlayStation 2]], and modern desktop [=PCs=] are all 64-bit, with 64-bit operating systems becoming rather commonplace in 2010 (at least, on new computers).
Is there an issue? Send a MessageReason:
None


* '''64 bits''' can hold a value as high as 18.4 quintillion (or 1.84×10[[superscript:19]]). The [[UsefulNotes/Nintendo64 Nintendo 64]], UsefulNotes/GameCube[[note]]Although with some 32-bit components[[/note]], Sony [[UsefulNotes/PlayStationTwo PlayStation 2]], and modern desktop [=PCs=] are all 64-bit, with 64-bit operating systems becoming rather commonplace in 2010 (at least, on new computers).

to:

* '''64 bits''' can hold a value as high as 18.4 quintillion (or 1.84×10[[superscript:19]]). The [[UsefulNotes/Nintendo64 Nintendo 64]], UsefulNotes/Nintendo64, UsefulNotes/GameCube[[note]]Although with some 32-bit components[[/note]], Sony [[UsefulNotes/PlayStationTwo PlayStation 2]], and modern desktop [=PCs=] are all 64-bit, with 64-bit operating systems becoming rather commonplace in 2010 (at least, on new computers).
Is there an issue? Send a MessageReason:
None


* '''64 bits''' can hold a value as high as 18.4 quintillion (or 1.84×10[[superscript:19]]). The [[UsefulNotes/NintendoSixtyFour Nintendo 64]], UsefulNotes/GameCube[[note]]Although with some 32-bit components[[/note]], Sony [[UsefulNotes/PlayStationTwo PlayStation 2]], and modern desktop [=PCs=] are all 64-bit, with 64-bit operating systems becoming rather commonplace in 2010 (at least, on new computers).

to:

* '''64 bits''' can hold a value as high as 18.4 quintillion (or 1.84×10[[superscript:19]]). The [[UsefulNotes/NintendoSixtyFour [[UsefulNotes/Nintendo64 Nintendo 64]], UsefulNotes/GameCube[[note]]Although with some 32-bit components[[/note]], Sony [[UsefulNotes/PlayStationTwo PlayStation 2]], and modern desktop [=PCs=] are all 64-bit, with 64-bit operating systems becoming rather commonplace in 2010 (at least, on new computers).
Is there an issue? Send a MessageReason:
None


* As a {{Cap}}. Programming for older systems is really ''really'' hard; these systems were relatively good at graphics processing, but very bad at calculations, so every CPU cycle saved was a big deal.[[note]]UsefulNotes/{{Atari 2600}} was hit the hardest: it had ''no'' {{VRAM}}, so programmers had to create the picture by timely manipulation of the graphic output registers, but as it also had no interrupt lines in the {{CPU}}, this was possible only by the careful timing of the program itself and inserting graphical output commands into the correct places.[[/note]] If you cap a value to the actual limit of your variable, you can enforce the cap with a "did previous instruction overflow" test, which is usually faster than a "is X greater than Y" test (the latter often involves hidden subtraction, even on newer processors).

to:

* As a {{Cap}}. Programming for older systems is really ''really'' hard; these systems were relatively good at graphics processing, but very bad at calculations, so every CPU cycle saved was a big deal.[[note]]UsefulNotes/{{Atari 2600}} was hit the hardest: it had ''no'' {{VRAM}}, UsefulNotes/VideoRAM, so programmers had to create the picture by timely manipulation of the graphic output registers, but as it also had no interrupt lines in the {{CPU}}, this was possible only by the careful timing of the program itself and inserting graphical output commands into the correct places.[[/note]] If you cap a value to the actual limit of your variable, you can enforce the cap with a "did previous instruction overflow" test, which is usually faster than a "is X greater than Y" test (the latter often involves hidden subtraction, even on newer processors).
Is there an issue? Send a MessageReason:
None


** That's a part of the reasoning for the whole concept of "magic numbers" in engineering. When you are making something you need to decide on some properties (like plank size or ceiling height, for example) anyway, so why not use the ones that someone [[FollowTheLeader has already used before]]? And then it happens that the similar sizes allow for compatibility and interoperability, it becomes a self-reinforcing convention, and we all end up with 2-by-4-s[[note]]Which, it should be noted, are actually 1½×3½. Aren't standards fun?[[/note]]. The same logic applies to the programming too.

to:

** That's a part of the reasoning for the whole concept of "magic numbers" in engineering. When you are making something you need to decide on some properties (like plank size or ceiling height, for example) anyway, so why not use the ones that someone [[FollowTheLeader has already used before]]? And then it happens that the similar sizes allow for compatibility and interoperability, it becomes a self-reinforcing convention, and we all end up with 2-by-4-s[[note]]Which, 2×4's[[note]]Which, it should be noted, are [[MindScrew actually 1½×3½.1½×3½]]. Aren't standards fun?[[/note]]. The same logic applies to the programming too.
Is there an issue? Send a MessageReason:
added humorous aside about 2×4\'s


** That's a part of the reasoning for the whole concept of "magic numbers" in engineering. When you are making something you need to decide on some properties (like plank size or ceiling height, for example) anyway, so why not use the ones that someone [[FollowTheLeader has already used before]]? And then it happens that the similar sizes allow for compatibility and interoperability, it becomes a self-reinforcing convention, and we all end up with 2-by-4-s. The same logic applies to the programming too.

to:

** That's a part of the reasoning for the whole concept of "magic numbers" in engineering. When you are making something you need to decide on some properties (like plank size or ceiling height, for example) anyway, so why not use the ones that someone [[FollowTheLeader has already used before]]? And then it happens that the similar sizes allow for compatibility and interoperability, it becomes a self-reinforcing convention, and we all end up with 2-by-4-s.2-by-4-s[[note]]Which, it should be noted, are actually 1½×3½. Aren't standards fun?[[/note]]. The same logic applies to the programming too.
Is there an issue? Send a MessageReason:
None


* '''12 bits''' can hold a value as high as 4095. Some NES games like ''Franchise/FinalFantasy'' used hacks to get values this large.

to:

* '''12 bits''' can hold a value as high as 4095. Some NES games like ''Franchise/FinalFantasy'' ''VideoGame/FinalFantasyI'' used hacks to get values this large.
Is there an issue? Send a MessageReason:
None


* '''12 bits''' can hold a value as high as 4095. Some NES games like ''Videogame/FinalFantasy'' used hacks to get values this large.

to:

* '''12 bits''' can hold a value as high as 4095. Some NES games like ''Videogame/FinalFantasy'' ''Franchise/FinalFantasy'' used hacks to get values this large.
Is there an issue? Send a MessageReason:
None


Video games are nothing more than computer programs, and they're limited by the systems they run on. One particularly strict limitation is the fact that computers can't handle numbers of arbitrary size with any kind of efficiency. Since efficiency is normally pretty important for video games, this places some hard limits on the range of values they can work with. Since computers work in binary, that size has to be a certain number of bits (binary digits - a zero or a one). Numbers stored in a computer's memory are called ''variables''.

Computers also have a limit to the maximum size a variable can be. It's not a hard limit, but using bigger numbers slows down computation considerably. Whenever you hear about the "number of bits" of a video game console (i.e. the NintendoEntertainmentSystem being "8-bit"), that's what they're referring to. The NES has an 8-bit data bus; it can only move 8 bits of data around at a time. If it has to move any more, it has to do it in more than one cycle. In technical terms, this is called "word size."

In newer video games, many things - say, the number of items in the player's HyperspaceArsenal - are {{cap}}ped at reasonable limits because the variable actually used to store that value has a decidedly ''un''reasonable limit. However, in older days, it was common to let the computer itself cap these values, because the limits were a lot lower - an 8-bit computer such as the NES has a "limit" of 255.

to:

Video games are nothing more than computer programs, and they're limited by the systems they run on. One particularly strict limitation is the fact that computers can't handle numbers of arbitrary size with any kind of efficiency. Since Because efficiency is normally pretty important for video games, this places some hard limits on the range of values they can work with. Since Because computers work in binary, that size has to be a certain number of bits (binary digits - -- a zero or a one). Numbers stored in a computer's memory are called ''variables''.

Computers also have a limit to the maximum size a variable can be. It's not a hard limit, but using bigger numbers slows down computation considerably. Whenever you hear about the "number of bits" of a video game console (i.e. (e.g., the NintendoEntertainmentSystem being "8-bit"), that's what they're referring to. The NES has an 8-bit data bus; it can only move 8 bits of data around at a time. If it has to move any more, it has to do it in more than one cycle. In technical terms, this is called "word size."

In newer video games, many things - -- say, the number of items in the player's HyperspaceArsenal - -- are {{cap}}ped at reasonable limits because the variable actually used to store that value has a decidedly ''un''reasonable limit. However, in older days, it was common to let the computer itself cap these values, because the limits were a lot lower - -- an 8-bit computer such as the NES has a "limit" of 255.



* '''16 bits''' can hold a value as high as 65,535. The UsefulNotes/SuperNintendoEntertainmentSystem and UsefulNotes/SegaGenesis were 16-bit, as were [=PCs=] in the mid 1980s, and a few Japanese gaming computers.
* '''32 bits''' can hold a value as high as 4,294,967,295. The UsefulNotes/SegaSaturn and UsefulNotes/{{Dreamcast}}, Sony UsefulNotes/{{PlayStation}}, Microsoft UsefulNotes/{{XBox}} and the UsefulNotes/{{Wii}} are all 32-bit. So are desktop [=PCs=] from 1987 to 2007. Most smartphones are 32-bit, with 64-bit phones starting to trickle out in 2013 and 2014.

to:

* '''16 bits''' can hold a value as high as 65,535. The UsefulNotes/SuperNintendoEntertainmentSystem and UsefulNotes/SegaGenesis were are 16-bit, as were are [=PCs=] made in the mid 1980s, mid-1980s, and a few Japanese gaming computers.
* '''32 bits''' can hold a value as high as 4,294,967,295. The UsefulNotes/SegaSaturn and UsefulNotes/{{Dreamcast}}, Sony UsefulNotes/{{PlayStation}}, Microsoft UsefulNotes/{{XBox}} and the UsefulNotes/{{Wii}} are all 32-bit. So are desktop [=PCs=] made from 1987 to 2007. Most smartphones are 32-bit, with 64-bit phones starting to trickle out in 2013 and 2014.



* '''128 bits''' can hold a value as high as 340.2 undecillion (or 3.4×10[[superscript:38]]). Computers usually do not have 128-bit general-purpose registers, but the [[UsefulNotes/PlayStationThree PS3]]'s Cell, the X-Box 360's CPU and modern x64 [=CPUs=] (used both in [[UsefulNotes/IBMPersonalComputer [=PCs=]]] and [[UsefulNotes/AppleMacintosh Macs]]) do have 128-bit vector registers (holding 4 32-bit values). These are used for [[VectorUnit vector math]].

to:

* '''128 bits''' can hold a value as high as 340.2 undecillion (or 3.4×10[[superscript:38]]). Computers usually do not have 128-bit general-purpose registers, but the [[UsefulNotes/PlayStationThree PS3]]'s Cell, the X-Box 360's CPU CPU, and modern x64 [=CPUs=] (used both in [[UsefulNotes/IBMPersonalComputer [=PCs=]]] and [[UsefulNotes/AppleMacintosh Macs]]) do have 128-bit vector registers (holding 4 32-bit values). These are used for [[VectorUnit vector math]].



So what happens if you try to store a number bigger than that? Say you were trying to add one to a 16-bit variable that's already set to 65,535. It would "wrap" - adding one to 65,535 would give you zero. Adding two would give you one. And so on, and so forth. The same goes the other way - subtracting one from zero gives you 65,535. When this happens, it's called "carry" if expected or "overflow" if not. This is the source of many GoodBadBugs; most of them are a case of programmer oversight, since the "overflow" flag in the CPU is triggered whenever this happens. Also see {{Cap}}.

However, that's not the end of the story. All of those values assume that the variable is unsigned, meaning it can't hold a negative number. Signed numbers essentially throw away one bit in order to be able to store both positive ''and'' negative numbers. Zero is taken to be the first "positive" number, while negative numbers start at -1, which makes the negative limit higher (absolutely speaking). This effectively reduces by half the maximum number that the value can hold for the sake of representing negative numbers. Here are some revised tables:

to:

So what happens if you try to store a number bigger than that? Say you were trying to add one to a 16-bit variable that's already set to 65,535. It would "wrap" - -- adding one to 65,535 would give you zero. Adding two would give you one. And so on, and so forth. The same goes the other way - -- subtracting one from zero gives you 65,535. When this happens, it's called "carry" if expected or "overflow" if not. This is the source of many GoodBadBugs; most of them are a case of programmer oversight, since as the "overflow" flag in the CPU is triggered whenever this happens. Also see {{Cap}}.

However, that's not the end of the story. All of those values assume that the variable is unsigned, meaning it can't hold a negative number. Signed numbers essentially throw away one bit in order to be able to store both positive ''and'' negative numbers. Zero is taken to be the first "positive" number, while whereas negative numbers start at -1, which makes the negative limit higher (absolutely speaking). This effectively reduces by half the maximum number that the value can hold for the sake of representing negative numbers. Here are some revised tables:
Is there an issue? Send a MessageReason:
None


* '''8 bits''' can hold a value as high as 255. The {{Atari 2600}} and [[UsefulNotes/{{Atari 7800}} 7800]], NintendoEntertainmentSystem, SegaMasterSystem, and early home computers were all 8-bit.
* '''12 bits''' can hold a value as high as 4095. Some NES games like ''FinalFantasy'' used hacks to get values this large.
* '''16 bits''' can hold a value as high as 65,535. The SuperNintendoEntertainmentSystem and SegaGenesis were 16-bit, as were [=PCs=] in the mid 1980s, and a few Japanese gaming computers.
* '''32 bits''' can hold a value as high as 4,294,967,295. The SegaSaturn and {{Dreamcast}}, Sony {{PlayStation}}, Microsoft {{XBox}} and the {{Wii}} are all 32-bit. So are desktop [=PCs=] from 1987 to 2007. Most smartphones are 32-bit, with 64-bit phones starting to trickle out in 2013 and 2014.
* '''64 bits''' can hold a value as high as 18.4 quintillion (or 1.84×10[[superscript:19]]). The [[NintendoSixtyFour Nintendo 64]], GameCube[[note]]Although with some 32-bit components[[/note]], Sony [[PlayStationTwo PlayStation 2]], and modern desktop [=PCs=] are all 64-bit, with 64-bit operating systems becoming rather commonplace in 2010 (at least, on new computers).
* '''128 bits''' can hold a value as high as 340.2 undecillion (or 3.4×10[[superscript:38]]). Computers usually do not have 128-bit general-purpose registers, but the [[PlayStationThree PS3]]'s Cell, the X-Box 360's CPU and modern x64 [=CPUs=] (used both in [[IBMPersonalComputer [=PCs=]]] and [[AppleMacintosh Macs]]) do have 128-bit vector registers (holding 4 32-bit values). These are used for [[VectorUnit vector math]].

to:

* '''8 bits''' can hold a value as high as 255. The {{Atari UsefulNotes/{{Atari 2600}} and [[UsefulNotes/{{Atari 7800}} 7800]], NintendoEntertainmentSystem, SegaMasterSystem, UsefulNotes/NintendoEntertainmentSystem, UsefulNotes/SegaMasterSystem, and early home computers were all 8-bit.
* '''12 bits''' can hold a value as high as 4095. Some NES games like ''FinalFantasy'' ''Videogame/FinalFantasy'' used hacks to get values this large.
* '''16 bits''' can hold a value as high as 65,535. The SuperNintendoEntertainmentSystem UsefulNotes/SuperNintendoEntertainmentSystem and SegaGenesis UsefulNotes/SegaGenesis were 16-bit, as were [=PCs=] in the mid 1980s, and a few Japanese gaming computers.
* '''32 bits''' can hold a value as high as 4,294,967,295. The SegaSaturn UsefulNotes/SegaSaturn and {{Dreamcast}}, UsefulNotes/{{Dreamcast}}, Sony {{PlayStation}}, UsefulNotes/{{PlayStation}}, Microsoft {{XBox}} UsefulNotes/{{XBox}} and the {{Wii}} UsefulNotes/{{Wii}} are all 32-bit. So are desktop [=PCs=] from 1987 to 2007. Most smartphones are 32-bit, with 64-bit phones starting to trickle out in 2013 and 2014.
* '''64 bits''' can hold a value as high as 18.4 quintillion (or 1.84×10[[superscript:19]]). The [[NintendoSixtyFour [[UsefulNotes/NintendoSixtyFour Nintendo 64]], GameCube[[note]]Although UsefulNotes/GameCube[[note]]Although with some 32-bit components[[/note]], Sony [[PlayStationTwo [[UsefulNotes/PlayStationTwo PlayStation 2]], and modern desktop [=PCs=] are all 64-bit, with 64-bit operating systems becoming rather commonplace in 2010 (at least, on new computers).
* '''128 bits''' can hold a value as high as 340.2 undecillion (or 3.4×10[[superscript:38]]). Computers usually do not have 128-bit general-purpose registers, but the [[PlayStationThree [[UsefulNotes/PlayStationThree PS3]]'s Cell, the X-Box 360's CPU and modern x64 [=CPUs=] (used both in [[IBMPersonalComputer [[UsefulNotes/IBMPersonalComputer [=PCs=]]] and [[AppleMacintosh [[UsefulNotes/AppleMacintosh Macs]]) do have 128-bit vector registers (holding 4 32-bit values). These are used for [[VectorUnit vector math]].



* As a {{Cap}}. Programming for older systems is really ''really'' hard; these systems were relatively good at graphics processing, but very bad at calculations, so every CPU cycle saved was a big deal.[[note]]{{Atari 2600}} was hit the hardest: it had ''no'' {{VRAM}}, so programmers had to create the picture by timely manipulation of the graphic output registers, but as it also had no interrupt lines in the {{CPU}}, this was possible only by the careful timing of the program itself and inserting graphical output commands into the correct places.[[/note]] If you cap a value to the actual limit of your variable, you can enforce the cap with a "did previous instruction overflow" test, which is usually faster than a "is X greater than Y" test (the latter often involves hidden subtraction, even on newer processors).

to:

* As a {{Cap}}. Programming for older systems is really ''really'' hard; these systems were relatively good at graphics processing, but very bad at calculations, so every CPU cycle saved was a big deal.[[note]]{{Atari [[note]]UsefulNotes/{{Atari 2600}} was hit the hardest: it had ''no'' {{VRAM}}, so programmers had to create the picture by timely manipulation of the graphic output registers, but as it also had no interrupt lines in the {{CPU}}, this was possible only by the careful timing of the program itself and inserting graphical output commands into the correct places.[[/note]] If you cap a value to the actual limit of your variable, you can enforce the cap with a "did previous instruction overflow" test, which is usually faster than a "is X greater than Y" test (the latter often involves hidden subtraction, even on newer processors).
Is there an issue? Send a MessageReason:
None


* '''8 bits''' can hold a value as high as 255. The {{Atari 2600}} and [[{{Atari 7800}} 7800]], NintendoEntertainmentSystem, SegaMasterSystem, and early home computers were all 8-bit.

to:

* '''8 bits''' can hold a value as high as 255. The {{Atari 2600}} and [[{{Atari [[UsefulNotes/{{Atari 7800}} 7800]], NintendoEntertainmentSystem, SegaMasterSystem, and early home computers were all 8-bit.
Is there an issue? Send a MessageReason:
None



to:

* As a naming convention. Everything in a computer indexes, or starts, from position 0. For example, in an 8-bit number, bit 0 is the first bit. How does this make sense? Because if it's a 1, the value of the number is 2^0, or 1.
Is there an issue? Send a MessageReason:
None


* '''32 bits''' can hold a value as high as 4,294,967,295. The SegaSaturn and {{Dreamcast}}, Sony {{PlayStation}}, Microsoft {{XBox}} and the {{Wii}} are all 32-bit. So are desktop [=PCs=] from 1987 to 2007.

to:

* '''32 bits''' can hold a value as high as 4,294,967,295. The SegaSaturn and {{Dreamcast}}, Sony {{PlayStation}}, Microsoft {{XBox}} and the {{Wii}} are all 32-bit. So are desktop [=PCs=] from 1987 to 2007. Most smartphones are 32-bit, with 64-bit phones starting to trickle out in 2013 and 2014.
Is there an issue? Send a MessageReason:
None


So what happens if you try to store a number bigger than that? Say you were trying to add one to a 16-bit variable that's already set to 65,535. It would "wrap" - adding one to 65,535 would give you zero. Adding two would give you one. And so on, and so forth. The same goes the other way - subtracting one from zero gives you 65,535. When this happens, it's called "carry" if expected or "overflow" if not. This is the source of many GoodBadBugs; most of them are a case of programmer oversight, since the "overflow" flag in the CPU is triggered whenever this happens. Also see {{Cap}}. Programmers can handle numbers larger than the register size, but this causes the arithmetic operations to take longer, so this is usually avoided. This is how older 8-bit systems handled numbers larger than 255.

to:

So what happens if you try to store a number bigger than that? Say you were trying to add one to a 16-bit variable that's already set to 65,535. It would "wrap" - adding one to 65,535 would give you zero. Adding two would give you one. And so on, and so forth. The same goes the other way - subtracting one from zero gives you 65,535. When this happens, it's called "carry" if expected or "overflow" if not. This is the source of many GoodBadBugs; most of them are a case of programmer oversight, since the "overflow" flag in the CPU is triggered whenever this happens. Also see {{Cap}}. Programmers can handle numbers larger than the register size, but this causes the arithmetic operations to take longer, so this is usually avoided. This is how older 8-bit systems handled numbers larger than 255.
{{Cap}}.
Is there an issue? Send a MessageReason:
None


So what happens if you try to store a number bigger than that? Say you were trying to add one to a 16-bit variable that's already set to 65,535. It would "wrap" - adding one to 65,535 would give you zero. Adding two would give you one. And so on, and so forth. The same goes the other way - subtracting one from zero gives you 65,535. When this happens, it's called "carry" if expected or "overflow" if not. This is the source of many GoodBadBugs; most of them are a case of programmer oversight, since the "overflow" flag in the CPU is triggered whenever this happens. Also see {{Cap}}.

to:

So what happens if you try to store a number bigger than that? Say you were trying to add one to a 16-bit variable that's already set to 65,535. It would "wrap" - adding one to 65,535 would give you zero. Adding two would give you one. And so on, and so forth. The same goes the other way - subtracting one from zero gives you 65,535. When this happens, it's called "carry" if expected or "overflow" if not. This is the source of many GoodBadBugs; most of them are a case of programmer oversight, since the "overflow" flag in the CPU is triggered whenever this happens. Also see {{Cap}}.
{{Cap}}. Programmers can handle numbers larger than the register size, but this causes the arithmetic operations to take longer, so this is usually avoided. This is how older 8-bit systems handled numbers larger than 255.
Is there an issue? Send a MessageReason:
hottip cleanup


* As a {{Cap}}. Programming for older systems is really ''really'' hard; these systems were relatively good at graphics processing, but very bad at calculations, so every CPU cycle saved was a big deal.[[hottip:*:{{Atari 2600}} was hit the hardest: it had ''no'' {{VRAM}}, so programmers had to create the picture by timely manipulation of the graphic output registers, but as it also had no interrupt lines in the {{CPU}}, this was possible only by the careful timing of the program itself and inserting graphical output commands into the correct places.]] If you cap a value to the actual limit of your variable, you can enforce the cap with a "did previous instruction overflow" test, which is usually faster than a "is X greater than Y" test (the latter often involves hidden subtraction, even on newer processors).

to:

* As a {{Cap}}. Programming for older systems is really ''really'' hard; these systems were relatively good at graphics processing, but very bad at calculations, so every CPU cycle saved was a big deal.[[hottip:*:{{Atari [[note]]{{Atari 2600}} was hit the hardest: it had ''no'' {{VRAM}}, so programmers had to create the picture by timely manipulation of the graphic output registers, but as it also had no interrupt lines in the {{CPU}}, this was possible only by the careful timing of the program itself and inserting graphical output commands into the correct places.]] [[/note]] If you cap a value to the actual limit of your variable, you can enforce the cap with a "did previous instruction overflow" test, which is usually faster than a "is X greater than Y" test (the latter often involves hidden subtraction, even on newer processors).
Is there an issue? Send a MessageReason:
None

Added DiffLines:

Video games are nothing more than computer programs, and they're limited by the systems they run on. One particularly strict limitation is the fact that computers can't handle numbers of arbitrary size with any kind of efficiency. Since efficiency is normally pretty important for video games, this places some hard limits on the range of values they can work with. Since computers work in binary, that size has to be a certain number of bits (binary digits - a zero or a one). Numbers stored in a computer's memory are called ''variables''.

Computers also have a limit to the maximum size a variable can be. It's not a hard limit, but using bigger numbers slows down computation considerably. Whenever you hear about the "number of bits" of a video game console (i.e. the NintendoEntertainmentSystem being "8-bit"), that's what they're referring to. The NES has an 8-bit data bus; it can only move 8 bits of data around at a time. If it has to move any more, it has to do it in more than one cycle. In technical terms, this is called "word size."

In newer video games, many things - say, the number of items in the player's HyperspaceArsenal - are {{cap}}ped at reasonable limits because the variable actually used to store that value has a decidedly ''un''reasonable limit. However, in older days, it was common to let the computer itself cap these values, because the limits were a lot lower - an 8-bit computer such as the NES has a "limit" of 255.

The highest value you can store in a variable or register can be determined by the number of bits it uses. It's 2 to the power of the number of bits, minus 1 because we're counting from zero. Here's a handy table.

* '''8 bits''' can hold a value as high as 255. The {{Atari 2600}} and [[{{Atari 7800}} 7800]], NintendoEntertainmentSystem, SegaMasterSystem, and early home computers were all 8-bit.
* '''12 bits''' can hold a value as high as 4095. Some NES games like ''FinalFantasy'' used hacks to get values this large.
* '''16 bits''' can hold a value as high as 65,535. The SuperNintendoEntertainmentSystem and SegaGenesis were 16-bit, as were [=PCs=] in the mid 1980s, and a few Japanese gaming computers.
* '''32 bits''' can hold a value as high as 4,294,967,295. The SegaSaturn and {{Dreamcast}}, Sony {{PlayStation}}, Microsoft {{XBox}} and the {{Wii}} are all 32-bit. So are desktop [=PCs=] from 1987 to 2007.
* '''64 bits''' can hold a value as high as 18.4 quintillion (or 1.84×10[[superscript:19]]). The [[NintendoSixtyFour Nintendo 64]], GameCube[[note]]Although with some 32-bit components[[/note]], Sony [[PlayStationTwo PlayStation 2]], and modern desktop [=PCs=] are all 64-bit, with 64-bit operating systems becoming rather commonplace in 2010 (at least, on new computers).
* '''128 bits''' can hold a value as high as 340.2 undecillion (or 3.4×10[[superscript:38]]). Computers usually do not have 128-bit general-purpose registers, but the [[PlayStationThree PS3]]'s Cell, the X-Box 360's CPU and modern x64 [=CPUs=] (used both in [[IBMPersonalComputer [=PCs=]]] and [[AppleMacintosh Macs]]) do have 128-bit vector registers (holding 4 32-bit values). These are used for [[VectorUnit vector math]].

Note that in addition to the above, most recent processors have additional "vector" processors for dealing with multiple calculations in parallel; these have so far been up to 256 bits wide. Also floating point calculations are often done at different sizes.

So what happens if you try to store a number bigger than that? Say you were trying to add one to a 16-bit variable that's already set to 65,535. It would "wrap" - adding one to 65,535 would give you zero. Adding two would give you one. And so on, and so forth. The same goes the other way - subtracting one from zero gives you 65,535. When this happens, it's called "carry" if expected or "overflow" if not. This is the source of many GoodBadBugs; most of them are a case of programmer oversight, since the "overflow" flag in the CPU is triggered whenever this happens. Also see {{Cap}}.

However, that's not the end of the story. All of those values assume that the variable is unsigned, meaning it can't hold a negative number. Signed numbers essentially throw away one bit in order to be able to store both positive ''and'' negative numbers. Zero is taken to be the first "positive" number, while negative numbers start at -1, which makes the negative limit higher (absolutely speaking). This effectively reduces by half the maximum number that the value can hold for the sake of representing negative numbers. Here are some revised tables:

* '''8 bits''' can hold a value from -128 to 127.
* '''12 bits''' can hold a value from -2048 to 2047.
* '''16 bits''' can hold a value from -32,768 to 32,767.
* '''32 bits''' can hold a value from -2,147,483,648 to 2,147,483,647.

And so on.

It should be noted that although processors can work with variables of various sizes, they don't generally have to; a 64-bit processor can still work with 8-bit values. Thus, the limit of any given value could vary depending on the actual size of the variable used to store it. Smaller variables are often used to reduce the memory required for a game. If it's really necessary, most systems also have ways to represent numbers much ''larger'' than the hardware word size, potentially with millions of digits, but this is rarely needed in video games (and is ''significantly'' slower, too).

So that explains the numbers themselves. But what causes them to crop up in games? There are a few reasons these numbers show up:

* As a {{Cap}}. Programming for older systems is really ''really'' hard; these systems were relatively good at graphics processing, but very bad at calculations, so every CPU cycle saved was a big deal.[[hottip:*:{{Atari 2600}} was hit the hardest: it had ''no'' {{VRAM}}, so programmers had to create the picture by timely manipulation of the graphic output registers, but as it also had no interrupt lines in the {{CPU}}, this was possible only by the careful timing of the program itself and inserting graphical output commands into the correct places.]] If you cap a value to the actual limit of your variable, you can enforce the cap with a "did previous instruction overflow" test, which is usually faster than a "is X greater than Y" test (the latter often involves hidden subtraction, even on newer processors).
** Note that many games exhibit bugs due to ''not'' checking the overflow after addition. That is, there's a cap because once you cross the cap, something breaks or behaves strangely.
* To use shifts. Computers can multiply and divide by powers of two by using left- and right-shift operations. Shifts are much, ''much'' faster than multiplication or division, but only work for powers of two.
** Programmers in the early days found ways around that. Want to multiply by 9? Shift left three times and add on the original number. This trick is expanded upon and used by some modern processors.
*** It might backfire on modern processors as while multiplication takes a few cycles but the shifts would introduce data hazards and cause stall cycles. Hopefully the processor will implement out-of-order execution.
* Errors. Many function calls use -1 as an error code. If this value is not checked for, and then gets stored into an unsigned variable, it becomes the highest number the variable can hold (due to how "two's complement" signing works.)
* Divide By Zero. As a specific example of the above, some older systems would return the highest number the variable can hold as the result of division by zero (think of it as "infinity"). This is much more desirable than crashing when the player's save file is on the line.
** As of Divide By Zero for floating point numbers the behaviour is mandated by IEEE 754 (a standard of handling floating point numbers). Sometimes this makes things worse if it hides an error - instead of clear crash during test phase you have a potentially corrupted save file.
* For alignment purposes. For most purposes, data in memory has to be aligned to its size. For example, a one-byte (8-bit) value can be stored at any address, but a four-byte value must be stored on some platforms at an address that is a multiple of four. When game programmers used to map out memory used by the game, they would keep in mind this alignment requirement. Say a given block of memory is used to store player inventory, and each item in the inventory is a single byte. It makes sense to give the player a power of two items, since any value stored after it will have the same alignment as the start of the block.
* Reading in data for something it's not meant for. A very frequent source of GoodBadBugs in olden times was when data was loaded as something that it actually wasn't. For example, suppose something goes iffy in the code, and the game starts reading map data as if it were attack data. But map data is something very different from attack data. Perhaps the game uses the value FFFF (65535 in hexadecimal) to indicate the end of the map. This is a common value to use for this purpose (called a "terminal value" in programming jargon) because it's the ''last'' value two bytes can store, so it's easy to remember. (One FF by itself might be used for, say, the end of a room, or the end of a script that runs on that map.) If the code starts reading in a map as attack data, however, these values may end up anywhere. If FFFF were read in as the damage of an attack, for example, the attack would deal 65535 damage (possibly capped to 9999, of course).
* Because programmers have these numbers etched into their mind-- to a sufficiently binary-minded programmer, "256" (binary 100000000) is more of a round number than "300". Hence they show up for no reason at all.
** That's a part of the reasoning for the whole concept of "magic numbers" in engineering. When you are making something you need to decide on some properties (like plank size or ceiling height, for example) anyway, so why not use the ones that someone [[FollowTheLeader has already used before]]? And then it happens that the similar sizes allow for compatibility and interoperability, it becomes a self-reinforcing convention, and we all end up with 2-by-4-s. The same logic applies to the programming too.

Now, everything thus far has been about integers. If you want to store a fractional component, you have two choices:
* Fixed point. This means you're essentially taking your number and sticking the decimal point at a specific spot in that number. The point never moves around. On the plus side, these are very fast to work with. Note that the number is still in binary, so it's about halves and quarters and such, rather than the tenths and hundredths and such that decimals use.
* Floating point. This works like scientific notation; one bit is used to store the sign, some number of bits (called the mantissa) are used to store the number to the right of the decimal point, and the remaining bits (called the exponent) are, predictably, used to store the power of 2 to multiply by. (We use 2 instead of 10 because, again, computers work in binary.) It should be noted that this is a gross oversimplification.
----

Top