Basic Computer Data Types YASH PAL, March 9, 2026March 9, 2026 Basic Computer Data Types – Computers operate fundamentally on fixed-size numbers called words, which are interpreted as integers, characters, floating-point numbers, bit sets, or memory addresses, then combined into larger aggregates. There are basically four Data types: Basic types: numbers, strings, and booleans. Aggregate types: arrays and structures. Reference types: pointers, slices, maps, functions, and channels. Interface types Integers In this, we provide both signed and unsigned integers for arithmetic operations. There are four distinct sizes of signed integers: 8, 16, 32, and 64 bits. They are represented by: Signed: int8, int16, int32 and int64. Unsigned: uint8, uint16, uint32, and uint64. There are also two types, int and uint, that are the natural or most efficient size for signed and unsigned integers on a particular platform. int is by far the most widely used numeric type. Both these types have the same size, either 32 or 64 bits. But one must not make assumptions about because different compilers may make different choices even on identical hardware. The type run is a synonym for int32 and conventionally indicates that a value is a Unicode point. The two names may be used interchangeably. The type byte is a synonym for uint8, and emphasizes that the value is a piece of raw data rather than a small numeric quantity. uintptr is an unsigned integer type whose width is not specified but is sufficient to hold all the bits of a pointer value. The uintptr type is used only for low-level programming, such as at the boundary of a Go program with a C library or an operating system. Floating-point Numbers There are two sizes of floating-point numbers, whose properties are governed by the IEEE 754 standard (implemented by all modern CPUs). The limits of floating-point values can be found in the math package. float32 The largest float 32 is the constant math.MaxFloat32, which is about 3.4e38. The smallest positive value is 1.4e-45. float64 The largest float64 is the constant math.MaxFloat64, which is about 1.8e308. The smallest positive value is 4.9e-324. Complex Numbers This provides two sizes of complex numbers, complex64 and complex128, whose components are float32 and float64, respectively. The built-in function complex creates a complex number from its real and imaginary components, and the built-in real and imag functions extract those components: var x complex128 = complex(1,2) // 1+2i var y complex128 = complex(3,4) // 3+4i fmt.Println(x*y) // "(-5+10i)" fmt.Println(real(x*y)) // "-5" fmt.Println(imag(x*y)) // "10" If a floating-point literal or decimal integer literal is immediately followed by i, such as 3.141592i or 2i, it becomes an imaginary literal, denoting a complex number with a zero real component; Booleans A value of type bool, or boolean, has only two possible values, true and false. The conditions in if and for statements are booleans Comparison operators (e.g., ==,<>) produce a boolean result. The unary operator ! is logical negation. For example, !true is false, or, (!true == false) == true. Redundant boolean expressions can be simplified, like x == true to x. Boolean values can be combined with the && (AND) and || (OR) operators, which have short-circuit behaviour: if the answer is already determined by the value of the left operand, the right operand is not evaluated, making it safe to write expressions like this- s != "" && s[0] == 'x' where s[0] would panic if applied to an empty string. Since && has higher precedence than || (mnemonic: && is boolean multiplication, || is boolean addition), no parentheses are required for conditions of this form. Strings A string is an immutable sequence of bytes. Strings may contain arbitrary data, including bytes with value 0, but usually they contain human-readable text. Text strings are conventionally interpreted as UTF-8-encoded sequences of Unicode code points. The built-in len function returns the number of bytes (not runes) in a string, and the index operation s[i] retrieves the i-th byte of string s, where 0 = i < len(s). s:= "hello, world" fmt.Println(len(s)) // "12" fmt.Println(s[0], s[7]) // "104 119" ('h' and 'w') In the above code, s[0] and s[7] are of the uint8 type. Range of data types Dat TypeBytesData RangeRemarkschar1ASCII – 128 to 127unsigned char1ASCII 0 to 255including high ASCII charsint2-32768 to 32767Integerunsigned (unsigned int)20 to 65535non-negative integerlong int4± 2 billionsdouble-sized integerunsigned long int40 to 4 billionnon-negative long integerfloat43.4±e386 significant digitsdouble81.7±e30815 significant digitsRange of data types There are basically four types of number systems: Binary Number System: A binary number system has only two digits, which are 0 and 1. Every number (value) represents with 0 and 1 in this number system. The base of the binary number system is 2, because it has only two digits. Decimal Number System: The decimal number system has only ten (10) digits from 0 to 9. Every number (value) represents with 0,1,2,3,4,5,6,7,8 and 9 in this number system. The base of the decimal number system is 10, because it has only 10 digits. Octal number system: The octal number system has only eight (8) digits from 0 to 7. Every number (value) represents with 0,1,2,3,4,5,6 and 7 in this number system. The base of the octal number system is 8, because it has only 8 digits. Hexadecimal number system: A Hexadecimal number system has sixteen (16) alphanumeric values from 0 to 9 and A to F. Every number (value) represents with 0,1,2,3,4,5,6,7,8,9, A, B, C, D, E and F in this number system. The base of the hexadecimal system is 16, because it has 16 alphanumeric values. Here, A is 10, B is 11, C is 12, D is 13, E is 14, and F is 15. Number systemBaseUsed digitsExampleBinary20,1(11110000)2Octal80,1,2,3,4,5,6,7,8,9, A, B, C, D, E, F(360)8Decimal100,1,2,3,4,5,6,7,8,9(240)10Hexadecimal160,1,2,3,4,5,6,7,8,9, A, B, C, D, E, F(F0)16Number System Computer System Architecture engineering subjects Computer System Architecture