473,385 Members | 1,912 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to get mantissa?

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
Jul 15 '08 #1
2 9987
On Jul 15, 9:50*am, Peng Yu <PengYu...@gmail.comwrote:
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)).
Jul 15 '08 #2
On Jul 15, 6:50 am, Peng Yu <PengYu...@gmail.comwrote:
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.

--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
Jul 15 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

20
by: Mike Meyer | last post by:
This version includes the input from various and sundry people. Thanks to everyone who contributed. <mike PEP: XXX Title: A rational number module for Python Version: $Revision: 1.4 $...
0
by: JackRazz | last post by:
Is there a function to extract the mantissa and exponent from a double like the frexp function does in other languages (c++ & Python)? Thanks - JackRazz
5
by: sankar | last post by:
Hi, I am using a Q14.18 value. There are tables used in my program which are being indexed by the exponent and mantissa parts of the corresponding floating point value. So how can I get the...
2
by: fzmaster | last post by:
Actually i need to know how to detect if a number is a perfect square. But i'v been thinking.. if i sqrt(x) and check if this result has mantissa... so it is not a interger...and surely not a...
1
by: areej | last post by:
hi ppl am new in learning C++ n i hvent got any clue abt the range of floating no'z so can any one help me out? how we find range of floating point no'z? regardz areej
11
by: Ole Nielsby | last post by:
First, sorry if this is off-topic, not strictly being a C++ issue. I could not find a ng on numerics or serialization and I figure this ng is the closest I can get. Now the question: I want...
25
by: Digital Puer | last post by:
I'm getting a very weird bit corruption in a double. I am on an Intel Red Hat Linux box. uname -a returns: Linux foo.com 2.6.9-34.0.2.ELsmp #1 SMP Fri Jun 30 10:33:58 EDT 2006 i686 i686 i386...
28
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I convert a Number into a String with exactly 2 decimal places?...
18
by: Carramba | last post by:
Hi! is there a better/faster way to compare mantissas of to real number then in following code? #include <stdio.h> #include <stdlib.h> int main(void) { float a,b; int test;
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.