numeric
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| numeric [2025/02/27 17:33] – created carl | numeric [2026/03/14 21:01] (current) – carl | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Numeric Types ====== | ====== Numeric Types ====== | ||
| + | Numeric types represent [[https:// | ||
| Math in a computer is a combination of a storage of data, and a collection of operators. | Math in a computer is a combination of a storage of data, and a collection of operators. | ||
| Line 7: | Line 8: | ||
| * Signed Integer (32 bits) - These usually have fast support in the processor. | * Signed Integer (32 bits) - These usually have fast support in the processor. | ||
| - | * Two's Complement - Represents Numbers as a string of bits. Bit Vector addition results in (xor(N) + 1) + N = 0 | + | * Two's Complement - Represents Numbers as a string of bits. Bit Vector addition results in (inv(N) + 1) + N = 0 |
| - | * One's Complement - Represents Numbers as a string of bits. Bit Vector addition results in (xor(N)) + N = 0 | + | * One's Complement - Represents Numbers as a string of bits. Bit Vector addition results in (inv(N)) + N = 0 |
| * Signed Magnitude - Represents Numbers as one bit for the sign, and the remaining as an unsigned magnitude. N = (-1)^S x M | * Signed Magnitude - Represents Numbers as one bit for the sign, and the remaining as an unsigned magnitude. N = (-1)^S x M | ||
| * Signed Integer (8 bits) - Sometimes called a byte. Sometimes called an octet in the context of networking. | * Signed Integer (8 bits) - Sometimes called a byte. Sometimes called an octet in the context of networking. | ||
| Line 33: | Line 34: | ||
| + | As a consequence of their representation, | ||
| + | |||
| + | |||
| + | ===== Support in Languages ===== | ||
| + | |||
| + | ==== Java ==== | ||
| + | Main: [[java: | ||
| + | |||
| + | |||
| + | |||
| + | ===== Numeric Observations ===== | ||
| + | |||
| + | When dividing two quantities, the quotient and the remainder have different units. | ||
| + | |||
| + | The units may be different too. Consider calculating the quotient and remainder of 10 meters in 3 seconds. | ||
| + | |||
| + | A = 10 meters | ||
| + | |||
| + | B = 3 seconds | ||
| + | |||
| + | Q = floor(A / B) | ||
| + | |||
| + | R = A % B | ||
| + | |||
| + | This maintains the identity A = Q * B + R. Thus: | ||
| + | |||
| + | Q = 3 meters/ | ||
| + | |||
| + | R = 1 meter | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | ===== Taylor Series ===== | ||
| + | The Taylor Series for the exponential function diverges quickly if less than 100 terms are used. These terms tend to have enormous numerators and denominators. | ||
numeric.1740677628.txt.gz · Last modified: by carl
