Click here to Skip to main content
15,897,891 members
Articles / Programming Languages / C++

Multiplication of Floating point numbers in Binary format in C++

Rate me:
Please Sign up or sign in to vote.
4.33/5 (3 votes)
13 Jan 2013CPOL 0  
I assume you talk about IEEE 754[^] floating point numbers.Such a number hassignmantissaexponent (which is shifted by a bias)some special values that indicate +/- infinity, not-a-number (NaN)Leaving away the special cases, you must knowhow the sign, mantissa, and exponent...

Alternatives

Members may post updates or alternatives to this current article in order to show different approaches or add new features.

Please Sign up or sign in to vote.
14 Jan 2013Andreas Gieriet
In my first solution to your question I took your question too literal: you ask for a floating point solution.Reading now your expected result shows that you in fact talk about a fixed point problem.A fix point approach places the separation between integral part and the fraction part at a...
Please Sign up or sign in to vote.
13 Jan 2013H.Brydon
Call me paranoid but I did not follow your link (sorry).By "floating point", I assume you are talking about an arbitrary number of digits in "xxx.xxx" format and not the floating point values stored in float and double values, which are handled by machine hardware.The first thing you...
Please Sign up or sign in to vote.
12 Jan 2013Alfred16 3 alternatives  
I am required to write a code which multiplies two floating point numbers in binary format. The code works fine when I give an integer input, but doesn't give correct result for floating point input. When I give an input for example:3.2 and 12.2I am getting this...

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Founder eXternSoft GmbH
Switzerland Switzerland
I feel comfortable on a variety of systems (UNIX, Windows, cross-compiled embedded systems, etc.) in a variety of languages, environments, and tools.
I have a particular affinity to computer language analysis, testing, as well as quality management.

More information about what I do for a living can be found at my LinkedIn Profile and on my company's web page (German only).

Comments and Discussions