[ ... ]
Not really. I don't know of any mainframe which uses base 2
for its floating point: IBM uses base 16, and both Unisys
architectures use base 8; Unisys MCP also normalizes in a
somewhat strange way. The fact that the bases are powers of
two means that the operation can still be done with masking
and shifting, but it requires a bit more than a base 2
representation would.
You start by saying "not really", but from what I can see, you
then go on to pretty much confirm what I said -- that while
these machines aren't binary, they still work in a power of
two, which means that frexp/ldexp will probably be faster than
pow() for all of them.
The algorithm you described only applies to machines with base 2
floating point, not base 8 or 16. And IBM mainframes aren't
"pretty unusual", they're the most common mainframe around. (I
think that Unisys is second in the market, and the Unisys MCP
does have a somewhat exotic representation, normalizing with the
decimal to the right, and not to the left, and not requiring
normalization at all---the idea is that an integer and a
floating point have the same bitwise representation.)
As for speed compared to pow(), I don't know. Depending on the
speed of hardware floating point and how much support the
hardware has for pow, it could vary. A lot of 32 bit processors
had one clock hardware support for the four basic operations,
but it was fairly expensive to shift 64 bits. (On at least one
processor I worked on, all shift operations were done with a
loop in microcode.) Of course, that's not the case of IBM
mainframes, which support 64 bit shifts directly as well. (But
IIRC, it's 64 bit shifts were optimized for, and maybe only
supported, multiples of four bits---for normalizing BCD values,
etc.)
I have to admit I'm a bit surprised though -- I thought IBM's
mainframes used decimal floating point, not hexadecimal...
They may have both, but the floating point I've always seen was
base 16. And the IMB compatibles from Siemens and Fujitsu, back
when I worked on them, didn't have a single instruction for
decimal floating point (although the instruction set did allow
implementing it in five or six instructions, without any loops,
even for division, since the machines did have fixed point
decimal instructions, and 64 bit shifts).
Of course, this was all a fairly long time ago---I've not had
the occasion to look at the IBM instruction set since then---,
so the situation could easily have changed.