A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2002-April/023301.html below:

[Python-Dev] float.decode()?

[Python-Dev] float.decode()? [Python-Dev] float.decode()?Alex Martelli aleax@aleax.it
Tue, 16 Apr 2002 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




RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4