如何将两个定点数相乘? [英] How do you multiply two fixed point numbers?

查看:361
本文介绍了如何将两个定点数相乘?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在尝试找出如何在定点表示形式中将两个数字相乘.

I am currently trying to figure out how to multiply two numbers in fixed point representation.

说我的数字表示法如下:

Say my number representation is as follows:

[SIGN][2^0].[2^-1][2^-2]..[2^-14]

在我的情况下,为数字10.01000000000000 = -0.25.

In my case, the number 10.01000000000000 = -0.25.

例如,我该怎么做0.25x0.25-0.25x0.25等?

How would I for example do 0.25x0.25 or -0.25x0.25 etc?

希望您能提供帮助!

推荐答案

乘以一个更大的变量,然后右移定点精度的位数.

Multiply into a larger sized variable, and then right shift by the number of bits of fixed point precision.

这篇关于如何将两个定点数相乘?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆