ฐาน เครื่องแปลง

แปลงระหว่างฐานตัวเลขต่างๆ รวมถึงเลขฐานสอง, ฐานแปด, ฐานสิบ และฐานสิบหก

การแปลงฐาน
เลือกตัวเลขและฐานที่จะแปลง

ตัวเลข(10) ไบนารี (ฐาน 2)

อักขระที่ใช้ได้

ฐาน 2-10

0, 1, 2, 3, 4, 5, 6, 7, 8, 9

ฐาน 11-36

0-9, A-Z (A=10, B=11, ..., Z=35)

ระบบฐานตัวเลข

ไบนารี (ฐาน 2)

อักขระ: 0, 1

ภาษาพื้นฐานของคอมพิวเตอร์

เช่น 1010₂ = 10₁₀

ฐานแปด (ฐาน 8)

อักขระ: 0-7

ใช้ในการอนุญาตของ Unix

เช่น 12₈ = 10₁₀

ทศนิยม (ฐาน 10)

อักขระ: 0-9

ใช้ในชีวิตประจำวัน

เช่น 10₁₀

เลขฐานสิบหก (ฐาน 16)

อักขระ: 0-9, A-F

รหัสสี, ที่อยู่หน่วยความจำ

เช่น A₁₆ = 10₁₀

วิธีการแปลง

ฐานอื่น → ทศนิยม: คูณแต่ละหลักด้วยกำลังที่สอดคล้องกันของฐานแล้วรวมกัน

ทศนิยม → ฐานอื่น: หารด้วยฐานเป้าหมายและจัดเรียงเศษที่เหลือในลำดับย้อนกลับ

ประวัติของระบบตัวเลขและการประยุกต์ใช้ในวิทยาการคอมพิวเตอร์

การพัฒนาทางประวัติศาสตร์ของระบบตัวเลข

ระบบตัวเลขได้พัฒนาควบคู่ไปกับอารยธรรมของมนุษย์ ตั้งแต่ฐาน 60 ของบาบิโลนโบราณ, ฐาน 20 ของมายา, ไปจนถึงระบบทศนิยมในปัจจุบัน แต่ละอารยธรรมได้พัฒนาระบบตัวเลขที่เหมาะสมกับความต้องการของตน

ระบบตัวเลขของอารยธรรมโบราณ

  • บาบิโลนฐาน 60: ต้นกำเนิดของการวัดเวลาและมุม
  • อียิปต์ทศนิยม: ระบบตัวเลขแบบอักษรอียิปต์โบราณ
  • มายาฐาน 20: อิงจากนิ้วมือและนิ้วเท้า
  • ตัวเลขโรมัน: ระบบสัญกรณ์แบบบวก

การประยุกต์ใช้ระบบตัวเลขสมัยใหม่

  • ทศนิยม: มาตรฐานสำหรับชีวิตประจำวัน
  • ไบนารี: ภาษาพื้นฐานของคอมพิวเตอร์
  • เลขฐานสิบหก: การเขียนโปรแกรมและที่อยู่หน่วยความจำ
  • ฐานแปด: ระบบการอนุญาตของ Unix

จำนวน Systems in Computer Science

Binary (ฐาน 2)

Principle: Uses only 0 and 1

Usage: CPU, memory, logic circuits

Advantage: Easy to implement with electrical signals

ตัวอย่าง: 1010₂ = 10₁₀

Applications: Digital communication, data storage

Hexadecimal (ฐาน 16)

Principle: Uses 0-9, A-F

Usage: Memory addresses, สี codes

Advantage: Compact representation of binary

ตัวอย่าง: FF₁₆ = 255₁₀

Applications: Web development, system programming

Octal (ฐาน 8)

Principle: Uses 0-7

Usage: Unix ไฟล์ permissions

Advantage: Groups 3 bits together

ตัวอย่าง: 755₈ = 493₁₀

Applications: System administration, security การตั้งค่า

จำนวน Systems in Programming

Real-world ตัวอย่าง

สี codes: #FF0000 (red)

Memory ที่อยู่: 0x7FFF5FBFF5B0

ไฟล์ permissions: chmod 755 (rwxr-xr-x)

Bit operations: 0b1010 & 0b1100

Network: IP ที่อยู่ subnet masks

Debugging and Optimization

Memory dump: ตรวจสอบ memory contents in hexadecimal

Bit flags: Manage states in binary

Hash values: Express checksums in hexadecimal

Encryption: ประมวลผล bytes in hexadecimal

Compression: Manipulate data at bit level

Mathematical Principles of ฐาน Conversion

Positional Notation

The ค่า of each digit is determined by powers of the ฐาน.

1234₁₀ = 1×10³ + 2×10² + 3×10¹ + 4×10⁰
1010₂ = 1×2³ + 0×2² + 1×2¹ + 0×2⁰ = 10₁₀

Conversion Algorithms

ทศนิยม → n-ฐาน

  1. 1. Divide ทศนิยม by n
  2. 2. Record remainder
  3. 3. Repeat until quotient is 0
  4. 4. Arrange remainders in reverse order

n-ฐาน → ทศนิยม

  1. 1. Multiply each digit by power of ฐาน
  2. 2. ผลรวม all values
  3. 3. ผลลัพธ์ is ทศนิยม ค่า

Practical Applications of จำนวน Systems

Web Development

  • CSS สี codes (#RGB, #RRGGBB)
  • URL encoding (%20, %3A, etc.)
  • Base64 encoding (อีเมล, images)
  • Unicode บุคลิก codes (U+0041)

System Management

  • ไฟล์ permission การตั้งค่า (chmod 755)
  • Network configuration (subnet masks)
  • Memory ที่อยู่ analysis
  • Log ไฟล์ analysis

💻 Practical เคล็ดลับ

  • Developer เครื่องมือ: You can directly ตรวจสอบ hexadecimal สี codes in เบราว์เซอร์ developer เครื่องมือ.
  • เครื่องคำนวณ Usage: Use programmer calculators for easy ฐาน conversion.
  • Bit Operations: Understanding binary helps you use bit operators (&, |, ^, ~) effectively.
  • Memory Optimization: Understanding จำนวน systems helps optimize memory usage.