Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

how to do fixed point multiply C code?

Status
Not open for further replies.

boeysue

Full Member level 3
Joined
Dec 23, 2004
Messages
187
Helped
3
Reputation
6
Reaction score
0
Trophy points
1,296
Activity points
1,523
Is the following correct??

x.data=a.data *b.data;
x.wordlen=a.wordlen+b.wordlen;
x.fractlen=a.fractlen + b.fractlen;

??


Bcz My answer seems wrong...so help....~~
 

Maybe yes, maybe no. Need more info.
Please post a small, complete program, and tell us what answer you expected and what answer you got.
 

Your code is correct if
type of x.data is correct
What I maen is "if type of a.data and b.data is same lets say unsigned int (32 bits)
then type of x.data must be long long unsigned int (64 bits)
Hope this help
 

nand_gates said:
What I maen is "if type of a.data and b.data is same lets say unsigned int (32 bits)
then type of x.data must be long long unsigned int (64 bits)

That wouldn't work. You have to cast at least one of the multiplicands to the larger integer type *before* multiplying them.
 

mmm..
What I want is a general equation for all Q.format ....such as [16 18],[16 0],..[16 15],..........Is there any information about it?thanks for that.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top