Friday, 12 January 2018

फ्लोटिंग प्वाइंट - संख्या - में - बाइनरी - विकल्प


उन्नत बाइनरी। मध्यवर्ती उन्नत या मास्टर ट्यूटोरियल में बहुत अधिक पढ़ने से पहले, बाइनरी की मूल बातें देखना सुनिश्चित करें, यदि आप इसे नहीं जानते हैं, तो यह भ्रम पैदा कर सकता है। उन्नत बाइनरी अवधारणा, फ़्लोटिंग पॉइंट शुरुआत से ही प्रोग्रामिंग का हिस्सा हैं, लेकिन कंप्यूटर दशमलव दशमलव संख्याओं को मशीन कोड में कैसे अनुवादित करता है। इस ट्यूटोरियल में, मैं समझाऊंगा कि फ़्लोटिंग प्वाइंट सिस्टम क्या है, इसका उपयोग कैसे किया जाता है और एक कंप्यूटर द्विआधारी में दशमलव संख्या का अनुवाद कैसे करता है। फ्लोटिंग पॉइंट्स का प्रयोग ज्यादातर प्रत्येक कार्यक्रम में होता है या प्रोग्रामिंग भाषा, यह दशकों के भंडारण के सबसे सटीक और कुशल तरीकों में से एक है। इस ट्यूटोरियल के बाद, आप समझ सकते हैं कि एक फ़्लोटिंग पॉइंट की संरचना क्या है और आप अन्य एपीआई कैसे इस्तेमाल कर सकते हैं जो आपको अपना सटीक अस्थायी बनाने की अनुमति देता है अंक। एक फ़्लोटिंग प्वाइंट को ज्यादातर फ्लोट या डबल के रूप में जाना जाता है, ज्यादातर भाषाओं में डबल या दोहरी सटीक फ़्लोटिंग पॉइंट का इस्तेमाल होता है क्योंकि यह एक व्यापक रेंज प्रदान करता है और एक से बेहतर सटीकता प्रदान करता है फ्लोट या एक सटीक फ़्लोटिंग प्वाइंट कुछ भाषाएं और एपीआई आपको बड़े फ्लोटिंग पॉइंट्स बनाने, या यहां तक ​​कि छोटे के लिए भी प्रदान करते हैं यह आपको दशमलव और सटीकता को संशोधित करने की अनुमति देता है सबसे प्रसिद्ध फ्लोटिंग पॉइंट 16 बिट्स हैं, 32 बीट सिंगल, 64 बीट्स डबल, 128 बिट चौगुना, 256 बिट्स ऑक्टक्ले। सभी फ़्लोटिंग पॉइंट्स में एक समान संरचना है, जो कि 0 या 1 का चिन्ह है, जो कंप्यूटर को बताता है कि दशमलव नकारात्मक है या नहीं, जो एक्सपोनेंट कंप्यूटर को बताता है जो 2 के एक्सपोनेंट का उपयोग किया जाता है और मैन्टिसा जो कंप्यूटर को मान बताता है हर प्रकार का एक्सपोनेंट और मैन्टिसा के लिए अलग-अलग है, लेकिन निश्चित रूप से साइन बिट एक ही रहता है, क्योंकि यह एक बूलियन है। एक्सपेनेंट और मैन्टासा अवधारणा। मंटिसा और एक्सपोनेंट अक्सर देखा जाता है विज्ञान, रसायन विज्ञान, भौतिक विज्ञान और जीव विज्ञान जैसे इसे अक्सर वैज्ञानिक संकेतन के रूप में जाना जाता है, जहां आपने पहली संख्या डाल दी है जो पहले नहीं है और मूल्य के अनुरूप एक्सपोनेंट को समायोजित करता है। उदाहरण के लिए, 15 15 1 के रूप में लिखा जाएगा, 15 के रूप में 1 5 10 1 के रूप में लिखा जाएगा इन मामलों में, मंटिसा 1 है 5 और एक्सपोनेंट या तो -1 या 1 हो जाएगा। लेकिन बाइनरी अलग तरीके से काम करता है, क्योंकि इसमें केवल 2 विकल्प हैं, इस मामले में, यदि आपके पास 1 0101 2 है 3, पहला 1 वास्तव में कोई बात नहीं करता है क्योंकि आप चाहते हैं कि पहले नंबर 0 न हो, तो यह हमेशा 1 होगा। इस मामले में, मैन्टासा 0101 होगी और एक्सपोनेंट 3 होगा बेशक 1 0101 2 3 1010 1, जिसका अनुवाद 2 3 2 1 2 -1 8 2 0 5 10 5. दशमलव में अस्थायी बिंदु को परिवर्तित करने के लिए आप 3 अलग-अलग दृष्टिकोणों का उपयोग कर सकते हैं, तार्किक दृष्टिकोण, गणितीय दृष्टिकोण और प्रोग्रामर दृष्टिकोण तार्किक दृष्टिकोण है एक कैलकुलेटर या आपके साथ एक कंप्यूटर के बिना यह करने का तरीका, गणितीय तरीके से इसे सिर्फ एक फार्मूला भरना है और प्रोग्रामर तरीके से एक एल्गोरिथम को चलाने के लिए है। तार्किक तरीका है, अगर आप हमारी दशमलव प्रणाली के बारे में सोचते हैं, हम यह ध्यान देने के लिए एक डॉट का उपयोग करते हैं कि प्रतिपादक 1 9 1 1 9 10 0 3 10 -1 1 10 -2 तो नकारात्मक बनना शुरू हो रहा है बीच में दशमलव के साथ एक दशमलव का मतलब होगा, लेकिन सिर्फ 2 के आधार के साथ। यह बताएं कि 11 01 अर्द्ध बाइनरी में क्या होगा। अब, 11 01 को एक असली बाइनरी संख्या में बदलने के लिए, आपको इसका अनुवाद करना होगा वैज्ञानिक संकेतन, इस मामले में 1 101 2 1 जो 1 के एक एक्सपोनेंट और 101 का मैन्टिसा बनायेगा हम भी साइन बिट जानते हैं, जो 0 है, क्योंकि यह नकारात्मक संख्या है। तय करने के लिए अंतिम बात यह है कि मैंटिसा और यदि आप दोहरे उपयोग कर रहे हैं तो एक्सपोनेंट, यदि आप इस उदाहरण की तरह, आपके पास 11 बिट्स का एक एक्सपोनेंट और 52 बीट्स का मंटिसा है। इस संख्या का एक्सपोनेंट सिर्फ 1 नहीं है, इसका कारण यह है कि एक्सपोनेंट का आधा नकारात्मक मूल्य के लिए आरक्षित है यह तब होता है जब आप एक्सपोनेंटबिट-1 -1 को एक्सपोनेंट से पहले जोड़ते हैं, तो यह 1 2 11-1 -1 0 2 10 1024 100 0000 0000 हो जाएगा, जो कि आधे से एक्सपोनेंट का मान नकारात्मक एक्सपोनेंट, 1023 011 1111 1111 द्वारा एक्सपोनेंट के रूप में आरक्षित है 2 0 1022 011 1111 1110 जा रहा है 2 -1, etc. Fi nally, mantissa को 52 बिट की आवश्यकता होती है, इसलिए हमारे लिए mantissa 101 नहीं होगा, लेकिन यह 101 4 9 एस ओ होगा। अब आप अंतिम प्रतिपादक और मैन्टिसा को एक साथ हस्ताक्षर के रूप में हस्ताक्षर के रूप में 1, 100 0000 0000 एक्सपोनेंट और 101 49 शून्य के रूप में mantissa 1100 0000 0000 1010 48 शून्य एस, या सी 0 0 00 0 00 00 00 00. सूत्रों में तर्क के साथ रूपांतरण की स्थापना, हम कुछ फ़ार्मुलों को परिभाषित कर सकते हैं। हम एक जोड़े को जोड़कर गणितीय रूपांतरण को बढ़ा सकते हैं। bitwise ऑपरेटरों का Java. public स्थिर बाइट मिलता है मंथिसा डबल डी सार्वजनिक स्थिर बाइट मिलता है मंटिसा फ्लोट एफ सार्वजनिक स्थिर बाइट मिलना एक्सपेंटेंट डबल डी पब्लिक स्टेटिक बाइट मिलना एक्सपोजेंट फ्लोट एफ सार्वजनिक स्थिर लंबे समय के रूप में लंबे डबल डी बाइट ई प्राप्त एक्सपेनेंट डी बाइट एम getMantissa डी बाइट बिट बाइट एम 1 लंबी मूल्य डी। उन्नत बाइनरी के बारे में अधिक जानने के लिए यहां क्लिक करें। ASCII द्विआधारी फ्लोटिंग प्वाइंट को एक सदिश प्रोसेसर यूएस 8392489 B2 पर दशमलव वास्तविक संख्याओं में परिवर्तित करने के लिए यहां क्लिक करें। एएससीआईआई प्रारूप में एक दशमलव वास्तविक संख्या को दशमलव दशमलव संख्या में परिवर्तित करने के लिए एक प्रणाली, विधि और उपकरण। एक वेक्टर प्रोसेसर में फ़्लोटिंग बिंदु बाइनरी दशमलव स्वरूप में वर्णित हैं, एक शाखाहीन तरीके से रूपांतरण की कार्यक्षमता और निरंतर-समय में ASCII स्ट्रिंग के आकार की परवाह किए बिना, दिए गए आकारों में सदिश प्रोसेसर आर्किटेक्चर विधि वेक्टर प्रोसेसर के सिंगल निर्देश एकाधिक डेटा SIMD सुविधा का लाभ ले सकता है, हालांकि यह एक एकल निर्देश के लिए प्रतिबंधित नहीं है। 1.1 एक एल्गोरिथम विधि जो कि एक एएससीआईआई स्ट्रिंग के वास्तविक निरपेक्ष समय के रूपांतरण के लिए एक एल्गोरिथम विधि है, जो कि वेक्टर प्रोसेसिंग आर्किटेक्चर द्वारा प्रदान किए गए रजिस्टरों के बाइट आकार के बराबर या उससे कम के बराबर है, वास्तविक संख्या में एक साइन बाइट, एक पूर्णांक भाग, एक अंश अंश, आभासी भाग से पूर्णांक भाग को विभाजित करने वाला एक दशमलव बिंदु, और एक स्ट्रिंग टर्मिनेटर, जो कि वेक्टर प्रोसेसिंग आर्किटेक्चर वाले वेक्टर प्रोसेसर पर एएससीआईआई स्ट्रिंग असली संख्या का बाइनरी फ़्लोटिंग बिंदु असली संख्या का प्रतिनिधित्व है, ने कहा कि बाइनरी फ़्लोटिंग एएससीआईआई स्ट्रिंग असली संख्या के क्रम में क्रमशः एएससीआईआई स्ट्रिंग असली संख्या का प्रतिनिधित्व करता है जिसमें सकारात्मक या नकारात्मक बायनरी वेक्टर वैल्यू होता है, जो कि सकारात्मक या नकारात्मक साइन बाइट के बराबर होती है, और एक पूर्णांक भाग के साथ एक परिमाण और दशमलव के साथ एक अंश फ्लेक्शनल भाग से पूर्णांक भाग को अलग करते हुए कहते हैं, जिसमें तयशुदा कोड शामिल है, जिसमें कार्यान्वयन शामिल है रूपांतरण के एक या एक से अधिक चरणों को निष्पादित करने के लिए निरंतर संख्या में निर्देशों का अनुक्रम, कहा गया है कि इस मूल्य को संचित करने के लिए, संकेत बाइट का पता लगाने, एक प्लस या माइनस 1 मान निर्दिष्ट करना, सकारात्मक या नकारात्मक होने पर हस्ताक्षर पर निर्भर होना चाहिए। सदिश प्रोसेसर के एक रजिस्टर में, और स्ट्रिंग टर्मिनेटर के एएससीआईआई स्ट्रिंग असली संख्या का पता लगाने से साइन बाइट को निकालते हुए स्ट्रिंग को एक सदिश प्रोसेसर रजिस्टर के किनारे तक संरेखित करते हुए बाइट चौड़ाई के बराबर या उसमें वर्णों की संख्या से अधिक एएससीआईआई स्ट्रिंग असली संख्या और, यदि रजिस्टर में एएससीआईआई स्ट्रिंग असली संख्या में वर्णों की संख्या की तुलना में अधिक बाइट चौड़ाई है, तो सभी अप्रयुक्त वर्णों को विपरीत किनारों से शून्य के किनारों के साथ मुखौटा बनाना, जिसके परिणामस्वरूप एक या एक से अधिक प्रमुख या अनुक्रमित शून्य वेक्टर प्रोसेसर के एक रजिस्टर में डिटेक्शन और संचय करना दशमलव बिंदु की स्थिति है जो आंशिक भाग से एएससीआईआई स्ट्रिंग असली संख्या के पूर्णांक भाग को अलग करता है o एएससीआईआई स्ट्रिंग असली संख्या और एएससीआईआई स्ट्रिंग असली संख्या से दशमलव बिंदु को हटाने, अहस्ताक्षरित स्ट्रिंग के सभी एक या एक से अधिक अक्षरों का समानांतर रूपांतरण नहीं, कोई दशमलव बिंदु के साथ, संबंधित द्विआधारी कोडित दशमलव बाइट्स में बाइनरी असली नंबर बनाने के लिए एक या अधिक बाइट्स, जिसमें एक या अधिक बाइट्स की संख्या अक्षरों की संख्या के साथ अक्षरों की संख्या से मेल खाती है, प्रत्येक द्विपदीय कोडित दशमलव मूल्यों में से प्रत्येक की नियुक्ति के अनुसार दस की शक्ति के साथ द्विआधारी कोडित दशमलव मूल्यों के बिना दशमलव बिंदु के समानांतर गुणांक से मेल खाती है बाइनरी वास्तविक संख्या में द्विआधारी कोडित दशमलव मूल्यों को व्यक्तिगत द्विआधारी परिणाम प्राप्त करने के लिए समानांतर गुणा के व्यक्तिगत द्विआधारी परिणामों का एक प्रथम मध्यवर्ती द्विआधारी परिणाम में पहली मध्यवर्ती द्विआधारी परिणाम का गुणन दस की एक अस्थायी बिंदु शक्ति के साथ होता है जिसमें से एक स्थान के लिए एक स्थान की इसी दूसरे मध्यवर्ती द्विआधारी परिणाम प्राप्त करने और दूसरे मध्यवर्ती के गुणन प्राप्त करने के लिए दशमलव बिंदु अंतिम हस्ताक्षरित फ्लोटिंग बिंदु द्विआधारी परिणाम प्राप्त करने के लिए हस्ताक्षरित द्विआधारी मान के साथ द्विआधारी परिणाम। वर्तमान आविष्कार एक सदिश प्रोसेसर में संख्यात्मक डेटा के रूपांतरण से संबंधित है। सूचना इंटरचेंज के लिए अमेरिकी मानक कोड ASCII को द्विआधारी फ्लोटिंग प्वाइंट प्रारूप रूपांतरण का दशमलव वास्तविक संख्याएं वित्तीय सेवाओं-ट्रेडिंग डाटा प्रोसेसिंग जैसे अनुप्रयोगों के लिए एक सामान्य कार्य है कॉमोडिटी माइक्रोप्रोसेसरों वास्तविक संख्या के अलग-अलग अंकों के पुनरावृत्त द्वारा इस समस्या को संभालते हैं और आंशिक परिणाम जमा करते हैं, जब तक कि दशमलव बिंदु सीमांकक वर्ण या स्ट्रिंग सीमांकक वर्ण नहीं मिलते , जो प्रक्रिया को समाप्त करता है क्योंकि संख्याएं, जब एएससीआईआई प्रारूप में व्यक्त की जाती हैं, मनमाना लंबाई को मान सकते हैं, पारंपरिक एल्गोरिथम समस्या का समाधान एक समय में सीधे स्ट्रिंग की लंबाई की तुलना में आनुपातिक होता है, और उत्पन्न कोड में कई शाखाएं होती हैं, जो कई आधुनिक प्रसंस्करण आर्किटेक्चर पर गंभीर विलंबता दंड का कारण बनता है। विधि एएससीआईआई से बायनेरी फ्लोटिंग पॉइंट को एक प्रोसेसर के भीतर बदलने के लिए ये विधियां ज्ञात हैं इन विधियों में एएससीआईआई स्ट्रिंग में वास्तविक संख्या की शुरुआत, समापन, हस्ताक्षर और दशमलव बिंदु स्थिति की पहचान करना शामिल है, जिससे दशमलव अंक निकाले जाते हैं, प्रत्येक एएससीआईआई वास्तविक संख्या के सात बिट घटकों का, एक समय में एक अक्षर, और द्विआधारी संख्या को घटाकर, चालीस आठ, दशमलव संख्या को प्राप्त करने के लिए जो वास्तविक संख्या बनाते हैं, तब वास्तविक संख्या के दशमलव घटकों में से प्रत्येक गुणा किया जाता है कम से कम महत्वपूर्ण अंक के बाईं ओर अंकों के लिए, कम से कम महत्वपूर्ण अंक, दस से पहली शक्ति, या दस के लिए, दस की शक्ति से दस की शक्ति से, शून्य शक्ति या एक के साथ, यदि लागू हो, दस से पिछली संख्या के बाईं ओर अंकों के लिए दूसरी शक्ति या सौ सौ अंक, यदि लागू हो, तो आदि। यह वास्तविक संख्या के साथ-साथ और अधिक महत्वपूर्ण अंक वाले कई अंकों के लिए दोहराया जाता है। इनमें से प्रत्येक उत्पाद तब जमा हो जाती है और हस्ताक्षर जोड़ा गया, जिसके परिणामस्वरूप द्विआधारी दशमलव रूपांतरित संख्या में इस संख्या को संसाधित करने के लिए, एक संख्या को एक अस्थायी बिंदु प्रारूप में संसाधित करने के लिए, दशमलव बिंदु के लिए ऊपर की पहचान की स्थिति को बाईं ओर स्थानांतरित कर दिया जाता है, जब तक कि केवल एक शून्य शून्य अंक शेष बाईं ओर रहता है दशमलव बिंदु स्थिति यह सामान्यकरण कहा जाता है इस बदलाव के अनुरूप, स्थानांतरित पोजीशन की संख्या को नोट किया जाता है ताकि दशमलव संख्या के बाद एक गैर-शून्य अंक की परिणामी संख्या के बाद, उसके बाद के अंश को रेडिक्स द्वारा बढ़ाया जा सकेगा जो कि सत्ता में उठे दशमलव बिंदु शिफ्ट की संख्या का अंतिम निलंबन बिंदु निचला है, वास्तविक संख्या या मंथिसा, और अंश, या एक्सपोनेंट. इस तकनीक के साथ एक समस्या ये है, क्योंकि यह पुनरावृत्त है, रूपांतरण के लिए समय भिन्न होगा, एएससीआईआई वास्तविक संख्या स्ट्रिंग के आकार के रूप में लंबे समय तक बनना एक और समस्या यह है कि रूपांतरण फ़ंक्शन करने के लिए कोड में शाखाएं और कई निर्देशों का इस्तेमाल होता है विलंबता के मुद्दों की वजह से रूपांतरण का निष्पादन समय और दक्षता। ऊपर प्रस्तुत समस्याओं से मुकाबला करने के लिए, आविष्कार एक प्रणाली, कोड और एक एल्गोरिथम विधि प्रदान करता है जिसका उद्देश्य समानांतर प्रसंस्करण प्रकृति का शोषण करके शाखाहीन निरंतर-समय प्रारूप रूपांतरण का कार्य करता है। आधुनिक एकल अनुदेश कई डेटा सूचना, सिम, सदिश प्रसंस्करण आर्किटेक्चर लाभ का निष्पादन समय की काफी अधिक अनुमानित क्षमता है, और मॉडेम वेक्टर प्रोसेसर पर उच्च प्रदर्शन, जो खराब कार्यक्रम प्रवाह नियंत्रण को खराब करता है अतिरिक्त अनुमानन क्षमता और प्रदर्शन विधि को अधिक उपयुक्त बनाते हैं वेक्टर प्रोसेसर के आधार पर उच्च प्रदर्शन डेटा प्रोसेसिंग अनुप्रयोगों में पारंपरिक लोगों की तुलना में और सॉफ्ट रीयल-टाइम सिस्टम में। यह एक वेक्टर प्रोसेसर आर्किटेक्चर, कोड का चयन प्रदान करने के लिए इस आविष्कार का एक और उद्देश्य है, और एक हस्ताक्षरित ASCII वास्तविक संख्या किसी भी आकार के हस्ताक्षर किए, फ्लोटिंग बिंदु, द्विआधारी दशमलव में सदिश प्रोसेसर में वास्तविक संख्या जिसमें वेरक्टर प्रोसेसर आर्किटेक्चर द्वारा दिए गए आकारों के भीतर एएससीआईआई वास्तविक संख्या के आकार की परवाह किए बिना रूपांतरण समय स्थिर रहेगा। इन उद्देश्यों को प्राप्त करने के लिए, सिस्टम कोड का उपयोग करता है, जो निष्पादित होने पर, एएससीआईआई स्ट्रिंग असली संख्या के शाखाहीन निरंतर-समय रूपांतरण करने के लिए एक एल्गोरिथम विधि के एक या अधिक चरणों को लागू करता है, वास्तविक संख्या में एक साइन बाइट, एक पूर्णांक भाग, एक आंशिक भाग, आंशिक भाग से पूर्णांक भाग को विभाजित करने वाला दशमलव अंक , और एक स्ट्रिंग टर्मिनेटर, जो एक वेक्टर प्रोसेसर पर द्विआधारी दशमलव फ्लोटिंग बिंदु असली संख्या का प्रतिनिधित्व करता है कोड में निरंतर निर्देशों की एक निश्चित संख्या होती है। एल्गोरिथम विधि में साइन बाइट का पता लगाने और एक अनन्य बाइनरी मान का असाइनमेंट संकेत दिया जा रहा है कि हस्ताक्षर सकारात्मक या नकारात्मक होने के आधार पर बाइट यह भी शामिल है स्ट्रिंग टर्मिनेटर का समानांतर पता लगाने और सभी संयुक्त राष्ट्र के मुखौटा उपयोग किए गए वर्ण और साथ ही दशमलव बिंदु के समानांतर पहचान जो अंकों के आंशिक भाग से संख्या के पूर्णांक भाग को अलग करता है। बाद के चरणों में, स्ट्रिंग के सभी वर्णों के समान द्विआधारी दशमलव मानों में समानांतर रूपांतरण, प्रत्येक के समानांतर गुणा प्रत्येक द्विआधारी दशमलव मानों के प्रत्येक द्विपक्षीय दशमलव मानों के अलग-अलग बाइनरी परिणामों को प्राप्त करने के लिए दस की शक्ति के साथ द्विआधारी दशमलव मूल्य, एक प्रथम मध्यवर्ती द्विआधारी परिणाम में समानांतर गुणन के व्यक्तिगत द्विआधारी परिणामों का एकत्रीकरण, गुणा एक द्वितीय मध्यवर्ती द्विपक्षीय परिणाम प्राप्त करने के लिए दशमलव बिंदु के स्थान के अनुरूप दस की अस्थायी बिंदु शक्ति के साथ पहली मध्यवर्ती द्विआधारी परिणाम, और दूसरा मध्यवर्ती द्विआधारी परिणाम के गुणन को अंतिम फ्लोटिंग प्वाइंट प्राप्त करने के लिए हस्ताक्षरित बाइनरी मान के साथ बाइनरी दशमलव परिणाम। एक निरंतर समय रूपांतरण का उद्देश्य प्राप्त करने के लिए , वेक्टर प्रोसेसर आर्किटेक्चर और कोड तैयार किए गए हैं, जब क्रियान्वित किया जाता है तो कोड वास्तविक संख्या को दो या अधिक खंडों में विभाजित करता है और प्रत्येक अनुभाग को एक या अधिक निश्चित आकार के रजिस्टरों में लोड करता है, जिसमें से द्विआधारी चालीस आठ घटाकर रूपांतरण के संचालन प्रत्येक एएससीआईआई वास्तविक संख्या के अंक और दस की उपयुक्त शक्ति से गुणा करना समानांतर में किया जाता है। जबकि आविष्कार विधि, कोड या वास्तुकला पर, एकल निर्देश के उपयोग पर लागू नहीं होता है, यह अभी तक एक और उद्देश्य है एक वेक्टर प्रोसेसर प्रदान करने के लिए आविष्कार जो एक एकल निर्देश का उपयोग करके रूपांतरण में सक्षम होता है। एक वेक्टर प्रोसेसर प्रदान करने का यह और उद्देश्य प्राप्त करने के लिए, जो एक एकल निर्देश के साथ रूपांतरण करने में सक्षम है, अंतर्निहित एकल निर्देश एकाधिक डेटा सूचना, सिम, सदिश की क्षमता प्रोसेसर को सदिश प्रोसेसर के डिजाइन में SIMD फ़ंक्शन के साथ डिज़ाइन कोड के साथ संयोजन में प्रयोग किया जाता है। ड्राइंग के विवरण। एफआईजी 1 एक वेक्टर प्रोसेसर में फ्लोटिंग प्वाइंट बाइनरी दशमलव वास्तविक संख्या रूपांतरण के लिए एएससीआईआई का एक प्रवाह। एग्जिएशन के डिटेडेड वर्णन। एफआईजी 1 आविष्कार के एक पसंदीदा अवतार के प्रवाह का प्रतिनिधित्व करता है यह एक शाखा, निरंतर समय निष्पादन में शामिल कदम और रजिस्टरों को दिखाता है वेक्टर प्रोसेसर के भीतर चल बिन्दु द्विआधारी दशमलव रूपांतरण के लिए एक एएससीआईआई असली संख्या एएससीआईआई वास्तविक संख्या का मान शून्य के बराबर या उससे अधिक के बराबर हो सकता है, और इसमें कोई पूर्णांक, आंशिक भाग, और दशमलव पूर्णांक और आंशिक भाग के बीच बिंदु। अंजीर 1 के उदाहरण में वास्तविक संख्या शून्य से कम है, इसलिए एक ऋणात्मक संख्या, जिसका पूर्ण मूल्य 2345678 9 12 है, इस प्रकार उदाहरण में संख्या में शून्य चिह्न, एक पूर्णांक, 2345678 9 9 में, नौ अंक, एक अंश का भाग, 12 में दो अंक होते हैं, और पूर्णांक और आंशिक भाग के बीच एक दशमलव बिंदु। एफआईजी 1 परिचालन कदम, परिणाम, और उदाहरण में प्रयुक्त रजिस्टरों। चरण 1 में अनुक्रमिक निर्देशों की एक निश्चित संख्या के पहले एएससीआईआई को फ्लोटिंग प्वाइंट बाइनरी डेसिमल रूपांतरण के लिए निष्पादित किया जाता है और एएससीआईआई संख्या को स्मृति से प्राप्त किया जाता है इस अवतार में वास्तविक संख्या 32-बाइट शब्द, 1 और शब्द सीमा पर नहीं है वास्तविक संख्या को साइन बिट और स्ट्रिंग टर्मिनेटर के बीच के रूप में देखा जाता है। चरण 2 में लोड किए गए शब्द का पहला बाइट पहले 16-बाइट वेक्टर रजिस्टर के पहले बाइट के साथ संरेखित है, 2 और शब्द का अंतिम बाइट एक दूसरे 16 बाइट वेक्टर रजिस्टर के आखिरी बाइट के साथ गठबंधन है, 3 जैसे कि एएससीआईआई स्ट्रिंग का हिस्सा पहले रजिस्टर में है, 2 और दूसरा भाग दूसरे रजिस्टर में है, चरण 3 में पहली और दूसरी रजिस्टरों की सामग्री, 2 और 3 को एक तिहाई 16-बाइट रजिस्टर में छेड़ दिया जाता है, 4 जैसे कि बाएं बाइट में बाइट में साइन होता है और दाएं से नीचे दिए गए बाइट्स में वास्तविक अंक अंक होते हैं, जिसमें दशमलव बिंदु और स्ट्रिंग टर्मिनेटर। चरण 4 में साइन है डी एटेटेड, शब्द से छीन लिया गया, और साइन पॉररिटी का द्विआधारी प्रतिनिधित्व एक बाइट रजिस्टर में संग्रहित किया गया है, चरण 5 में 5 स्ट्रिंग टर्मिनेटर का पता लगाया जाता है, और वास्तविक संख्या के शेष अंक सही दायरे से जुड़े हुए हैं जैसा कि 6 में दिखाया गया है स्थिति अप्रयुक्त प्रमुख पात्रों को शून्य के रूप में मुखौटा दिया गया है। चरण 6 दशमलव बिंदुओं के दाईं ओर की स्थिति की संख्या का पता लगाया जाता है और एक-बाइट रजिस्टर में संग्रहीत किया जाता है, 7 फिर दशमलव बिंदु छीन लिया जाता है, जबकि पूर्णांक एक स्थिति को सही स्थान पर स्थानांतरित कर दिया जाता है और एक अग्रणी शून्य बाईं ओर स्थित स्थिति में डाली जाती है जैसा कि 8 में दिखाया गया है, कोई दशमलव बिंदु नहीं के साथ एक ग्यारह अंक असली संख्या में। चरण 7 बाइनरी दशमलव चालीस आठ शब्द के प्रत्येक वर्ण से घटाया जाता है वास्तविक संख्या के प्रत्येक अंक के द्विआधारी दशमलव रूपांतरण के लिए एएससीआईआई को चरण 6 के रजिस्टर करने के लिए। चरण 8 में अब ग्यारह-बाइट असली संख्या का शब्द चार चार बाइट टुकड़ों में बांटा गया है और प्रत्येक को सोलह बाइट्स के चार छोटे पूर्णांक शब्दों में पदोन्नत किया गया है जैसा 10 11 12 और 13 में दिखाया गया है। 9 में से 9 से प्रत्येक पूर्णांक वाले शब्दों में वेक्टर गुणा और आठ बाइट शब्द हैं, 14 में वैकल्पिक द्विआधारी दशमलव शून्य और दस की उचित शक्तियां होती हैं जो चार चार-बाइट बाइनरी दशमलव शब्दों, 15 16 17 और 18 परिणाम। चरण 10 में प्रत्येक चार-बाइट बाइनरी दशमलव शब्दों की सामग्री, 15 16 17 और 18 परिणाम क्षैतिज रूप से जोड़े गए हैं, जिसके परिणामस्वरूप चार दशमलव संख्याएं, 1 9 20 21 और 22. चरण 11 में परिणामी संख्याएं, 1 9 20 और 22 को एक दशमलव बिन्दु बनाकर एक फ्लोटिंग प्वाइंट नंबर में बदल दिया जाता है, प्रत्येक के आखिरी नंबर के दायीं ओर शून्य के बाद, 1 9 और 20 की संख्या से फ्लोटिंग प्वाइंट रूपांतरण परिणाम, आसन्न रखा जाता है एक दूसरे शब्द में, 23 शेष परिणाम संख्या, 21 पहले स्केलर को दस की संख्या में चार या दसवीं 10,000 की शक्ति के साथ गुणा करता है, इससे पहले कि वह एक दशमलव बिंदु रखकर, एक शून्य के बाद, उसके दाहिनी ओर एक फ्लोटिंग प्वाइंट में परिवर्तित हो जाता है अंतिम संख्या यह परिणाम, फ्लोटिंग पॉइंट के साथ 22 से रूपांतरण 22 शब्दों में आसन्न एक दूसरे शब्द 24 में रखा गया है। चरण 12 में बाईं तरफ, 23 में आधे शब्द में वेक्टर गुणा 10 से बारह की शक्ति होती है, फ्लोटिंग बिंदु में 1000000000000 0f और दाईं ओर, 23 का आधा शब्द सदिश की संख्या दस से बढ़कर आठ की शक्ति होती है, जो फ्लोटिंग बिंदु में 100000000 0 एफ के रूप में दर्शाती है, जो 25 नए रूप में दिखाए गए नए आधे शब्दों के रूप में दिखाए जाते हैं। चरण 13 में क्षैतिज वेक्टर जोड़ दो आसन्न आधे शब्दों में 25 और दो आसन्न क्रमशः 26 और 27 में दिए गए परिणाम के साथ 24 शब्दों में आधे शब्दों में। चरण 14 में स्केलर के अलावा 26 और 27 के परिणामों पर 28 में रखा जाता है। चरण 15 में दशमलव की दाईं ओर स्थित पदों की संख्या मूल एएससीआईआई स्ट्रिंग असली संख्या, जिसे चरण 6 में प्राप्त किया गया था और 7 में संग्रहीत किया जाता है, एक अंश के साथ संयोजन के रूप में प्रयोग किया जाता है तालिका को देखने के लिए, 2 9 में, दस की नकारात्मक शक्ति प्राप्त करने के लिए, इस उदाहरण में, दस से दो शून्य तक, जिसे फ्लोटिंग बिंदु 0 01f जैसा कि 30 में दिखाया गया है। चरण 1 में 6 में 28 में चरण 14 से 30 में परिणाम बिंदु का एक स्केलर गुणा किया जाता है और परिणाम 31 में होता है। चरण 17 में परिणाम के एक स्केलर गुणा 31 में साइन पॉररिटी के बाइनरी प्रतिनिधित्व द्वारा, चरण से प्राप्त किया गया 4 और रजिस्टर 5 में संग्रहित किया जाता है जो 32 में रखी एएससीआईआई स्ट्रिंग असली संख्या के अंतिम फ़्लोटिंग प्वाइंट प्रस्तुति के साथ किया जाता है। जबकि एफआईजी 1 का अवतार एक वैक्टर प्रोसेसर में फ्लोटिंग प्वाइंट रूपांतरण के निष्पादन का एक उदाहरण दिखाता है जिसमें एएससीआईआई स्ट्रिंग का उपयोग होता है एक 9 अंकों वाला पूर्णांक भाग, एक दशमलव अंक, एक 2 अंकों वाला आंशिक हिस्सा, और एक स्ट्रिंग टर्मिनेटर, प्रोसेसर आर्किटेक्चर और कोड को किसी भी आकार की स्ट्रिंग का समर्थन करने के लिए समायोजित किया जा सकता है, जिसमें बड़ी संख्या में अंक, क्रमबद्ध संयोजन एएससीआईआई स्ट्रिंग के कई हिस्सों पर एक ही प्रक्रिया की, फिर भी रूपांतरण के समय, यद्यपि रूपांतरण के समय, एक निरंतर, दे रहे हैं। जैसा ऊपर बताया गया है, एएससीआईआई स्ट्रिंग असली संख्या आकार 1 अंक से किसी भी संख्या में भिन्न हो सकता है पूर्वनिर्धारित डिज़ाइन अधिकतम अंक संख्या के लिए अंक, लेकिन समानांतर अंकगणित साधनों और कार्यों के आवेदन के माध्यम से, कोड का उचित चयन, और रजिस्टरों की संख्या और लंबाई और शब्द आकारों को डिजाइन करने से, निष्पादन का समय रूपांतरण रेंज के भीतर किसी भी स्ट्रिंग आकार के लिए लगातार बने रहेंगे और रूपांतरण न किए बिना हासिल किया जाएगा। जबकि एफआईजी 1 का अवतार एक सदिश प्रोसेसर में वास्तविक संख्या प्रारूप रूपांतरण का पसंदीदा निष्पादन दिखाता है, तो रूपांतरण की आवश्यकता नहीं होती है। जब तक समांतर अंकगणितीय संचालन के अनुप्रयोग और फिक्स्ड अनुक्रमों के निर्देशों की निरंतर संख्या के एक या एक से अधिक सेट का उपयोग निष्पादन समय को कम करने और रूपांतरण की दक्षता बढ़ाने के लिए किया जाता है, तब तक सटीक संख्या और अनुक्रमों का क्रम नहीं दिखता .4 दशमलव दशमलव दशमलव बिंदु और फ्लोटिंग पॉइंट अंकगणित। संस्करण 2 में नया। 4. दशमलव मॉड्यूल दशमलव फ़्लोटिंग पॉइंट अंकगणित के लिए समर्थन प्रदान करता है यह सीवरिया प्रदान करता है फ्लोट डेटाटाइप पर लाभ। डीसीमल फ्लोटिंग पॉइंट मॉडल पर आधारित है जिसे लोगों के मन में डिज़ाइन किया गया था, और जरूरी है कि एक सर्वोपरि मार्गदर्शन सिद्धांत कंप्यूटर को अंकगणित प्रदान करना चाहिए जो अंकगणित के समान काम करता है जो लोग स्कूल में सीखते हैं दशमलव अंकगणितीय विनिर्देश से अंश। दशमलव संख्या का प्रतिनिधित्व वास्तव में किया जा सकता है इसके विपरीत, 1 1 और 2 2 जैसी संख्याएं बाइनरी फ्लोटिंग प्वाइंट में सटीक प्रतिनिधित्व नहीं हैं, अंत उपयोगकर्ता आमतौर पर 1 3 2 3 को 3 3000000000000003 के रूप में प्रदर्शित करने की उम्मीद नहीं कर रहे हैं बाइनरी फ़्लोटिंग पॉइंट के साथ। सटीकता को अंकगणित में किया जाता है दशमलव दशमलव बिंदु में, 0 1 0 1 0 1 - 0 3 शून्य के बराबर है बाइनरी फ्लोटिंग प्वाइंट में, परिणाम 5 5511151231257827e-017 है जबकि शून्य के पास, मतभेद रोका जा सकता है विश्वसनीय समानता परीक्षण और मतभेद जमा कर सकते हैं इस कारण से, दशमलव लेखा अनुप्रयोगों में पसंद किया जाता है, जिसमें सख्त समानता वाले आविष्कार होते हैं। दशमलव मॉड्यूल में एक महत्वपूर्ण स्थानों की धारणा इसलिए है कि 1 30 1 20 है 2 50 अनुक्रम शून्य को इंगित करने के लिए रखा जाता है यह मौद्रिक अनुप्रयोगों के लिए प्रथागत प्रस्तुति है, गुणन के लिए, विद्यालय की पाठ्यचर्या का उपयोग गुणांक में सभी आंकड़े का उपयोग करता है उदाहरण के लिए, 1 3 1 2 देता है 1 56 जबकि 1 30 1 20 में 1 5600 देता है। हार्डवेयर आधारित बाइनरी फ्लोटिंग प्वाइंट के विपरीत, दशमलव मॉड्यूल में 28 जगहों पर एक उपयोगकर्ता के अनुकूल परिशुद्धता की कमी है जो दी गई समस्या के लिए जितनी ज़्यादा हो सकती है। दोनों द्विआधारी और दशमलव फ़्लोटिंग प्वाइंट प्रकाशित मानकों के संदर्भ में अंतर्निहित फ्लोट प्रकार केवल अपनी क्षमताओं का एक मामूली हिस्सा उजागर करता है, दशमलव मॉड्यूल मानक के सभी आवश्यक हिस्सों को उजागर करता है जब आवश्यक होता है, प्रोग्रामर को पूर्णांक पर पूरा नियंत्रण होता है और सिग्नल से निपटने में यह लागू होता है किसी भी अयोग्य ऑपरेशन को ब्लॉक करने के लिए अपवाद का उपयोग करके सटीक अंकगणित। दशमलव मॉड्यूल को पूर्वाग्रह के बिना समर्थन करने के लिए डिज़ाइन किया गया था, दोनों सटीक अदम्य दशमलव अंकगणित सी कभी-कभी निश्चित अंक अंकगणितीय और गोलाकार दशमलव अंकगणितीय विनिर्देश से गोल अंक अंकगणित अंश। मॉड्यूल डिजाइन तीन अवधारणाओं को दशमलव संख्या, अंकगणित के लिए संदर्भ, और संकेतों के केंद्र में केंद्रित करता है.एक दशमलव संख्या अपरिवर्तनीय है इसमें एक संकेत है, गुणांक अंक, और एक एक्सपोनेंट महत्व को बनाए रखने के लिए, गुणांक अंक अनुक्रमित शून्य को नहीं तोते दशमलव में विशेष मूल्यों जैसे इन्फिनिटी - इनफिनिटी और नाएनएन भी मानक शामिल हैं -0 से 0. 0 अंकगणितीय के लिए संदर्भ एक वातावरण है जो स्पष्टता निर्दिष्ट करते हैं, गोलाकार नियम, एक्सपोनेंट्स पर सीमाएं, ऑपरेशन के परिणामों को इंगित करने वाले झंडे, और जाल एनबॉलर्स जो यह निर्धारित करते हैं कि संकेत अपवादों के रूप में माना जाता है, राउंडिंग विकल्प में शामिल हैं राउंडसिंग राऊंडफ्लोर राउन्डहेल्डेडोन राउन्डहेफिवेन राउण्डहल्फ़अप राऊंडअप और राउंड05 यूपी। सिग्नल कॉन्ट्रैक्टेशन के दौरान होने वाली असाधारण स्थितियों के समूह हैं। आवेदन की जरूरतों पर, संकेत सूचना के रूप में माना जा सकता है, अपवाद के रूप में माना जाता है, या अपवाद के रूप में माना जाता है दशमलव मॉड्यूल में सिग्नल को क्लैंप किया गया अमान्यऑपरेशन डिवीजनबिज़रो अनैक्सैटेड गोल गौण अतिप्रवाह और अंडरफ़्लो। प्रत्येक सिग्नल के लिए एक झंडा और एक जाल एनबलर है, जब एक संकेत मिलता है, इसका ध्वज सेट है एक के लिए, यदि जाल एनबलर एक के लिए सेट किया गया है, तो एक अपवाद उठाया गया है, झंडे चिपचिपा होते हैं, इसलिए उपयोगकर्ता को गणना की निगरानी से पहले उन्हें रीसेट करना होगा। 4 4 1 त्वरित शुरुआत ट्यूटोरियल। दशमलव का उपयोग करने की शुरुआत सामान्य है मॉड्यूल, getcontext के साथ वर्तमान संदर्भ को देखते हुए और, यदि आवश्यक हो, तो सटीक, गोलाकार, या सक्षम जाल के लिए नए मानों को सेट करना। साधारण उदाहरणों को पूर्णांक, स्ट्रिंग, फ्लोट या ट्यूपल्स से बनाया जा सकता है एक पूर्णांक या एक फ्लोट से निर्माण सटीक उस पूर्णांक या फ्लोट के मूल्य का रूपांतरण दशमलव संख्या में विशेष मूल्य जैसे एनएएन शामिल हैं जो एक संख्या, सकारात्मक और नकारात्मक इन्फिनिटी और -0 नहीं है। एक नया दशमलव I का महत्व सिर्फ़ अंक इनपुट की संख्या से निर्धारित किया जाता है संदर्भ संदर्भ सटीक और गोलाकार अंकगणितीय संचालन के दौरान केवल नाटक में आते हैं। दशमलव अधिकांश अन्य पायथन के साथ अच्छी तरह से इंटरैक्शन करता है यहां एक छोटा दशमलव फ़्लोटिंग बिंदु फ़्लाइंग सर्कस है.और कुछ गणितीय फ़ंक्शन दशमलव के लिए भी उपलब्ध हैं Quantize विधि एक निश्चित एक्सपोनेंट के लिए एक नंबर की गोलता है यह विधि मौद्रिक अनुप्रयोगों के लिए उपयोगी होती है जो अक्सर निश्चित स्थानों पर परिणाम निकालती है। ऊपर दिखाए गए अनुसार, getcontext फ़ंक्शन वर्तमान संदर्भ तक पहुंचता है और सेटिंग्स को परिवर्तित करने की अनुमति देता है यह दृष्टिकोण पूरा करता है अधिकतर अनुप्रयोगों की ज़रूरत होती है। अधिक उन्नत कार्य के लिए, संदर्भ रचनाकार का उपयोग करके वैकल्पिक संदर्भ बनाने के लिए उपयोगी हो सकता है एक वैकल्पिक सक्रिय बनाने के लिए, सेटैकंटेक्स्ट फ़ंक्शन का उपयोग करें। मानक के अनुसार, दशमलव मॉड्यूल मानक संदर्भों का उपयोग करने के लिए दो तैयार करता है , बेसिक कॉन्टैक्ट और एक्सटेंडेड कंटैक्सटेस्ट डीबगिंग के लिए विशेष रूप से उपयोगी है क्योंकि बहुत से जाल सक्षम हैं। कोन्टेक्सट्स भी कम्प्यूटेशन के दौरान सामने आने वाली असाधारण स्थितियों की निगरानी के लिए संकेत झंडे हैं, स्पष्ट रूप से साफ होने तक झंडों को सेट किया जाता है, इसलिए साफ़-फ्लेग विधि का उपयोग कर प्रत्येक सेट के पहले झंडे साफ़ करना सबसे अच्छा है। झंडे प्रविष्टि से पता चलता है कि पी को तर्कसंगत सन्निकटन किया गया था संदर्भ परिशुद्धता से परे अंकों को फेंक दिया गया और इसका परिणाम अनावश्यक है कुछ छोड़े गए अंक शून्य-शून्य थे। व्यक्तिगत जाल एक संदर्भ के जाल क्षेत्र में डिक्शनरी का उपयोग करते हुए सेट हैं। अधिकांश प्रोग्राम वर्तमान संदर्भ को केवल एक बार समायोजित करते हैं, पर कार्यक्रम की शुरुआत और, कई अनुप्रयोगों में डेटा को दशमलव में एक लूप के अंदर एक कलाकार के साथ कनवर्ट किया जाता है, संदर्भ सेट और दशमलव बनाने के साथ, कार्यक्रम के थोक डेटा को अन्य पायथन संख्यात्मक प्रकारों के साथ अलग तरह से जोड़ता है। 9 4 2 दशमलव objects. value से आधारित एक नया दशमलव ऑब्जेक्ट तैयार करें एक पूर्णांक, स्ट्रिंग, ट्यूपल, फ्लोट या अन्य दशमलव ऑब्जेक्ट हो सकता है यदि कोई मान नहीं दिया जाता है, तो रिटर्न D पारिस्थितिक 0 यदि मान एक स्ट्रिंग है, तो उसे दशमलव और स्ट्रैटेबल व्हाट्सएप वर्ण हटा दिए जाने के बाद दशमलव और संख्यात्मक स्ट्रिंग वाक्यविन्यास के अनुरूप होना चाहिए। यदि मान एक यूनिकोड स्ट्रिंग है तो अन्य यूनिकोड दशमलव अंकों की भी अनुमति दी जाती है जहां अंकों में ऊपर दिखाई देता है इनमें से दशमलव अंक उदाहरण के लिए अरबी-इंडिक और देवंगर अंकों के साथ-साथ पूर्णविड्थ अंक यू uff10 के साथ-साथ अन्य वर्णों में यू uff19। यदि मूल्य एक ट्यूपल है तो इसमें तीन घटक होंगे, सकारात्मक के लिए एक चिन्ह 0 या नकारात्मक के लिए 1, अंकों का ट्यूपल और एक पूर्णांक एक्सपोनेंट उदाहरण के लिए, दशमलव 0, 1, 4, 1, 4, -3 दशमलव 1 414 देता है। यदि मूल्य एक फ्लोट है तो द्विआधारी फ्लोटिंग प्वाइंट वेल्यू हानूलहित रूप से उसके सटीक दशमलव समीकरण में बदल जाती है। इस रूपांतरण को अक्सर 53 या अधिक अंकों की आवश्यकता होती है सटीक उदाहरण के लिए, दशमलव फ्लोट 1 1 दशमलव 1 10000000000000088817841970012523233890533447265625 के लिए धर्मान्तरित। संदर्भ सटीक कितने अंकों को संग्रहीत किए बिना प्रभावित नहीं करता है जो केवल सुन्न द्वारा निर्धारित होता है उदाहरण के लिए, अंक में अंकों की संख्या उदाहरण के लिए, दशमलव 3 00000 सभी पांच शून्य को रिकॉर्ड करते हैं भले ही संदर्भ सटीक केवल तीन हो। संदर्भ तर्क का उद्देश्य निर्धारित करना है कि क्या मूल्य एक विकृत स्ट्रिंग है यदि संदर्भ जाल अमान्यऑपरेशन एक अपवाद उठता है अन्यथा, कन्स्ट्रक्टर नाएन के मूल्य के साथ एक नया दशमलव देता है। एक बार निर्माण किया गया, दशमलव वस्तुएं अपरिवर्तनीय हैं। संस्करण 2 6 में परिवर्तित और स्ट्रेट से एक दशमलव उदाहरण बनाते समय व्हाइट स्पेस वर्णों की पिछली अनुमति दी जाती है। संस्करण 2 में बदला तर्क 7 कंस्ट्रक्टर को अब फ्लोट इंस्टेंस होने की अनुमति है। अस्थायी फ़्लोटिंग पॉइंट ऑब्जेक्ट्स कई अंतर्निहित गुणों को दूसरे अंतर्निहित संख्यात्मक प्रकार जैसे कि फ्लोट और इंट के साथ साझा करते हैं सामान्य गणित संचालन और विशेष विधियां सभी लागू होते हैं, इसी तरह दशमलव वस्तुओं को कॉपी किया जा सकता है, मज़ेदार, मुद्रित, शब्दकोश कुंजी के रूप में उपयोग किया जाता है, सेट तत्वों के रूप में इस्तेमाल किया जाता है, तुलना की जाती है, सॉर्ट किया जाता है, और किसी अन्य प्रकार जैसे ज़मीन या लंबे समय तक मजबूर होता है। इसमें कुछ छोटे अंतर होते हैं दशमलव वस्तुओं और अंकगणित पर अंकगणित पूर्णांक और फ़्लोट्स पर शेष ऑपरेटर को दशमलव वस्तुओं पर लागू किया जाता है, परिणाम का चिन्ह विभाजन के संकेत के बजाय लाभांश का संकेत होता है। पूर्णांक डिवीजन ऑपरेटर समानता से व्यवहार करता है, पूर्णांक भाग लौटाता है of the true quotient truncating towards zero rather than its floor, so as to preserve the usual identity xxyyx y. The and operators implement the remainder and divide-integer operations respectively as described in the specification. Decimal objects cannot generally be combined with floats in arithmetic operations an attempt to add a Decimal to a float for example, will raise a TypeError There s one exception to this rule it s possible to use Python s comparison operators to compare a float instance x with a Decimal instance y Without this exception, comparisons between Decimal and float instances would follow the general rules for comparing objects of different types described in the Expressions section of the reference manual, leading to confusing results. Changed in version 2 7 A comparison between a float instance x and a Decimal instance y now returns a result based on the values of x and y In earlier versions x y returned the same arbitrary result for any Decimal instance x and any float instance y. In addition to the standard numeric properties, decimal floating point objects also have a number of specialized methods. Return the adjusted exponent after shifting out the coefficient s rightmost digits until only the lead digit remains returns seven Used for determining the position of the most significant digit with respect to the decimal point. Return a named tuple representation of the number DecimalTuple sign, digits, exponent. Changed in version 2 6 Use a named tuple. Return the canonical encoding of the argument Currently, the encoding of a Decimal instance is always canonical, so this operation returns its argument unchanged. New in version 2 6pare the values of two Decimal instances This operation behaves in the same way as the usual comparison method cmp except that compare returns a Decimal instance rather than an integer, and if either operand is a NaN then the result is a NaN. This operation is identical to the compare method, except that all NaNs signal That is, if neither operand is a signaling NaN then any quiet NaN operand is treated as though it were a signaling NaN. New in version 2 6pare two operands using their abstract representation rather than their numerical value Similar to the compare method, but the result gives a total ordering on Decimal instances Two Decimal instances with the same numeric value but different representations compare unequal in this ordering. Quiet and signaling NaNs are also included in the total ordering The result of this function is Decimal 0 if both operands have the same representation, Decimal -1 if the first operand is lower in the total order than the second, and Decimal 1 if the first operand is higher in the total order than the second operand See the specification for details of the total order. New in version 2 6pare two operands using their abstract representation rather than their value as in comparetotal but ignoring the sign of each operand is equivalent to. New in version 2 6.Just returns self, this method is only to comply with the Decimal Specification. New in version 2 6.Return the absolute value of the argument This operation is unaffected by the context and is quiet no flags are changed and no rounding is performed. New in version 2 6.Return the negation of the argument This operation is unaffected by the context and is quiet no flags are changed and no rounding is performed. New in version 2 6.Return a copy of the first operand with the sign set to be the same as the sign of the second operand For example. This operation is unaffected by the context and is quiet no flags are changed and no rounding is performed. New in version 2 6.Return the value of the natural exponential function e x at the given number The result is correctly rounded using the ROUNDHALFEVEN rounding mode. New in version 2 6.Classmethod that converts a float to a decimal number, exactly. Note is not the same as Decimal 0 1 Since 0 1 is not exactly representable in binary floating point, the value is stored as the nearest representable value which is 0x1 999999999999ap-4 That equivalent value in decimal is 0 1000000000000000055511151231257827021181583404541015625.From Python 2 7 onwards, a Decimal instance can also be constructed directly from a float. Q Once I have valid two place inputs, how do I maintain that invariant throughout an application. A Some operations like addition, subtraction, and multiplication by an integer will automatically preserve fixed point Others operations, like division and non-integer multiplication, will change the number of decimal places and need to be followed-up with a quantize step. In developing fixed-point applications, it is convenient to define functions to han dle the quantize step. Q There are many ways to express the same value The numbers 200 200 000 2E2 and 02E 4 all have the same value at various precisions Is there a way to transform them to a single recognizable canonical value. A The normalize method maps all equivalent values to a single representative. Q Some decimal values always print with exponential notation Is there a way to get a non-exponential representation. A For some values, exponential notation is the only way to express the number of significant places in the coefficient For example, expressing 5 0E 3 as 5000 keeps the value constant but cannot show the original s two-place significance. If an application does not care about tracking significance, it is easy to remove the exponent and trailing zeros, losing significance, but keeping the value unchanged. Q Is there a way to convert a regular float to a Decimal. A Yes, any binary floating point number can be exactly expressed as a Decimal though an exact conversion may take mor e precision than intuition would suggest. Q Within a complex calculation, how can I make sure that I haven t gotten a spurious result because of insufficient precision or rounding anomalies. A The decimal module makes it easy to test results A best practice is to re-run calculations using greater precision and with various rounding modes Widely differing results indicate insufficient precision, rounding mode issues, ill-conditioned inputs, or a numerically unstable algorithm. Q I noticed that context precision is applied to the results of operations but not to the inputs Is there anything to watch out for when mixing values of different precisions. A Yes The principle is that all values are considered to be exact and so is the arithmetic on those values Only the results are rounded The advantage for inputs is that what you type is what you get A disadvantage is that the results can look odd if you forget that the inputs haven t been rounded. The solution is either to increase precision or t o force rounding of inputs using the unary plus operation. Conversion of floating-point numbers from binary into string format US 20070203965 A1.A method, system, and computer program product that convert a real number from a floating point representation to a character string Mantissa bits are extracted from the floating-point representation of a value into an integer format The mantissa bits of the integer format may be shifted left by a number of positions that is equal to a base 2 exponent of a first representation of the value Prior to converting the value, the floating-point representation of the value can be divided by 2 n where n is the number of the mantissa bits in the floating-point representation of the value A set of operations can then be performed to convert a result of the division to a number greater than or equal to 1 0 and less than 10 0 The set of operations may include multiplication operations and or retrieving a constant from a lookup table. 20.1 A method comprising. converting a value from a floating-point representation of the value to a character string, wherein the converting comprises. extracting mantissa bits from the floating-point representation into a first integer. converting the first integer to the character string.2 The method of claim 1 further comprising. calculating a second integer by shifting the mantissa bits in the first integer by a number of positions, wherein. the converting the first integer to the character string comprises converting the second integer to the character string.3 The method of claim 2 wherein. the number of positions by which the mantissa bits are shifted is equal to a base 2 exponent of a first representation of the value, and. the mantissa bits are shifted left.4 The method of claim 2 further comprising. prior to converting the value, performing the following. dividing the floating-point representation of the value by 2 n. where the n is a number of the mantissa bits in the floating-point r epresentation of the value and. performing a set of operations to convert a result of the dividing to a number greater than or equal to 1 0 and less than 10 0.5 The method of claim 4 wherein. the set of operations comprises a lookup operation and a multiplication operation. the lookup operation retrieves a constant from a lookup table, and. the multiplication operation multiplies a current representation of the value by the constant.6 The method of claim 5 wherein. the lookup table further comprises a value of a base 10 exponent for a result of the multiplication operation.7 The method of claim 4 wherein. the set of operations is a set of multiplication operations, and. the set of multiplication operations comprises no more than a maximum number of multiplication operations.8 The method of claim 7 wherein. if a number of bits in an exponent of the floating-point representation of the value is 11, the maximum number of multiplication operations is 9.9 The method of claim 8 further comprising. fo r each multiplication operation in the set of multiplication operations. adding a corresponding value to a variable, wherein. the variable is used to calculate a base 10 exponent to be appended to the character string representing the value.10 A computer-readable medium comprising. converting instructions to convert a value from a floating-point representation of the value to a character string. extracting instructions to extract mantissa bits from the floating-point representation into a first integer and. second converting instructions to convert the first integer to the character string.11 The computer-readable medium of claim 10 further comprising. calculating instructions to calculate a second integer by shifting the mantissa bits in the first integer by a number of positions, wherein. converting the first integer to the character string comprises converting the second integer to the character string.12 The computer-readable medium of claim 10 further comprising. dividing instructions to divide the floating-point representation of the value by 2 n. where the n is a number of the mantissa bits in the floating-point representation of the value and. performing instructions to perform a set of operations to convert a result of the dividing to a number greater than or equal to 1 0 and less than 10 0.13 The computer-readable medium of claim 12 wherein. the set of operations comprises a lookup operation and a multiplication operation. the lookup operation retrieves a constant from a lookup table, and. the multiplication operation multiplies a current representation of the value by the constant.14 The computer-readable medium of claim 13 wherein. the lookup table further comprises a value of a base 10 exponent for a result of the multiplication operation.15 The computer-readable medium of claim 12 wherein. the set of operations is a set of multiplication operations, and. the set of multiplication operations comprises no more than a maximum number of multiplication operations.16 The co mputer-readable medium of claim 15 further comprising. an adding module to add a corresponding value to a variable for each multiplication operation in the set of multiplication operations, wherein. the variable is used to calculate a base 10 exponent to be appended to the character string representing the value.17 A computer system comprising. a processor to execute instructions and. a memory, wherein. the memory is coupled to the processor, and. the memory comprises the computer-readable medium of claim 12.18 The computer system of claim 17 wherein the computer-readable medium further comprises. calculating instructions to calculate a second integer by shifting the mantissa bits in the first integer by a number of positions, wherein. converting the first integer to the character string comprises converting the second integer to the character string.19 The computer system of claim 17 wherein the computer-readable medium further comprises. dividing instructions to calculate the floating-point r epresentation of the value by 2 n. where the n is a number of the mantissa bits in the floating-point representation of the value and. performing instructions to perform a set of operations to convert a result of the dividing to a number greater than or equal to 1 0 and less than 10 0.20 A system comprising. converting means for converting a value from a floating-point representation of the value to a character string. extracting means for extracting mantissa bits from the floating-point representation into a first integer and. second converting means for converting the first integer to the character string. CROSS-REFERENCE TO RELATED APPLICATION. This invention claims priority to Provisional Patent Application Ser No 60 667,192, entitled CONVERSION OF FLOATING-POINT NUMBERS FROM BINARY INTO STRING FORMAT , filed Mar 31, 2005, and naming Nathan Luther Reynolds as inventor This provisional patent application is incorporated herein by reference, in its entirety and for all purposes. Portions of this patent application contain materials that are subject to copyright protection The copyright owner has no objection to the facsimile reproduction by anyone of the patent document, or the patent disclosure, as it appears in the Patent and Trademark Office file or records, but otherwise reserves all copyright rights whatsoever. BACKGROUND OF THE INVENTION. Many large businesses wish to take advantage of widespread use of the Internet to communicate with customers However, communication protocols on the Internet are designed to deal primarily with text data, whereas numerical data is typically stored on computers in a non-text format IEEE Standard 754 floating-point representation is the most commonly-used representation for real numbers on computers IEEE Standard 754 floating-point representation represents real numbers in scientific notation, where each number has a mantissa, a base, and an exponent For example, 62 25 could be represented as 62 25 10 0 where the mantissa is 62 25, the base is 10 and the exponent is 0 indicating multiplication by 1 Preferably, floating-point numbers are stored in normalized form, which places the decimal point after the first non-zero digit In normalized form, 62 25 is represented as 6 225 10 1 Computers store data in binary format, also referred to as base 2 numbers, which have digits that are either 1s or 0s 62 25 in binary format is 111110 01 2 0 or 1 1111001 2 5 normalized. An important goal in the design of floating-point representation of numbers is to provide a representation that can approximate real numbers to a certain degree of accuracy Consequently, a floating-point representation embodies the notions of significant digits and the location of the decimal point IEEE Standard 754 floating-point numbers have three basic components the sign, the exponent, and the mantissa The base of 2 is not explicitly represented The sign bit indicates whether the number is positive or negative The mantissa is composed of a fraction, which corresponds to the significant digits, and may include an implicit leading digit For example, in base 2, since the only possible non-zero digit is 1, a leading digit can be assumed and is not required to be stored explicitly, thereby saving storage space and increasing accuracy The exponent indicates the location of the decimal point. FIG 1 shows the components of a floating-point representation of a real number and its binary equivalent FIG 1 includes various representations, including the IEEE 754 8-byte format, of the decimal number 3 14159 In exponential form, the number is represented as 3 14159 10 0 As a binary number, the number is represented as 11 0010010000111111001111100000001 trailing zeros are omitted in this example In binary exponential form, the number is shown as 1 10010010000111111001111100000001 2 1 In binary IEEE 754 8-byte form, the number has a one-bit sign component having a value of 0, indicating that the number is positive The IEEE 754 8-byte form also includes an 11-bit exponent, in this example having a value of 100 0000 0000 Because the exponent field needs to represent both positive and negative exponents, a bias is added to the actual exponent to obtain the stored exponent For IEEE 754 8-byte format, the bias is 1023 Thus, the value in the example of FIG 1 is 1024 indicating an exponent of 1 1024 1023.The 52-bit mantissa, also known as a significand, represents the significant bits, also referred to as precision bits, of the number In IEEE 754 8-byte format, the mantissa includes an implicit leading bit and the fraction bits In FIG 1 the mantissa has a value of 10010010000111111001111100000001 the leading 1 of the binary exponential form is not shown because it is implicit, and trailing zeros are not shown Before printing a number in IEEE 754 8-byte format, the stored value is usually converted from base 2 to a character string. In IEEE 754 8-byte format, the largest and smallest binary numbers that can be represented are 2 2 52 1023 The largest and smallest decimal numbers that can be represented are approximately 10 308 Known conversion techniques may require up to 325 multiplication operations 308 for processing the exponent and one for each digit of a possible 17 digits in the mantissa to convert the largest possible floating-point number to a character string With web pages displaying numerous numerical values as character strings, conversion of real numbers to character strings can consume a substantial amount of CPU time and greatly reduce performance of web-based applications In one example, CPU processing time spent by a web server to produce web pages and reports was analyzed In that analysis, 67 of the CPU processing time of the web server was consumed by conversion of the floating-point representations of numbers into character strings Similarly, another analysis of time spent by a Pentium IV processor using standardized conversion functions in a commonly available run-time library required from 6,000 to 14 ,000 cycles for each floating-point number converted to a character string. What is needed is the ability to convert a floating-point representation of a number to a character string quickly, efficiently, and accurately Preferably the technique would be useable by web servers in producing web pages and reports as well as by other software converting numerical data to character strings. SUMMARY OF THE INVENTION. The present invention relates to a method, system, and computer program product that convert a floating-point representation of a number to a character string quickly, efficiently, and accurately The inventive technique can be used by web servers in producing web pages and reports as well as by other software converting numerical data to character strings. Mantissa bits are extracted from the floating-point representation of a value into an integer format The mantissa bits of the integer format may be shifted left by a number of positions that is equal to a base 2 exponent of a firs t representation of the value Prior to converting the value, the floating-point representation of the value can be divided by 2 n where n is the number of the mantissa bits in the floating-point representation of the value A set of operations can then be performed to convert the result of the division to a number greater than or equal to 1 0 and less than 10 0 The set of operations may include multiplication operations and or retrieving a constant from a lookup table. In one embodiment, the set of operations comprises a lookup operation and a multiplication operation, where the lookup operation retrieves a constant from a lookup table, and the multiplication operation multiplies a current representation of the value by the constant The lookup table may further comprise a value of a base 10 exponent for a result of the multiplication operation. In another embodiment, the set of operations is a set of multiplication operations, and the set of multiplication operations includes no more than a maximum number of multiplication operations For example, if a number of bits in an exponent of the floating-point representation of the value is 11, the maximum number of multiplication operations is 9 For each multiplication operation, a corresponding value can be added to a variable that is used to calculate a base 10 exponent to be appended to the character string representing the value. BRIEF DESCRIPTION OF THE DRAWINGS. The present invention may be better understood, and its numerous objectives, features, and advantages made apparent to those skilled in the art by referencing the accompanying drawings. FIG 1 shows the components of a floating-point representation of a decimal number and its binary equivalent, as described above. FIG 2A shows a flowchart of a method for converting the floating-point representation of a number to a character string. FIG 2B shows a flowchart of one implementation of the Convert Real Number to Character String step of the flowchart of FIG 2A. FIG 3 shows an example of a conversion of a floating-point representation of a number to a character string in accordance with the steps of the flowchart of FIGS 2A and 2B. FIG 4 shows a flowchart of a method for converting the floating-point representation of a number to a character string in accordance with one embodiment of the invention. FIGS 5A and 5B show one possible implementation of the Convert Current Representation of Real Number to have Value between 1 0 and 10 0 step of the flowchart of FIG 4 in accordance with one embodiment of the invention. FIG 6A shows an example of a conversion of a floating-point representation of a number to a character string in accordance with the steps of the flowcharts of FIGS 4, 5A and 5 B. FIG 6B shows another example of a conversion of a floating-point representation of a number to a character string in accordance with the steps of the flowcharts of FIGS 4, 5A and 5 B. FIG 7 illustrates rounding of floating point numbers using three fixed binary floating-poi nt numbers. FIG 8 shows one possible implementation of the Convert Integer to Character String step of FIG 4 in accordance with one embodiment of the invention. FIG 9 shows one possible implementation of the Round Integer step of FIG 8 in accordance with one embodiment of the invention. FIG 10A shows an example of converting an integer to a character string in accordance with the flowcharts of FIGS 8 and 9.FIG 10B shows another example of converting an integer to a character string in accordance with the flowcharts of FIGS 8 and 9.FIG 10C shows another example of converting an integer to a character string in accordance with the flowcharts of FIGS 8 and 9.The use of the same reference symbols in different drawings indicates similar or identical items. For a thorough understanding of the subject invention, refer to the following Detailed Description, including the appended Claims, in connection with the above-described Drawings Although the present invention is described in connection with several embodiments, the invention is not intended to be limited to the specific forms set forth herein On the contrary, it is intended to cover such alternatives, modifications, and equivalents as can be reasonably included within the scope of the invention as defined by the appended Claims. In the following description, for purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the invention It will be apparent, however, to one skilled in the art that the invention can be practiced without these specific details. References in the specification to one embodiment or an embodiment means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment of the invention The appearances of the phrase in one embodiment in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutua lly exclusive of other embodiments Moreover, various features are described which may be exhibited by some embodiments and not by others Similarly, various requirements are described which may be requirements for some embodiments but not other embodiments. The present invention can be used to quickly, efficiently, and accurately convert a value from a floating-point representation to a character string While the IEEE 754 8-byte format is used as an example of a floating-point representation of a number throughout this document, one of skill in the art will understand that the invention is not limited to the IEEE 754 8-byte format The techniques described herein can be applied to numbers represented in various other formats, including IEEE 754 4-byte format and IEEE 754 10-byte format Generally, any format representing a real number in the form of a fractional component and an exponent can be converted to a character string using the techniques described herein, with only slight adjustme nts to account for differences in the floating-point representation. FIG 2A shows a flowchart of a method for converting the floating-point representation of a number to a character string In Handle Sign Bit step 210 a value of zero indicates a positive number, and a value of one represents a negative number In Handle Special Cases e g Zero, Infinity, NaN step 220 values that have special representations in IEEE format are handled IEEE format reserves exponent fields of all 0s and all 1s to denote special values For example, if the exponent field has a zero and the fraction mantissa field has a zero, then zero is the intended value ignoring the assumed implicit leading bit 0 and 0 are therefore distinct values The values of infinity and infinity are denoted with an exponent of all 1s and a fraction of all 0s The sign bit distinguishes infinity and infinity Being able to define infinity as a special value is useful because it allows operations to continue past overflow situations where a number is too large or too small to be represented in floating-point format Operations with infinite values are well defined in IEEE floating-point representation The value NaN Not a Number is used to represent a value that is not a real number NaNs are represented by a bit pattern with an exponent of all 1s and a non-zero fraction. Control proceeds from Handle Special Cases e g Zero, Infinity, NaN step 220 to Convert Real Number to Character String step 230 Alternative implementations of this step are discussed below with reference to FIGS 2B and 4 From Convert Real Number to Character String step 230 control proceeds to Insert Decimal Point step 240 At Insert Decimal Point step 240 a decimal point is inserted into the character string For example, the decimal point can be inserted after the first character of the character string representing the number Control then proceeds to Handle Exponent step 250 For example, an e or other character indicative of an exponent and the exponent s value are appended to the character string representing the value One of skill in the art will understand that other ways of writing the number are possible. FIG 2B shows a flowchart of one implementation of the Convert Real Number to Character String step 230 of the flowchart of FIG 2A Control begins with Convert Current Representation of Real Number to have Value between 1 0 and 10 0 step 232 In this step, the value of the real number is manipulated so that only one digit precedes the decimal point Convert Current Representation of Real Number to have Value between 1 0 and 10 0 step 232 converts the real number to have a value between 1 0 inclusive and 10 0 exclusive. To convert the real number to have a value between 1 0 and 10 0, the decimal point can be moved left or right to produce only one digit preceding the decimal point In base 10, moving the decimal point to the right by one position is the equivalent of multiplying the current representation of the value by 10, whereas movin g the decimal point to the left by one position is the equivalent of dividing the current representation of the value by 10 or multiplying the current representation of the value by 0 1 This conversion will assure that one digit having a value between 1 and 9 precedes the decimal point, enabling conversion from each numerical digit to its character equivalent. Convert Current Representation of Real Number to have Value between 1 0 and 10 0 step 232 deals with normalizing the current representation of the real number, and therefore the number of multiplication operations is determined by the size of the exponent In some implementations, Convert Current Representation of Real Number to have Value between 1 0 and 10 0 step 232 may require up to 308 multiplication operations for example, conversion of the largest value 10 308 can be implemented using 308 multiplication operations, where each multiplication operation multiplies the current representation of the real number by 10 Such an implementation is very expensive, and a more efficient implementation of Convert Current Representation of Real Number to have Value between 1 0 and 10 0 step 232 is discussed with reference to FIGS 4, 5A and 5 B below. From Convert Current Representation of Real Number to have Value between 1 0 and 10 0 step 232 control proceeds to Convert Digit to Character step 234 Each digit has a character equivalent, so Convert Digit to Character step 234 converts the numeric digit to its character equivalent Control then proceeds to Last Digit decision point 236 If the digit is the last digit in the current representation of the real number, the real number has been converted to a character string and control returns to the flowchart of FIG 2A having completed Convert Real Number to Character String step 230.At Last Digit decision point 236 if the converted digit is not the last digit in the current representation of the real number, control proceeds to Eliminate Converted Digit from Current Representation of Real Number step 238 This step is discussed in further detail with reference to FIG 3 From Eliminate Converted Digit from Current Representation of Real Number step 238 control proceeds to Multiply Current Representation of Real Number by 10 step 239 to process additional digits in the current representation of the real number. The number of times tha t Multiply Current Representation of Real Number by 10 step 239 is executed and the number of multiplication operations that will occur is determined by the size of the mantissa The longest number that can be represented in the 52 mantissa bits of the IEEE standard 754 floating-point format contains 17 digits Consequently, the loop from Convert Digit to Character step 234 to Multiply Current Representation of Real Number by 10 step 239 may be executed up to 17 times These multiplication operations are in addition to the 308 operations that may be performed in Convert Current Representation of Real Number to have Value between 1 0 and 10 0 step 232 for a possible total of 325 multiplication operations. FIG 3 shows an example of a conversion of a floating-point representation of a number to a character string in accordance with the steps of the flowchart of FIG 2B In this figure, a real number having a value of 3 14159 is converted to a character string The table shows six iterations of t he loop shown in FIG 2B with each entry in the table representing a step number that is executed and the resulting values of the current representation of the real number or the character string as a result of executing the respective step In Convert Real Number to Character String step 230 of FIG 2A the processing shown in flowchart of FIG 2B begins At Convert Current Representation of Real Number to have Value between 1 0 and 10 0 step 232 the current representation of the number, 3 14159, has a value between 1 and 10, so no numerical calculation is performed in Convert Current Representation of Real Number to have Value between 1 0 and 10 0 step 232 as shown in the Comment column. In the flowchart of FIG 2B control proceeds from Convert Current Representation of Real Number to have Value between 1 0 and 10 0 step 232 to Convert Digit to Character step 234 As shown in FIG 3 the character equivalent of the leading digit in the current representation of the real number, 3, is placed int o the character string in the first position Because 3 is not the last digit of the real number at Last Digit decision point 236 control in the flowchart of FIG 2B passes to Eliminate Converted Digit from Current Representation of Real Number step 238 The digit corresponding to the character 3 is eliminated from the current representation of the real number, to provide a new current representation of the real number having a value of 0 14159 Control then proceeds to Multiply Current Representation of Real Number by 10 step 239 in the flowchart of FIG 2B. At Multiply Current Representation of Real Number by 10 step 239 the current representation of the real number has a value of 0 14159 The current representation of the real number is multiplied by 10 as shown in the Comment column , thereby moving the decimal point one position to the right and producing a new value for the current representation of the real number of 1 4159 Control then returns to Convert Digit to Character step 234 wh ere the leading digit, 1, is inserted into the character string Because 1 is not the last digit of the real number at Last Digit decision point 236 control proceeds to Eliminate Converted Digit from Current Representation of Real Number step 238 where the converted digit 1 is removed from the current representation of the real number, which now has a value of 0 4159.In the remaining third, fourth, fifth, and sixth iterations of the loop of FIG 2B each digit in the current representation of the real number is iteratively placed into the character string In addition, each respective remaining current representation of the real number is multiplied by 10 when control returns to Multiply Current Representation of Real Number by 10 step 239 Five multiplication operations are necessary to convert the mantissa 3 14159 to a character array having the characters 314159.When the last digit is processed, 9 in this example, the number has been converted a character string having contents 314159, a s shown in the last line of the table of FIG 3. Convert Real Number to Character String step 230 of FIG 2A is completed Control then proceeds to Insert Decimal Point step 240 and Handle Exponent step 250 of the flowchart of FIG 2A In Handle Exponent step 250 the result may be formatted for easier reading by not writing an exponent of zero, for example. FIG 4 shows a flowchart of a method for converting the floating-point representation of a number to a character string in accordance with one embodiment of the invention The flowchart of FIG 4 provides an alternative implementation of the method of FIG 2A for Convert Real Number to Integer step 230.In FIG 4 control begins at Initialize Variable for Base 10 Exponent step 410 Because the numerical value of the real number changes during the process of performing Convert Real Number to Integer step 230 the base 10 exponent of the number is adjusted accordingly In one embodiment of the invention, the base 10 exponent variable is initialized t o have a value of zero Control then proceeds to Adjust Real Number for Treatment as Integer step 420.In Adjust Real for Treatment as Integer step 420 operations can be performed that compensate for the effects of the subsequent Extract Mantissa Bits into Integer step 450 Normally, the mantissa bits of a floating-point representation are treated as a fractional portion of the value being represented, and not as an integer In one embodiment of the invention, Adjust Real Number for Treatment as Integer step 420 can be implemented by dividing the current representation of the value by 252 This division operation offsets the later extraction of the mantissa bits into an integer that occurs in Extract Mantissa Bits into Integer step 450 Extraction of the mantissa bits into an integer produces a result that would have been produced if the mantissa bits were multiplied by 252 For formats other than IEEE 754 8-byte format, similar adjustments may need to be made. From Adjust Real Number for Trea tment as Integer step 420 control proceeds to Convert Current Representation of Real Number to have Value between 1 0 and 10 0 step 440 In one embodiment of the invention, Convert Current Representation of Real Number to have Value between 1 0 and 10 0 step 440 can be implemented to provide a substantial improvement over the technique described with reference to FIG 2B As noted earlier, the technique described with reference to FIG 2B Multiply Current Representation of Real Number by 10 step 239 may perform one multiplication operation for each digit of the number being converted Instead, in the embodiment shown in FIG 4 a maximum number of multiplication operations are performed for example, for IEEE 754 8-byte format, a maximum of 9 multiplication operations are performed FIGS 5A and 5B show one possible implementation of Convert Current Representation of Real Number to have Value between 1 0 and 10 0 step 440.Another possible implementation of Convert Current Representation of Real Number to have Value between 1 0 and 10 0 step 440 is to use a lookup table In one embodiment, a lookup table contains constants with values from 10 327 to 10 308 Each constant in the lookup table is a multiple of 10 or a multiple of 0 1 To convert the real number to have a value between 1 0 and 10 0, a single multiplication operation can be performed to produce the same result For example, if the current representation of the real number is between 10 243 and 10 244 inclusive , the constant 10 244 can be retrieved from the lookup table The current representation of the real number can be multiplied by the constant 10 244 which effectively moves the decimal point 244 places to the right in the base 10 representation of the number As a result, the current representation of the real number is between 1 0 and 10 0.From Convert Current Representation of Real Number to have Value between 1 0 and 10 0 step 440 control proceeds to Extract Mantissa Bits into Integer step 450 In one embodiment, the mantissa bits are extracted into a 64-bit integer format As mentioned previously, normally the mantissa bits of a floating-point representation are treated as a fractional portion of the value being represented, and not as an integer For a number represented in IEEE standard 754 floating-point format, extracting the mantissa bits into an integer format operates as if an implicit decimal point were moved from the beginning of the mantissa to the end Extracting the mantissa bits into an integer format has the effect of multiplying by 2 52 In addition, extracting the mantissa bits into an integer explicitly places the implicit 1 of the mantissa as the first left-most digit of the integer. As described above, to counteract this effect, Adjust Real Number for Treatment as an Integer step 430 was previously performed For example, the adjustment to the value in Adjust Real Number for Treatment as an Integer step 430 can be implemented by dividing the current representation of the real num ber by 2 52 which offsets the subsequent effect of multiplying by 2 52 which is the effect of extracting the mantissa bits into an integer For formats other than IEEE 754 8-byte format, similar adjustments may need to be made. From Extract Mantissa Bits into Integer step 450 control proceeds to Adjust Mantissa Bits step 460 The calculations performed thus far have ensured that the current representation of the real number has a leading digit between 1 and 9 in base 10 format The equivalent base 2 representation of the numerical leading digit therefore has a value between 1 2 0 and 9 2 3 1 , so that the unbiased value of the base 2 exponent is 0, 1, 2, or 3 To accurately represent the value in the integer format, the mantissa bits of IEEE standard 754 floating-point format can be adjusted by multiplying by the appropriate value, either 2 0 one, which has no effect , 2 1 2 2 or 2 3 Multiplication by 2 1 2 2 or 2 3 can be accomplished by shifting the mantissa bits to the left by, respectiv ely, 1, 2, or 3 positions. After Adjust Mantissa Bits step 460 the bits in the integer representation of the value are accurate Control proceeds to Convert Integer to Character String step 470 where the digits in the integer are converted to a character string In one embodiment, an additional process may be used at this point to round the integer so that the resulting rounded integer is converted to the shortest possible character string that accurately represents the value of the real number This rounding algorithm is discussed in further detail with reference to FIG 8 The conversion from integer format to character string format can be performed, for example, by readily available integer-to-character conversion functions One example of such an integer-to-character conversion function is the i64toa function of the C programming language, which converts a 64-bit integer to a character format and is available in various commercially-available run-time libraries. After Convert Integer to C haracter String step 470 the string contains the character values equivalent to the decimal representation of the value, with an implicit decimal point at the end of the character string To place the value into normalized form, the implicit decimal point may be moved, for example, from the end of the character string to the first position after the first character in the character string To reflect this change, the base 10 exponent is adjusted in Adjust Base 10 Exponent step 480 For example, if the character string has 14 characters, the decimal point is moved from the end of the character string by 13 positions to the left, with the result that the decimal point is positioned after the first character The numerical value of the base 10 exponent is adjusted to reflect this change To reflect movement of the decimal point by 13 positions to the left, a value of 13 is added to the base 10 exponent. From Adjust Base 10 Exponent step 480 control proceeds to Trim Trailing Zeroes from Characte r String step 490 where any trailing zeroes are trimmed from the end of the character string Control then returns to the flowchart of FIG 2A having completed the Convert Real Number to Integer step 230 Control then proceeds to Insert Decimal Point step 240 and Handle Exponent step 250 In one embodiment, an e and the value of the base 10 exponent are appended to the character string Other refinements may be made For example, if the base 10 exponent is 0, the e and the value of 0 may not be printed at all For small exponents, the decimal point may be repositioned for example, 6 225e1 may be printed simply as 62 25 Various other manipulations of the format of the value are within the scope of the invention. FIGS 5A and 5B show one implementation of the Convert Current Representation of Real Number to have Value between 1 0 and 10 0 step 440 of FIG 4 FIG 5A is used when the current representation of the real number has a value greater than or equal to 10 0 and must be decreased to fall betw een 1 0 inclusive and 10 0 exclusive FIG 5B is used when the current representation of the real number has a value less than 1 0.In FIG 5A an initial decision is made in Current Representation of Real Number 10 0 decision point 502 If the real number has a value that is 10 0 or greater, control proceeds to i 8 step 504 If the real number does not have a value that is 10 0 or greater, control proceeds to step 516 of the flowchart shown in FIG 5B. In FIG 5A at i 8 step 504 a counter i is initialized to have a value of 8 The reason that the counter i is initialized to 8 is explained in further detail below At Current Representation of Real Number 10 2 i decision point 506 a comparison is made of the size of the current representation of the real number with 10 raised to an exponent, where the exponent itself is a power of 2 Recall that 10 308 is the largest integer that can be represented in IEEE 754 8-byte format To convert the current representation of the real number to have a value bet ween 1 0 and 10 0, the current representation of the real number is manipulated by either multiplying or dividing by 10 raised to a power of 2 10 2 8 10 256 is the largest number less than or equal to 10 308 with an exponent that is a power of 2 Consequently, i is initially set to 8.At Current Representation of Real Number 10 2 i , decision point 506 if the current representation of the real number is greater than or equal to 10 2 i control proceeds to Multiply Current Representation of Real Number by 10 2 i step 508 where the current representation of the real number is decreased in size by multiplying the current representation of the real number by 10 2 i which is equivalent to dividing the current representation of the real number by 10 2 i Control then proceeds to Add 2 i to the Base 10 Exponent Variable step 510 where the exponent is increased to compensate for the smaller value of the current representation of the real number Control then proceeds to i i 1 step 512 where the val ue of the counter i is decremented in preparation for the next iteration of the loop Control proceeds to i 0 decision point 514 where a determination is made whether the counter i has a value less than 0, indicating that conversion of the current representation of the real number to a value between 1 0 and 10 0 is complete At i 0 decision point 514 if i has a value less than 0, Convert Current Representation of Real Number to have Value between 1 0 and 10 0 step 440 of FIG 4 is complete If i is not less than 0, control returns to Current Representation of Real Number 10 2 i decision point 506 to compare using a new value of i in the exponent. During iterations of the loop shown in FIG 5A up to 9 multiplication operations are performed These 9 multiplication operations include successively multiplying a current representation of the real number by a multiple of 0 1, thereby gradually decreasing the value of the current representation of the real number to a value between 1 0 inclusive an d 10 0 exclusive Note that each multiple of 0 1 is of the form 10 2 i for values of i from 0 through 8 For each multiplication operation, a corresponding adjustment is made to the base 10 exponent of the value to properly position the decimal point For example, if the value is multiplied by 10 8 then a value of 8 is added to the base 10 exponent, reflecting the fact that the value of the current representation of the number is smaller by 10 8.As noted previously, FIGS 5A and 5B show one implementation of the Convert Current Representation of Real Number to have Value between 1 0 and 10 0 step 440 of FIG 4 FIG 5B is used when the current representation of the real number has a value less than 1 0 and must be increased to fall between 1 0 and 10 0.In FIG 5B an initial decision is made in Current Representation of Real Number 1 0 decision point 516 If the real number has a value that is less than 1 0, control proceeds to i 8 step 518 If the real number does not have a value that is less t han 1 0, processing in FIG 5B is complete. In FIG 5B at i 8 step 518 a counter i is initialized to have a value of 8 At Current Representation of Real Number 10 2 i 1 decision point 520 a comparison is made of the size of the current representation of the real number with 10 raised to an exponent, where the exponent itself is a negative power of 2 minus one If the current representation of the real number is less than 10 2 i 1 control proceeds to Multiply Current Representation of Real Number by 10 2 i step 522 where the current representation of the real number is increased in size by multiplying the current representation of the real number by 10 2 i Control then proceeds to Add 2 i to the Base 10 Exponent Variable step 524 where the exponent is decreased to compensate for the larger value of the current representation of the real number Control then proceeds to i i 1 step 526 where the value of the counter i is decremented in preparation for the next iteration of the loop Control pro ceeds to i 0 decision point 528 where a determination is made whether the counter i has a value less than 0, indicating that conversion of the current representation of the real number to a value between 1 0 and 10 0 is complete At i 0 decision point 528 if i has a value less than 0, Convert Current Representation of Real Number to have Value between 1 0 and 10 0 step 440 of FIG 4 is complete If i is not less than 0, control returns to Current Representation of Real Number 10 2 i 1 decision point 520 to compare using a new value of i in the exponent. During iterations of the loop shown in FIG 5B up to 9 multiplication operations are performed These 9 multiplication operations include successively multiplying a current representation of the real number by a multiple of 10 For example, in IEEE 754 8-byte format, if the value 1 0, each successive operation multiplies a current representation of the value by one of the following multiples of 10 10 256 10 128 10 64 10 32 10 16 10 8 10 4 10 2 or 10 1 These multiplication operations thereby gradually increase the value of the current representation of the real number to a value between 1 0 and 10 0 Note that each multiple of 10 is of the form 10 2 i for values of i from 0 through 8 For each multiplication operation, a corresponding adjustment is made to the base 10 exponent of the value to properly position the decimal point For example, if the value is multiplied by 10 8 then a value of 8 is added to the base 10 exponent in other words, a value of 8 is subtracted from the base 10 exponent, reflecting the fact that the value of the current representation of the number is larger by 10 8.FIG 6A shows an example of a conversion of a floating-point representation of a number to a character string in accordance with the steps of the flowcharts of FIGS 4, 5A and 5 B The number being converted in this example is the decimal number 62 25 Initially, the number has a value of 6 225 10 1 as shown in the base 10 mantissa and exponent f ields The number has a binary value of 1 1111001 2 5 as shown in the base 2 mantissa and exponent fields Note that the implicit leading 1 is shown in the base 2 column of the table A base 10 variable is initialized to have a value of zero, as described with reference to Initialize Variable for Base 10 Exponent step 410.Control then proceeds to Adjust Real Number for Treatment as Integer step 420 of FIG 4 As described above, this step involves dividing the current representation of the value by 2 52 This division operation changes the base 2 exponent from 5 to 47 The result of the division operation in base 10 is 1 3822276656 10 14 as shown in the base 10 mantissa and exponent columns. Control then proceeds to Convert Current Representation of Real Number to have Value between 1 0 and 10 0 step 440 This step is described with reference to the flowchart of FIG 5B Recall that FIG 5B is used when the current representation of the real number has a value less than 1 0 and must be increased t o fall between 1 0 and 10 0.In FIG 5B an initial decision is made in Current Representation of Real Number 1 0 decision point 516 The real number 1 3822276656 10 14 has a value that is less than 1 0, so control proceeds to i 8 step 518 At Current Representation of Real Number 10 2 i 1 decision point 520 a comparison is made of the size of the current representation of the real number with 10 raised to an exponent, where the exponent itself is a negative power of 2 minus one In the example shown, the value of 1 3822276656 10 14 is not less than 10 2 i 1 until i 3, as shown in the next row of the table When i 3, 1 3822276656 10 14 is less than 10 2 i 1 10 7 At that point, the current representation of the real number is less than 10 2 i 1 so control proceeds to Multiply Current Representation of Real Number by 10 2 i step 522 where the current representation of the real number is increased in size by multiplying the current representation of the real number by 10 2 i 10 8 producing a bas e 10 result of 1 3822276656 10 6 as shown in the base 10 mantissa and exponent columns of the table Note that the base 2 number also changes as a result of the multiplication, producing a result of 1 0111 2 20 as shown in the base 2 mantissa and exponent columns of the table. Control then proceeds to Add 2 i to the Base 10 Exponent Variable step 524 where the base 10 exponent variable is decreased by a value of 8 to compensate for the larger value of the current representation of the real number, producing a base 10 exponent variable with a value of 8 Control then proceeds to i i 1 step 526 where the value of the counter i is decremented in preparation for the next iteration of the loop Control proceeds to i 0 decision point 528 where a determination is made whether the counter i has a value less than 0, indicating that conversion of the current representation of the real number to a value between 1 0 and 10 0 is complete At i 0 decision point 528 i now has a value of 2, so control retu rns to Current Representation of Real Number 10 2 i 1 decision point 520 to compare using a value of i 2 in the exponent. During iterations of the loop shown in FIG 6A three multiplication operations are performed These three multiplication operations include successively multiplying a current representation of the real number by a multiple of 10, in this case 10 8 10 4 and 10 2 These multiplication operations thereby gradually increase the value of the current representation of the real number to a value between 1 0 and 10 0 For each multiplication operation, a corresponding adjustment is made to the base 10 exponent of the value to properly position the decimal point For example, when the value is multiplied by 10 8 then a value of 8 is added to the base 10 exponent in other words, a value of 8 is subtracted from the base 10 exponent, reflecting the fact that the value of the current representation of the number is larger by 10 8.Upon completion of three iterations of the loop, the cu rrent base 10 representation of the value is 1 3822276656 10 0 which is a value between 1 and 10 The base 2 equivalent is 1 011 2 0 as shown in the last row of the table for step 440 The base 10 variable has a value of 14 Processing of Convert Current Representation of Real Number to have Value between 1 0 and 10 0 step 440 of FIG 4 is complete Control then proceeds to Extract Mantissa Bits into Integer step 450 of FIG 4.In Extract Mantissa Bits into Integer step 450 of FIG 4 the mantissa of the base 10 number is extracted into a 64-bit integer Recall that the implicit leading one is shown in the base 2 number column of the previous table Extracting the mantissa with the leading one produces the 64-bit integer shown Note that the extraction has the effect of moving the decimal point from after the implicit leading one to the end of the integer, or of moving the decimal point 52 places to the right i e this is the same effect as multiplying the value by 2 52 As described earlier, in Adj ust Real Number for Treatment as Integer step 420 the current representation of the value was divided by 2 52 in preparation for this effect Control proceeds to Adjust Mantissa Bits step 460 where the mantissa bits are adjusted to reflect the base 2 exponent The current base 2 exponent is 0, as shown in the table, so no adjustment is made at this step Control then proceeds to Convert Integer to Character String step 470 The resulting string has a value of 6225000000000000 A character is used to show a leading blank appended to the character string Control then proceeds to Adjust Base 10 Exponent step 480 where the base 10 exponent is adjusted to account for moving the implicit decimal point from the end of the character string 6225000000000000 to the left by 15 spaces thereby effectively dividing the integer value by 10 15 which is compensated by adding 15 to the base 10 exponent, changing the value from 14 to 1.After completion of Adjust Base 10 Exponent step 480 the character equival ent of the real number has been determined Control then proceeds to Trim Trailing Zeroes from Character String step 490 where trailing zeroes are trimmed from the character string to produce the shortest possible character string These trailing zeroes appear after the decimal point and therefore have no effect on the value or the base 10 exponent After Trim Trailing Zeroes from Character String step 490 control returns to Insert Decimal Point step 240 of FIG 2 where a decimal point is inserted into the character string In this example, the leftmost blank represented by is moved to a position after the first non-zero digit, and then the blank space is changed to a decimal point Control proceeds to Handle Exponent step 250 of FIG 2 where an e and the base 10 variable value of 1 are appended to the character string The result is a character string having the value 6 225e1 One of skill in the art will understand that this value may be formatted differently for printing, but the value is th e character equivalent of the real number 62 25.FIG 6B shows another example of a conversion of a floating-point representation of a number to a character string in accordance with the steps of the flowcharts of FIGS 4, 5A and 5 B The number being converted in this example is the decimal number 41 625 Initially, the number has a value of 4 1625 10 1 as shown in the base 10 mantissa and exponent fields The number has a binary value of 1 01001101 2 5 as shown in the base 2 mantissa and exponent fields A base 10 variable is initialized to have a value of zero, as described with reference to Initialize Variable for Base 10 Exponent step 410.Control then proceeds to Adjust Real Number for Treatment as Integer step 420 of FIG 4 As described above, this step involves dividing the current representation of the value by 2 52 This division operation changes the base 2 exponent from 5 to 47 The result of the division operation in base 10 is 9 242606 10 15 as shown in the base 10 mantissa and expo nent columns. The first table of FIG 6B shows four iterations of Convert Current Representation of Real Number to have Value between 1 0 and 10 0 step 440 As shown in the step column of the table, these iterations are for i having values of 3, 2, 1, and 0 Upon completion of four iterations of the loop, the current base 10 representation of the value is 9 242606 10 15 which is a value between 1 and 10 The base 2 equivalent is 1 001 2 3 as shown in the last row of the table for step 440 The base 10 variable has a value of 15 Processing of Convert Current Representation of Real Number to have Value between 1 0 and 10 0 step 440 of FIG 4 is complete Control then proceeds to Extract Mantissa Bits into Integer step 450 of FIG 4.In Extract Mantissa Bits into Integer step 450 of FIG 4 the mantissa of the base 2 number is extracted into a 64-bit integer, as shown in the second table Control proceeds to Adjust Mantissa Bits step 460 where the mantissa bits are adjusted to reflect the base 2 expon ent The current base 2 exponent is 3, as shown in the first table, so three zeros are appended at the end of the 64-bit integer Control then proceeds to Convert Integer to Character String step 470 The resulting string has a value of 41625000000000000 A character is used to show a leading blank appended to the character string Control then proceeds to Adjust Base 10 Exponent step 480 where the base 10 exponent is adjusted to account for moving the implicit decimal point from the end of the character string 41625000000000000 to the left by 16 spaces thereby dividing the integer value by 10 16 which is compensated by adding 16 to the base 10 exponent, changing the value from 15 to 1.After completion of Adjust Base 10 Exponent step 480 the character equivalent of the real number has been determined Control proceeds to Trim Trailing Zeroes from Character String step 490 where the trailing zeroes are trimmed to produce a character string of 41625 Control returns to Insert Decimal Point step 240 of FIG 2 where a decimal point is inserted into the character string In this example, the leftmost blank represented by is moved to a position after the first non-zero digit, and then the blank space is changed to a decimal point Control proceeds to Handle Exponent step 250 of FIG 2 where an e and the base 10 variable value of 1 are appended to the character string The result is a character string having the value 4 1625e1 One of skill in the art will understand that this value may be formatted differently for printing, but the value is the character equivalent of the real number 41 625.One issue related to formatting and printing floating-point numbers is conciseness As shown in the examples above, each binary floating-point number is represented as a fixed number of bits or bytes An infinite number of strings can accurately represent a single binary floating-point number because the binary floating-point number has a fixed number of bits and the string can have an infinite numbe r of characters, at least theoretically Even when taking into account the fact that computer memory is finite, many different character strings can be used to represent a single binary floating-point number having a fixed number of bits or bytes. FIG 7 illustrates rounding of floating point numbers using three fixed binary floating-point numbers A binary representation 710 B of each number is shown, along with a decimal representation 710 D of the number The numbers are next to each other in sequence, such that only the least significant bits change Because of the limited number of bits, no fixed binary floating-point number can be represented between the numbers. These three numbers are shown on a real number line 720 in FIG 7 Because of the fixed number of bits, none of the real numbers between these points can be uniquely represented Thus, real numbers between two adjacent values must be rounded to the nearest floating-point number One way to round the real number is to take the mid-p oint between two floating-point numbers Real numbers falling between those two mid-points are rounded to the same binary floating-point number Thus, the real numbers that fall within the segment 732 between the two mid-points on real number line 730 are rounded to 01 The IEEE 754 specification provides a specification for rounding the mid-points. The real numbers in segment 732 of real number line 730 show that one binary floating-point number can represent an infinite number of real numbers Each real number can be represented as a string of characters thus, each binary floating-point number can be represented as an infinite number of strings When formatting the real number for presentation, it is preferable to choose the shortest character string from the infinite number of possible character strings. FIG 8 is a flowchart for determining the shortest character string to represent a floating point number in accordance with one embodiment of the invention As noted above, this process may be used as one implementation of Convert Integer to Character String step 470 of FIG 4 to determine the shortest possible string that accurately represents the value of the floating point number The conversion from the floating point value to an integer can be performed by performing steps 410 through 460 of the flowchart of FIG 4.When converting the resulting integer to a character string, the implementation of Convert Integer to Character String 470 can include the method shown in FIG 8 To determine the number of digits that the value can be rounded, the algorithm calculates mid-points between two pairs of the three numbers similar to the two mid-points related to segment 732 of FIG 7 The least significant digits are rounded, keeping the desired number between the two mid-points The desired number is then converted to a character string using a standard integer-to-character conversion function as described above with reference to Convert Integer to Character String step 470 of FIG 4. The floating-point number to be converted is stored in a floating-point variable named Value and in an integer format named IValue The rounding process begins in Calculate Upper and Lower Adjacent Floating Point Values step 810 where the immediately adjacent floating point values are calculated Calculation of the Lower value can be performed by subtracting 1 from the mantissa bits for Value The Upper value can be calculated by adding 1 to the mantissa bits for Value Overflow and underflow conditions should be addressed when adding or subtracting values from the mantissa bits For example, if the mantissa bits are all 0s zeroes , the exponent should be adjusted to avoid mantissa underflow If the mantissa bits are all 1s, the exponent should be adjusted to avoid mantissa overflow. Control proceeds from Calculate Upper and Lower Adjacent Floating Point Values step 810 to Convert Upper and Lower to Integers step 820 At this point, steps 410 through 460 of the flowchart of FIG 4 can be used t o convert Upper and Lower to integers The integer forms of Value, Upper, and Lower are referred to herein as IValue, IUpper, and ILower Control then proceeds to Calculate Mid-points step 830 An IMidUpper mid-point between IUpper and IValue is calculated as IUpper IValue 2 Value The value of IValue is added to avoid potential overflow An IMidLower mid-point between ILower and IValue is calculated as UValue ILower 2 ILower. From Calculate Mid-points step 830 to Round Integer step 840 Round Integer step 440 is discussed in further detail with reference to FIG 9 Control proceeds from Round Integer step 840 to Convert Rounded Integer to Character String step 850 The rounded integer is then converted to a character string using a standard integer-to-character conversion function as described above with reference to Convert Integer to Character String step 470 of FIG 4 At this point, Convert Integer to Character String 470 of FIG 4 is complete, and control returns to Adjust Base 10 Exponent st ep 480 of FIG 4.FIG 9 shows one possible implementation of the Round Integer step 840 of FIG 8 in accordance with one embodiment of the invention At Divisor Initial Value e g 10,000 step 910 a divisor is set to an initial value In this example, the divisor is set to 10,000 Control proceeds to Divisor 1 decision point 920 where a determination is made whether the divisor now has a value of 1 Having just assigned a value of 10,000 to the divisor, the result of the determination at Divisor 1 decision point 920 is no, and control proceeds to IMod IValue Modulus Divisor step 930 IMod IValue Modulus Divisor step 930 places the result of IValue Modulus Divisor into the IMod variable The modulus function divides the number by the divisor and returns the remainder from the division operation. From IMod IValue Modulus Divisor step 930 control proceeds to IValue Divisor IMod IMidUpper step 940 IValue Divisor IMod IMidUpper step 940 determines whether the difference between IValue and Divisor IMod is less than the variable IMidUpper, which would indicate IValue can be rounded up If so, control proceeds to IValue IValue Divisor IMod step 950 where Ivalue is rounded by incrementing IValue by Divisor IMod Control then proceeds to Return Rounded Integer IValue for Conversion to Character String step 990 Processing of Round Integer step 840 of FIG 8 is then complete, and control returns to Convert Rounded Integer to Character String step 850 where the rounded value of IValue is converted to a character string At that point, processing of Convert Integer to Character String step 470 of FIG 4 is completed, and control returns to Adjust Base 10 Exponent step 480 of FIG 4.Referring again to FIG 9 at IValue Divisor IMod IMidUpper step 940 if the difference between IValue and Divisor IMod is not less than the variable IMidUpper, control proceeds to IValue IMod IMidLower step 970 If IValue IMod IMidLower step 970 indicates that IValue IMod is greater than the value of IMidLower, IValue can be rounded down Control proceeds to IValue IValue IMod step 960 where IValue is decreased by the amount of IMod Control then proceeds to Return Rounded Integer IValue for Conversion to Character String step 990 Processing of Round Integer step 840 of FIG 8 is then complete, and control returns to Convert Rounded Integer to Character String step 850 where the rounded value of IValue is converted to a character string At that point, processing of Convert Integer to Character String step 470 of FIG 4 is completed, and control returns to Adjust Base 10 Exponent step 480 of FIG 4.Referring again to FIG 9 at IValue IMod IMidLower step 970 if the difference between IValue and IMod is not greater than the value if IMidLower, rounding the current value of IValue would not produce the shortest possible character string Control proceeds to Divisor Divisor 10 step 980 The divisor is divided by 10, and control returns to Divisor 1 decision point 920 where the value of the divisor is tested If the v alue of the divisor is 1, control proceeds to Return Rounded Integer IValue for Conversion to Character String step 990 Processing of Round Integer step 840 of FIG 8 is then complete, and control returns to Convert Rounded Integer to Character String step 850 where the rounded value of IValue is converted to a character string At that point, processing of Convert Integer to Character String step 470 of FIG 4 is completed, and control returns to Adjust Base 10 Exponent step 480 of FIG 4.In the algorithm presented in FIG 8 three floating-point numbers are converted into 64-bit integers in order to find each mid-point This process can be reduced by calculating only integer values for Lower, ILower and IMidLower A value of the upper mid-point can be calculated as IMidUpper IValue IValue IMidLower Mantissa overflow and underflow conditions must be taken into consideration when calculating the upper mid-point. An alternative solution is to use a look up table that has the delta IValue IMidLow er already calculated Boundary cases can be handled by dividing or multiplying the delta by 2 The look-up table would contain one entry for each possible base-2 exponent value For conversion of 8-byte floating-point numbers, the look-up table would have 2,048 entries Each entry in the table would be represented by 2 bytes, so the look-up table would require 4 KB of memory. FIG 10A shows an example of converting an integer to a character string in accordance with the flowcharts of FIGS 8 and 9 Each calculation will be described with reference to the steps of the flowcharts of FIGS 8 and 9 The initial value of 41 625 is the value to be converted At Calculate Upper and Lower Adjacent Floating Point Values step 810 the values shown in table 10 A - 1 Lower and Upper columns are calculated Control then proceeds to Convert Upper and Lower to Integers step 820 which are represented by IUpper and ILower columns of the first row in Table 10 A - 2 At this point, steps 410 through 460 of the flowchar t of FIG 4 can be used to convert Upper and Lower to integers Control then proceeds to Calculate Mid-points step 830 and the results are shown in the IMidLower and IMidUpper columns of the second row of Table 10 A - 2 As described above, the IMidUpper mid-point between IUpper and IValue is calculated as IUpper IValue 2 IValue The value of IValue is added to avoid potential overflow The IMidLower mid-point between ILower and IValue is calculated as IValue ILower 2 ILower. From Calculate Mid-points step 830 control proceeds to Round Integer step 840 This step is represented by Table 10 A - 3 The first row corresponds to Divisor Initial Value e g 10,000 step 910 where the Divisor variable is set to 10,000 Control proceeds to Divisor 1 decision point 920 where a determination is made whether the divisor now has a value of 1 Having just assigned a value of 10,000 to the divisor, the result of the determination at Divisor 1 decision point 920 is no, and control proceeds to IMod IValue Modulus D ivisor step 930 As shown in the second row of Table 10 A - 3 IMod is assigned the result of IValue Modulus Divisor in this case 0 In this row, the modulus function divides the number 41625000000000000 by the divisor 10,000 and returns the remainder 0 from the division operation. From IMod IValue Modulus Divisor step 930 control proceeds to IValue Divisor IMod IMidUpper step 940 IValue Divisor IMod IMidUpper step 940 determines whether the difference between IValue and Divisor IMod is less than the variable IMidUpper, which would indicate IValue can be rounded up At IValue Divisor IMod IMidUpper step 940 the difference between IValue and Divisor IMod is not less than the variable IMidUpper, so control proceeds to IValue IMod IMidLower step 970 IValue IMod IMidLower step 970 indicates that IValue IMod is greater than the value of IMidLower, so that IValue can be rounded down In this example, IValue IMod is greater than the value of IMidLower, so control proceeds to IValue IValue IMod step 960 where IValue is decreased by the amount of IMod which is zero in this case Control then proceeds to Return Rounded Integer IValue for Conversion to Character String step 990 The value returned is the value of IValue, 41625000000000000 However, because the last twelve characters are trailing zeroes, those characters will be trimmed in Trim Trailing Zeroes from Character String step 490 of FIG 4 Therefore, the shortest character string will actually be 41625.FIG 10B shows another example of converting an integer to a character string in accordance with the flowcharts of FIGS 8 and 9 The initial value of 0 1499999999999999944 is the value to be converted At Calculate Upper and Lower Adjacent Floating Point Values step 810 the values shown in table 10 B - 1 Lower and Upper columns are calculated Control then proceeds to Convert Upper and Lower to Integers step 820 which are represented by IUpper and ILower columns of the first row in Table 10 B - 2 At this point, steps 410 through 460 of the flowchart of FIG 4 can be used to convert Upper and Lower to integers Control then proceeds to Calculate Mid-points step 830 and the results are shown in the IMidLower and IMidUpper columns of the second row of Table 10 B - 2 As described above, the IMidUpper mid-point between IUpper and IValue is calculated as IUpper IValue 2 IValue The value of IValue is added to avoid potential overflow The IMidLower mid-point between ILower and IValue is calculated as IValue ILower 2 ILower. From Calculate Mid-points step 830 control proceeds to Round Integer step 840 This step is represented by Table 10 B - 3 The first row corresponds to Divisor Initial Value e g 10,000 step 910 where the Divisor variable is set to 10,000 Control proceeds to Divisor 1 decision point 920 where a determination is made whether the divisor now has a value of 1 Having just assigned a value of 10,000 to the divisor, the result of the determination at Divisor 1 decision point 920 is no, and control proceeds to IMod IVa lue Modulus Divisor step 930 As shown in the second row of Table 10 A - 3 IMod is assigned the result of IValue Modulus Divisor in this case 9,944 In this row, the modulus function divides the number 1499999999999999944 by the divisor 10,000 and returns the remainder 9,944 from the division operation. From IMod IValue Modulus Divisor step 930 control proceeds to IValue Divisor IMod IMidUpper step 940 IValue Divisor IMod IMidUpper step 940 determines whether the difference between IValue and Divisor IMod is less than the variable IMidUpper, which would indicate IValue can be rounded up In this example, the difference between IValue and Divisor IMod is less than the variable IMidUpper, so control proceeds to IValue IValue Divisor IMod step 950 At IValue IValue Divisor IMod step 950 IValue is rounded by incrementing IValue by Divisor IMod , producing a value of 1500000000000000000 Control then proceeds to Return Rounded Integer IValue for Conversion to Character String step 990 Processing o f Round Integer step 840 of FIG 8 is then complete, and control returns to Convert Rounded Integer to Character String step 850 where the rounded value of IValue is converted to a character string At that point, processing of Convert Integer to Character String step 470 of FIG 4 is completed, and control returns to Adjust Base 10 Exponent step 480 of FIG 4 The character string will be trimmed to 15 when the trailing zeroes are trimmed in Trim Trailing Zeroes from Character String step 490 of FIG 4.FIG 10C shows another example of converting an integer to a character string in accordance with the flowcharts of FIGS 8 and 9 The initial value of 1 02099847614441939e-130 is the value to be converted At Calculate Upper and Lower Adjacent Floating Point Values step 810 the values shown in table 10 C - 1 Lower and Upper columns are calculated Control then proceeds to Convert Upper and Lower to Integers step 820 which are represented by IUpper and ILower columns of the first row in Table 10 C - 2 At this point, steps 410 through 460 of the flowchart of FIG 4 can be used to convert Upper and Lower to integers Control then proceeds to Calculate Mid-points step 830 and the results are shown in the IMidLower and IMidUpper columns of the second row of Table 10 C - 2 As described above, the IMidUpper mid-point between IUpper and IValue is calculated as IUpper IValue 2 IValue The value of IValue is added to avoid potential overflow The IMidLower mid-point between ILower and IValue is calculated as IValue ILower 2 ILower. From Calculate Mid-points step 830 control proceeds to Round Integer step 840 This step is represented by Table 10 C - 3 The first row corresponds to Divisor Initial Value e g 10,000 step 910 where the Divisor variable is set to 10,000 Control proceeds to Divisor 1 decision point 920 where a determination is made whether the divisor now has a value of 1 Having just assigned a value of 10,000 to the divisor, the result of the determination at Divisor 1 decision point 92 0 is no, and control proceeds to IMod IValue Modulus Divisor step 930 As shown in the second row of Table 10 C - 3 IMod is assigned the modulus Divisor of IValue in this case 1,939 In this row, the modulus function divides the number 1 02099847614441939e-130 by the divisor 10,000 and returns the remainder 1,939 from the division operation. From IMod IValue Modulus Divisor step 930 control proceeds to IValue Divisor IMod IMidUpper step 940 IValue Divisor IMod IMidUpper step 940 determines whether the difference between IValue and Divisor IMod is less than the variable IMidUpper, which would indicate IValue can be rounded up In this example, the difference between IValue and Divisor IMod is not less than the variable IMidUpper, so control proceeds to IValue IMod IMidLower step 970 At IValue IMod IMidLower step 970 IValue IMod is not greater than the value of IMidLower, so control proceeds to Divisor Divisor 10 step 980 where the divisor is divided by 10 Control then returns to Divisor 1 de cision point 920 where a determination is made whether the divisor has reached a value of 1 At this point, the divisor has a value of 1000, as shown in the third row of Table 10 C - 3.The fourth through the eighth rows of Table 10 C - 3 show that rounding is not possible and the divisor is reduced in multiple iterations of Divisor Divisor 10 step 980 At the eighth row, the difference between IValue and Divisor IMod is less than the variable IMidUpper, so control proceeds to IValue IValue Divisor IMod step 950 At IValue IValue Divisor IMod step 950 IValue is rounded by incrementing IValue by Divisor IMod , producing a value of 102099847614441940 Control then proceeds to Return Rounded Integer IValue for Conversion to Character String step 990 Processing of Round Integer step 840 of FIG 8 is then complete, and control returns to Convert Rounded Integer to Character String step 850 where the rounded value of IValue is converted to a character string At that point, processing of Convert Inte ger to Character String step 470 of FIG 4 is completed, and control returns to Adjust Base 10 Exponent step 480 of FIG 4 The character string will be trimmed to 10209984761444194 when the trailing zeroes are trimmed in Trim Trailing Zeroes from Character String step 490 of FIG 4.The present invention has many advantages By significantly reducing the number of multiplication operations in converting a real number from a floating point representation to a character string, the conversion can be performed more quickly, thereby increasing the speed of conversion The process can be used by web servers, increasing the throughput of web servers, as well as by other software performing conversion of real numbers to character strings The shortest possible character string that accurately represents the value can be produced, thereby making reports and screen displays easier to read and improving customer satisfaction. The present invention is well adapted to attain the advantages mentioned as we ll as others inherent therein While the present invention has been depicted, described, and is defined by reference to particular embodiments of the invention, such references do not imply a limitation on the invention, and no such limitation is to be inferred The invention is capable of considerable modification, alteration, and equivalents in form and function, as will occur to those ordinarily skilled in the pertinent arts The depicted and described embodiments are examples only, and are not exhaustive of the scope of the invention. The foregoing detailed description has set forth various embodiments of the present invention via the use of block diagrams, flowcharts, and examples It will be understood by those within the art that each block diagram component, flowchart step, operation and or component illustrated by the use of examples can be implemented, individually and or collectively, by a wide range of hardware, software, firmware, or any combination thereof. The present inventio n has been described in the context of fully functional computer systems however, those skilled in the art will appreciate that the present invention is capable of being distributed as a program product in a variety of forms, and that the present invention applies equally regardless of the particular type of signal bearing media used to actually carry out the distribution Examples of signal bearing media include recordable media such as floppy disks and CD-ROM, transmission type media such as digital and analog communications links, as well as media storage and distribution systems developed in the future. The above-discussed embodiments may be implemented by software modules that perform certain tasks The software modules discussed herein may include script, batch, or other executable files The software modules may be stored on a machine-readable or computer-readable storage medium such as a disk drive Storage devices used for storing software modules in accordance with an embodiment o f the invention may be magnetic floppy disks, hard disks, or optical discs such as CD-ROMs or CD-Rs, for example A storage device used for storing firmware or hardware modules in accordance with an embodiment of the invention may also include a semiconductor-based memory, which may be permanently, removably or remotely coupled to a microprocessor memory system Thus, the modules may be stored within a computer system memory to configure the computer system to perform the functions of the module Other new and various types of computer-readable storage media may be used to store the modules discussed herein. The above description is intended to be illustrative of the invention and should not be taken to be limiting Other embodiments within the scope of the present invention are possible Those skilled in the art will readily implement the steps necessary to provide the structures and the methods disclosed herein, and will understand that the process parameters and sequence of steps are give n by way of example only and can be varied to achieve the desired structure as well as modifications that are within the scope of the invention Variations and modifications of the embodiments disclosed herein can be made based on the description set forth herein, without departing from the scope of the invention Consequently, the invention is intended to be limited only by the scope of the appended claims, giving full cognizance to equivalents in all respects. Binary Calculator. दशमलव परिपथों के साथ गणना करना चाहते हैं आपको उन्हें पहले कन्वर्ट करना चाहिए। बाइनरी कैलक्यूलेटर के बारे में। यह एक मनमाना-सटीक बाइनरी कैलकुलेटर है। यह दो घटकों को विभाजित करके विभाजित कर सकता है या विभाजित कर सकता है यह बहुत बड़े पूर्णांक पर काम कर सकता है और बहुत छोटा आंशिक मान और संयोजन यह कैलकुलेटर है, डिज़ाइन से, बहुत सरल है, आप इसे अपने सबसे बुनियादी रूप में द्विआधारी नंबरों का पता लगाने के लिए उपयोग कर सकते हैं यह शुद्ध बाइनरी नंबर पर काम करता है, न कि कम्प्यूटर संख्या स्वरूप जैसे दो एस पूरक या आईईईई बाइनरी फ्लोटिंग-प्वाइंट। बाइनरी कैलकुलेटर. प्रत्येक बॉक्स में एक ऑपरैंट प्रविष्ट करें प्रत्येक प्रक्रम को कोई अल्पविराम या रिक्त स्थान नहीं के साथ एक सकारात्मक या नकारात्मक संख्या होना चाहिए, एक अंश के रूप में व्यक्त नहीं किया गया है, और न कि वैज्ञानिक संकेतन में, अंकीय मूल्यों को एक त्रिज्या बिंदु से संकेत दिया जाता है, नहीं, और ऋणात्मक संख्या एक शून्य चिह्न के साथ prefixed हैं। एक ऑपरेशन चुनें.आप द्विआधारी परिणाम में प्रदर्शित बिट्स की संख्या बदलें, यदि डिफ़ॉल्ट से अलग यह केवल प्रभाग पर लागू होता है, और उसके बाद केवल डब्ल्यू मुर्गी के उत्तर में एक असीमित आंशिक हिस्सा है। क्लिक करें कार्रवाई को निष्पादित करने के लिए गणना करें। फ़ॉर्म को रीसेट करने के लिए साफ़ करें क्लिक करें और खरोंच से शुरू करें। यदि आप किसी ऑपरेंड को बदलना चाहते हैं, तो बस मूल संख्या पर टाइप करें और क्लिक करें पर क्लिक करें कोई क्लिक करने की आवश्यकता नहीं है पहले ही साफ़ करें इसी तरह, आप ऑपरेटर को बदल सकते हैं और ऑपरेंड को भी रख सकते हैं। ऑपरेशन के परिणाम के अलावा, ऑपेरेन्ड में अंकों की संख्या और परिणाम प्रदर्शित होता है उदाहरण के लिए, 1 1101 111 100011 1101 1010110111 की गणना करते समय, अंकीय अंक बॉक्स प्रदर्शित करता है 1 4 3 6 4 10 इसका अर्थ है कि ऑपरैंड 1 के पूर्णांक भाग में एक अंक और उसके आंशिक भाग में चार अंक हैं, ऑपरेंड 2 के पूर्णांक भाग में तीन अंक और उसके आंशिक हिस्से में छह अंक हैं, और परिणाम में चार अंकों के अपने पूर्णांक भाग में और दस अंकों को उसके अंश में विभाजित करते हैं। विभाजन, घटाव, और गुणन हमेशा एक परिमित परिणाम उत्पन्न करते हैं, लेकिन विभाजन वास्तव में हो सकता है, ज्यादातर मामलों में एक अनंत पुनरावृत्ति आंशिक मान उत्पन्न होता है अनंत परिणाम बीट के निर्दिष्ट संख्या में गोल नहीं किया गया अनंत परिणाम परिणाम के साथ जुड़े एल्िप्सिस के साथ उल्लेखनीय हैं, और प्रतीक के रूप में विभेदक अंकों की संख्या के रूप में, जो कि डिएडिशिक अंशों का प्रतिनिधित्व करते हैं, इसका परिणाम परिमित होगा और पूर्ण परिशुद्धता में प्रदर्शित होगा चाहे फॉर्क्शनल बिट्स की संख्या के लिए सेटिंग। उदाहरण के लिए, 1 1010 से 24 आंशिक बिट्स 0 000110011001100110011001 है, साथ में अंकीय अंक 0 0 0 0 11 100 0 11, अंकीय अंक के साथ 0 0 0 0 2 2. फ्लोटिंग एक्सप्लोर करने के लिए कैलक्यूलेटर का उपयोग करना - पांच अंकगणित। यद्यपि यह कैलकुलेटर शुद्ध बाइनरी अंकगणितीय को लागू करता है, तो आप इसे फ़्लोटिंग-बिंदु अंकगणितीय का पता लगाने के लिए उपयोग कर सकते हैं उदाहरण के लिए, आप जानना चाहते हैं कि आईईईई दोहरे-सटीक बाइनरी फ़्लोटिंग-पॉइंट अंकगणित, 12 9 95 10 12 99 5 का प्रयोग क्यों करना है, लेकिन 12 9 95 100 12 994 99 99 99 99 99 99 8181010596454143524169 921875. अस्थायी बिंदु रूपांतरण और सीमित-सटीक द्विआधारी अंकगणितीय दशमलव को फ्लोटिंग-प्वाइंट रूपांतरण वर्जन अयोग्यता का परिचय देता है क्योंकि दशमलव परिपथ में सटीक अस्थायी बिंदु समकक्ष नहीं हो सकता है, सीमित-सटीक द्विआधारी अंकगणित असंगति का कारण है क्योंकि बाइनरी गणना में संग्रहीत किया जा सकता है की तुलना में अधिक बिट्स उत्पन्न हो सकते हैं इन मामलों में, गोलाकार होता है .10 और 100 दोनों दशमलव सटीक अस्थायी हैं क्रमशः 1010 और 1100100 के बराबर, लेकिन 12 9 9 5 में केवल एक अनुमानित प्रतिनिधित्व है द्विआधारी कनवर्टर के लिए मेरा दशमलव आपको बताएगा कि, शुद्ध बाइनरी में, 12 9 95 में एक अनंत दोहराव अंश है .0000001 111100110011001100110011001100110011001100110 011.यह 53 बिट्स की डबल - प्रिसिशन, यह एस। जो 129 9 49 99 99 99 99 9988631316228389702606201171875 दशमलव दशमलव में है। 12 9 95 10 की गणना की जाती है। जो बराबर है 10100010011 011111111111111111111111111111111111111111 1. यह 54 महत्वपूर्ण बिट्स हैं, इसलिए जब यह 53 बीट्स के लिए गोल हो जाता है, तो 1 99 95 100 की गणना की जाती है जो कि 11001011000010 1111111111111111111111111111111111111111111 के बराबर है। यह 56 महत्वपूर्ण बिट्स हैं ng, so when it s rounded to 53 bits it becomes. which equals 12994 999999999998181010596454143524169921875.To work through this example, you had to act like a computer, as tedious as that was First, you had to convert the operands to binary, rounding them if necessary then, you had to multiply them, and round the result. For practical reasons, the size of the inputs and the number of fractional bits in an infinite division result is limited If you exceed these limits, you will get an error message But within these limits, all results will be accurate in the case of division, results are accurate through the truncated bit position.

No comments:

Post a Comment