Foundationপ্রথম নীতি থেকে
LEVEL 1 · How Computers Represent Information

Floating-Point

ফ্লোটিং পয়েন্ট

sign × significand × 2^exponent — scientific notation-এর বাইনারি সংস্করণ, radix point exponent দিয়ে 'ভাসে' যাতে একই bit বাজেটে খুব ছোট আর খুব বড় সংখ্যা দুটোই ধরা যায়।

also: float, fp, floating point

value=(1)sign×significand×2exponent\text{value} = (-1)^{\text{sign}} \times \text{significand} \times 2^{\text{exponent}}

স্কুলের 6.022 \times 10^{23}-এর সাথে গঠন অভিন্ন — শুধু base 10-এর বদলে 2, আর 6.022 (precision) বনাম 23 (magnitude) আলাদা bit-field-এ থাকে।

Fixed-point-এর সাথে পার্থক্য: fixed-point-এ radix point একটা স্থির bit position-এ পেরেক মারা (যেমন Q16.16), scale factor compile-time-এ ঠিক করা — range সীমিত কিন্তু predictable। Floating-point-এ exponent field radix point-কে “ভাসিয়ে” dynamic range দেয়, কিন্তু precision magnitude-নির্ভর হয়ে যায় — বড় সংখ্যায় consecutive representable মানের ফাঁক বড়, ছোট সংখ্যায় ছোট।

১৯৮৫-এর আগে বিশৃঙ্খলা: IBM hex float, DEC VAX float, Cray float — প্রতিটা vendor-এর নিজস্ব ভিন্ন scheme, portability প্রায় অসম্ভব। [[ieee-754]] (Intel 8087-এর জন্য William Kahan-এর নেতৃত্বে ডিজাইন) একটাই সার্বজনীন উত্তর দিল।

আজ JavaScript-এর একমাত্র number type IEEE 754 double — Number.MAX_SAFE_INTEGER = 2^{53}-1 সরাসরি ৫২-বিট mantissa + implicit বিট থেকে আসে।