How to get mantissa?

P

Peng Yu

Hi,

I'm wondering if there is any standard function that computes mantissa
a floating point number. I could use x - floor(x), suppose x is a
floating number. But this involves an additional floating point
operation (minus).

Thanks,
Peng
 
A

Anarki

Hi,

I'm wondering if there is any standard function that computes mantissa
a floating point number. I could use x - floor(x), suppose x is a
floating number. But this involves an additional floating point
operation (minus).

Thanks,
Peng


http://steve.hollasch.net/cgindex/coding/ieeefloat.html

Once you read that page u get the idea of bit structure of a floating
point number then use masking technique using bitwise operators and
the required result u need. This way i believe it will be more faster
than the method u trying to use(x - floor(x)).
 
J

James Kanze

I'm wondering if there is any standard function that computes
mantissa a floating point number. I could use x - floor(x),
suppose x is a floating number. But this involves an
additional floating point operation (minus).

I'm not sure what you mean by the mantissa, since the expression
you give doesn't correspond to the usual definition. Anyway,
depending on what you really want, you might want to consider
frexp or modf.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top