| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.server -> Re: truncate 20 bits to 10 bits
On Sat, 18 Feb 2006 05:04:02 -0800, mmt1 wrote:
> Hi.
> I have a multiplier that multiplies 2 floating point numbers with 7
> bits exponent and 10 bits mantissa.so its output has 7 bits exponent
> and 20 bits mantissa.
> now its output must return to its input in order to compute another
> multiplication.on the other hand its output must be truncated to 10
> bits. how can I do this? please help me.
> thanks.
Dividing things by 1024 would be a way of doing it. That is equivalent to the right shift for 10 places. It looks something like this:
#include <stdio.h>
main ()
{
int a = 1048576;
int b = a >> 10;
printf ("B is:%d\n", b);
b = a / 1024;
printf ("B is:%d\n", b);
}
$ gcc -O3 ttt.c -o ttt;./ttt
B is:1024
B is:1024
You chose a wrong newsgroup. Questions like this belong to MS SQL Server group or AutoCAD group, not an Oracle group.
-- http://www.mgogala.comReceived on Sat Feb 18 2006 - 21:49:46 CST
![]() |
![]() |