समय/संख्याएं
IEEE 754 फ़्लोट कनवर्टर
डेसिमल नंबर ↔ IEEE 754 बाइनरी रिप्रेजेंटेशन (सिंगल या डबल प्रिसीज़न) — साइन, एक्सपोनेंट, मैंटिसा, स्पेशल वैल्यू।
Computers store fractional numbers in binary under the IEEE 754 standard — a sign, an exponent, and a mantissa, packed into a fixed number of bits. This tool shows that representation for any decimal number and parses it back into a number.
How to use it
- Number → bits: enter a decimal number to get its breakdown into sign, exponent, and mantissa for single (32-bit) or double (64-bit) precision.
- Bits → number: paste a bit representation to get the decimal value back.
- Special values (infinity, NaN, signed zero) are recognized and explained separately.
Common uses
- Understanding why 0.1 + 0.2 doesn't exactly equal 0.3 in most programming languages — a concrete demonstration of rounding error.
- Studying float's internal representation to understand precision limits in financial or scientific calculations.
- Parsing a binary dump or network packet where numbers are transmitted in IEEE 754 format.
Things to keep in mind
Most decimal fractions (0.1, for example) have no exact binary representation — that's the root cause of the typical rounding errors seen in calculation results.
Comparing floating-point numbers for exact equality (===) is unreliable — check instead whether the difference is smaller than a small threshold (epsilon).
इस टूल के बारे में लेख: IEEE 754: कोड में 0.1 + 0.2, 0.3 के बराबर क्यों नहीं होता
अक्सर पूछे जाने वाले प्रश्न
सिंगल और डबल प्रिसिज़न में क्या अंतर है?
सिंगल प्रिसिज़न (float, 32 बिट) लगभग 7 दशमलव अंकों की सटीकता देती है, डबल (double, 64 बिट) लगभग 15-17। JavaScript का Number टाइप डबल प्रिसिज़न इस्तेमाल करता है।
कुछ दशमलव संख्याएं सटीकता क्यों खो देती हैं?
IEEE 754 संख्याओं को बाइनरी में स्टोर करता है, और कई दशमलव भिन्न (जैसे 0.1) का कोई सटीक सीमित बाइनरी प्रतिनिधित्व नहीं होता — इसलिए निकटतम संभव मान थोड़ी राउंडिंग त्रुटि के साथ स्टोर किया जाता है।
NaN, Infinity और -0 का क्या मतलब है?
NaN किसी अमान्य ऑपरेशन जैसे 0/0 का परिणाम है। Infinity/-Infinity तब दिखते हैं जब कोई मान प्रतिनिधित्व योग्य रेंज से आगे बढ़ जाए (जैसे 0 से भाग)। +0 और -0 साइन किए गए शून्य के दो अलग बिट प्रतिनिधित्व हैं, जो संख्या के रूप में फिर भी बराबर हैं।
सबनॉर्मल (डीनॉर्मलाइज़्ड) नंबर क्या होते हैं?
यह उन नंबरों के लिए एक ख़ास रिप्रेज़ेंटेशन मोड है जो सामान्य फ़ॉर्मैट के लिए मैग्निट्यूड में बहुत छोटे होते हैं — मैंटिसा का इम्प्लिसिट 1 हटा दिया जाता है, जिससे कुछ प्रिसीज़न खोकर धीरे-धीरे ज़ीरो के क़रीब पहुँचा जा सकता है।
सटीक बराबरी चेक करने के बजाय फ़्रैक्शनल नंबर की सही तुलना कैसे करें?
a === b के बजाय यह चेक करें कि दोनों नंबरों का अंतर एक छोटे थ्रेशोल्ड (एप्सिलॉन) से कम है या नहीं: Math.abs(a - b) < 1e-9। राउंडिंग एरर की वजह से सटीक बराबरी लगभग कभी गारंटीड नहीं होती।