From 2c5b8ec6d95cf68650265941530e5ce38c8dd6d9 Mon Sep 17 00:00:00 2001 From: Chris Larson Date: Thu, 9 Dec 2004 09:47:41 +0000 Subject: Merge oe-devel@oe-devel.bkbits.net:openembedded into hyperion.kergoth.com:/home/kergoth/code/openembedded 2004/12/09 03:39:39-06:00 kergoth.com!kergoth Break people's builds again.. this time moving the packages into a packages/ subdir to clean things up a bit. BKrev: 41b81f3dvlp3rU7_8MUXLcI8LDdDoA --- packages/python/python-soappy-0.11.3/fpconst.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 packages/python/python-soappy-0.11.3/fpconst.py (limited to 'packages/python/python-soappy-0.11.3/fpconst.py') diff --git a/packages/python/python-soappy-0.11.3/fpconst.py b/packages/python/python-soappy-0.11.3/fpconst.py new file mode 100644 index 0000000000..e69de29bb2 -- cgit v1.2.3 From 6579e8daf68dd520b702412208bfeae85af6fadc Mon Sep 17 00:00:00 2001 From: Michael Lauer Date: Tue, 8 Feb 2005 18:05:47 +0000 Subject: make python 2.4 as default, move python-sip into python/, make sip4 as default BKrev: 4208ff7b-sgl7QbT_1xhYPmdi-Oy4g --- packages/python/python-soappy-0.11.3/fpconst.py | 111 ++++++++++++++++++++++++ 1 file changed, 111 insertions(+) (limited to 'packages/python/python-soappy-0.11.3/fpconst.py') diff --git a/packages/python/python-soappy-0.11.3/fpconst.py b/packages/python/python-soappy-0.11.3/fpconst.py index e69de29bb2..3509a139bb 100644 --- a/packages/python/python-soappy-0.11.3/fpconst.py +++ b/packages/python/python-soappy-0.11.3/fpconst.py @@ -0,0 +1,111 @@ +"""Utilities for handling IEEE 754 floating point special values + +This python module implements constants and functions for working with +IEEE754 double-precision special values. It provides constants for +Not-a-Number (NaN), Positive Infinity (PosInf), and Negative Infinity +(NegInf), as well as functions to test for these values. + +The code is implemented in pure python by taking advantage of the +'struct' standard module. Care has been taken to generate proper +results on both big-endian and little-endian machines. Some efficiency +could be gained by translating the core routines into C. + +See +for reference material on the IEEE 754 floating point standard. + +Further information on this package is available at +. + +Author: Gregory R. Warnes +Date:: 2003-04-08 +Copyright: (c) 2003, Pfizer, Inc. +""" + +__version__ = "0.6.0" +ident = "$Id$" + +import struct + +# check endianess +_big_endian = struct.pack('i',1)[0] != '\x01' + +# and define appropriate constants +if(_big_endian): + _HW = 0 + _LW = 1 + + NaN = struct.unpack('d', '\x7F\xFF\xFF\xFF\xFF\xFF\xFF\xFF')[0] + PosInf = struct.unpack('d', '\x7F\xF0\x00\x00\x00\x00\x00\x00')[0] + NegInf = -PosInf + +else: + _HW = 1 + _LW = 0 + + NaN = struct.unpack('d', '\x00\x00\x00\x00\x00\x00\xf8\xff')[0] + PosInf = struct.unpack('d', '\x00\x00\x00\x00\x00\x00\xf0\x7f')[0] + NegInf = -PosInf + +def _double_as_longs(dval): + "Use struct.unpack to decode a double precision float into two longs" + tmp = struct.unpack('ll',struct.pack('d', dval)) + return (tmp[_HW], tmp[_LW]) + + +## +## Functions to extract components of the IEEE 754 floating point format +## + +def _sign(dval): + "Extract the sign bit from a double-precision floating point value" + ll = _double_as_longs(dval) + return ll[0] >> 31 & 0x01 + +def _exponent(dval): + """Extract the exponentent bits from a double-precision floating + point value. + + Note that for normalized values, the exponentdent bits have an offset + of 1023. As a consequence, the actual exponentent is obtained + by subtracting 1023 for the value returned by this function + """ + ll = _double_as_longs(dval) + return (ll[0] >> 20) & 0x7ff + +def _mantissa(dval): + """Extract the _mantissa bits from a double-precision floating + point value.""" + + ll = _double_as_longs(dval) + mantissa0 = (ll[0] & 0x000fffffL) << 32 + mantissa1 = ll[1] + return mantissa0 + mantissa1 + +## +## Functions to test for IEEE 754 special values +## + +def isNaN(value): + "Determine if the argument is a IEEE 754 NaN (Not a Number) value." + return (_exponent(value)==0x7ff and _mantissa(value)!=0) + +def isInf(value): + """Determine if the argument is an infinite IEEE 754 value (positive + or negative inifinity)""" + return (_exponent(value)==0x7ff and _mantissa(value)== 0) + +def isFinite(value): + """Determine if the argument is an finite IEEE 754 value (i.e., is + not NaN, positive or negative inifinity)""" + return (_exponent(value)!=0x7ff) + + +def isPosInf(value): + "Determine if the argument is a IEEE 754 positive infinity value" + return (_sign(value)==0 and _exponent(value)==0x7ff and \ + _mantissa(value)== 0) + +def isNegInf(value): + "Determine if the argument is a IEEE 754 negative infinity value" + return (_sign(value)==1 and _exponent(value)==0x7ff and \ + _mantissa(value)== 0) -- cgit v1.2.3 From c8e5702127e507e82e6f68a4b8c546803accea9d Mon Sep 17 00:00:00 2001 From: Koen Kooi Date: Thu, 30 Jun 2005 08:19:37 +0000 Subject: import clean BK tree at cset 1.3670 --- packages/python/python-soappy-0.11.3/fpconst.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages/python/python-soappy-0.11.3/fpconst.py') diff --git a/packages/python/python-soappy-0.11.3/fpconst.py b/packages/python/python-soappy-0.11.3/fpconst.py index 3509a139bb..a1f8f47e3a 100644 --- a/packages/python/python-soappy-0.11.3/fpconst.py +++ b/packages/python/python-soappy-0.11.3/fpconst.py @@ -22,7 +22,7 @@ Copyright: (c) 2003, Pfizer, Inc. """ __version__ = "0.6.0" -ident = "$Id$" +ident = "$Id: fpconst.py,v 1.8 2003/05/12 15:14:00 warnes Exp $" import struct -- cgit v1.2.3