[Python-Dev] float.decode()? (original) (raw)
Alex Martelli aleax@aleax.it
Tue, 16 Apr 2002 00:05:39 +0200
- Previous message: [Python-Dev] float.decode()?
- Next message: [Python-Dev] float.decode()?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Previous message: [Python-Dev] float.decode()?
- Next message: [Python-Dev] float.decode()?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]