math.frexp - what's it mean?

Tim Peters at
Thu Sep 13 01:22:35 CEST 2001

[Skip Montanaro]
> Not being a numeric type person, "frexp" conjured up absolutely
> no mnemonic significance for me.  The library reference manual was no
> help either.  Finally, I tried "man frexp" and got "convert floating-
> point number to fractional and integral components".

That's a particularly lame man page -- I'd only say that of modf(), which
actually does break a float into fractional and integral components (like
math.modf(7.25) == (0.25, 7.0)).

> Now I know what it means mnemonically ("FRaction EXPonent", I guess),
> but the name is still perplexing.

Good for you, Skip!  I never had any idea what it meant, and never thought
to wonder.  When I was learning C and Unix, it was just another senseless
string to memorize ('cat' to copy a file to stdout, 'ls' to display a
directory, 'frexp' to break up a float, 'ldexp' to multiply by a power of 2,
... all the same to me at the time).

> Why not "manexp"?

Why 'modf'?  OS people can't even name OS functions sensibly; they're
hopeless when it comes to libm functions <wink>.

> Does its use predate its appearance in C?

AFAIK the name 'frexp' originated there.

More information about the Python-list mailing list