[Python-Dev] float.decode()?

Alex Martelli aleax@aleax.it
2002年4月16日 00:05:39 +0200


On Monday 15 April 2002 23:56, Neil Schemenauer wrote:
> Common Lisp has a function called decode-float:
>> (decode-float float) => significand, exponent, sign
	...
> How hard would it be to write a method like this for Python floats? I

You mean something like:
import math
def decode_float(f):
 m, e = math.frexp(f)
 mabs = math.fabs(m)
 return mabs, e, mabs and (m/mabs)
or am I missing something?
Alex

AltStyle によって変換されたページ (->オリジナル) /