COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

Difference between SAR and IDIV???

• Email
• Follow

```Hello all,

can anyone explain the difference between SAR and IDIV. From my quick
reference booklet I see that both do signed divisions by 2 ... what confuses
me is the rounding operation. For SAR my booklet says that it does this
division with "rounding toward negative infinity" while for the IDIV
instruction it says that non integral quotients are truncated toward 0.

Thank you.

Bob Rock

```
 0
Reply Bob 9/2/2003 6:17:40 PM

See related articles to this posting

```> can anyone explain the difference between SAR and IDIV. From my
> quick reference booklet I see that both do signed divisions by 2
> ... what confuses me is the rounding operation. For SAR my
> booklet says that it does this division with "rounding toward
> negative infinity" while for the IDIV instruction it says that
> non integral quotients are truncated toward 0.

How can you divide by 7 with SAR?

```
 0
Reply Nudge 9/2/2003 8:46:22 PM

```> can anyone explain the difference between SAR and IDIV. From my quick
> reference booklet I see that both do signed divisions by 2 ... what
confuses
> me is the rounding operation. For SAR my booklet says that it does this
> division with "rounding toward negative infinity" while for the IDIV
> instruction it says that non integral quotients are truncated toward 0.

number    to -inf.    to 0
+4.6        +4        +4
+4.4        +4        +4
+0.1        0         0
-0.1        -1        0
-4.4        -5        -4
-4.6        -5        -4

```
 0
Reply Bx 9/2/2003 10:46:33 PM

```On Tue, 2 Sep 2003 20:17:40 +0200
"Bob Rock" <nospam.yet_another_apprentice@hotmail.com> wrote:

:can anyone explain the difference between SAR and IDIV. From my quick
:reference booklet I see that both do signed divisions by 2

IDIV can also divide by a lot of other numbers, but I will assume that you
already know that. :-)

:... what confuses
:me is the rounding operation. For SAR my booklet says that it does this
:division with "rounding toward negative infinity" while for the IDIV
:instruction it says that non integral quotients are truncated toward 0.

The description makes the instructions sound more complicated than they
really are. To begin with, neither instruction does any actual rounding.
However, if the programmer ignores the remainder from the IDIV, or the
carry from the SAR, then the result can be said to be truncated or rounded.
If you don't like the default behavior, you can test the carry or the
remainder, and do your own rounding.

In addition, the distinction between "rounding toward negative infinity"
and "truncated toward 0" is only meaningful when dealing with negative odd
numbers, and stems from the fact that IDIV was designed to be aware how
negative numbers are represented, while SAR is just shifting an arbitrary
string of bits, and propagating the high order bit as it does so.

>From a practical point of view, using a shift instruction in place of a
divide instruction is a trick which can be used in certain situations when
speed is more important than

-- Chuck

```
 0
Reply Charles 9/2/2003 11:37:28 PM

3 Replies
610 Views

Similar Articles

12/6/2013 6:45:35 PM
page loaded in 53954 ms. (0)

Similar Artilces:

difference between jdk1.5.06 and jdk1.5.02
i encountered an interesting problem during my s/w development, I had some calulation part whose result is a double value.The result is different on difeerent versions of jdk (jdk1.5.06 and jdk1.5.02). thanks in advance manzur On Thu, 09 Nov 2006 10:25:16 -0000, manzur <manz_21@yahoo.co.in> wrote: > i encountered an interesting problem during my s/w development, > I had some calulation part whose result is a double value.The result is > different on difeerent versions of jdk (jdk1.5.06 and jdk1.5.02). > On the same machine? Dan. -- Daniel Dyer http://www.dandyer.co

share object between DLLs

conflict between beamer and acronym?
Hello. I know it's hard to believe, but a search of the archive revealed nothing... Is there a conflict between the acronym package and the beamer class? I get stuck in an endless loop of errors/warnings. __ ! Use of \beamer@finalspec doesn't match its definition. __ Any ideas? Thank you for your help. adam

The difference between corr2 and normxcorr2
Hi, all: Could anyone tell the difference between corr2 and normxcorr2? My basic understanding is that corr2(A,B) is to calculate the correlation coefficient while normxcorr2(A,B) is to calculate the normalized cross correlation. But the help file on normxcorr2 didn't tell the formula of normxcorr2. I am confused with the two functions after I saw the link http://www.idiom.com/~zilla/Papers/nvisionInterface/nip.html . Seems to me they are the same????????? Thanks a lot! Hi, The two functions are not exactly the same. For starters, normxcorr2 has a check to see if it is faster to run the correlation in the time or frequency domain. This can be handy for large, non-power-of-two matrices, and usually makes normxcorr2 faster (often MUCH faster). Another difference is that the output in normxcorr2 is scaled between zero and one. For reasons I do not entirely understand, the lag position of the maximum amplitude peak appears in mirrored locations when the two functions are compared. The maximum amplitude peak will show up in the same (x,y) location if you do cnorm = normxcorr2(a,b); c = xcorr2(b,a); I am interested to know what else you find out. You can email

difference between a handler and an object
can anyone please tell me the difference between a handler and an object in detail...?

Diference Between Community and enterprice
Hi, I've a server with MySQL Community installed. I host 115 DB for web applications (Mambo Portal) I've notice that the server sometimes become very slow for this service. The server is a Dual Xeon 3,2 dualcore with 2,5 gb di RAM with SCSI 360 HDD in RAID5. My question is: is because the MySQL is the community ed. and so it has some limitations in the number of DB? Thanks Andrea wrote: > Hi, > I've a server with MySQL Community installed. > I host 115 DB for web applications (Mambo Portal) > I've notice that the server sometimes become very slow for this se

Difference between WICs and VWICs
Actually, I know what some of the differences are, but here's what I'd really like to know: does running VoIP require using VWICs, or can you use WICs? I'm talking about VoIP over T1s, and if routers equiped with WICs can do LLQ and other kinds of QoS needed for voice traffic, or if only VWICs have that capability. Thanks. <ttripp@magnoliamanor.com> wrote in message news:1152215471.988604.248510@m79g2000cwm.googlegroups.com... > Actually, I know what some of the differences are, but here's what I'd > really like to know: does running VoIP require using VWICs

Performance Difference between machines
I was running some performance tests for the web application I work on, both on my desktop and laptop. I found that javascript processes MUCH slower on my desktop, even though it's a more powerful machine. The stats are as follows: Laptop: Pentium M, 1.86gHz, 1gb RAM, IE7 Desktop: Pentium 4, 2.80gHz, 1gb RAM, IE6 I have confirmed that co-workers with similar setups show the same results. Also, when I run javascript tests on both boxes (from http://andrew.hedges.name/experiments/speed_test/index.html and others), my laptop returns a time of approximately 50% of my desktop. Also, if I tes

communication between windows and linux
hi, i would like to know how to communicate between two processes, one running on a linux machine and one running on a windows machine, using java sockets. an example code would be helpful. thanks -nachiketh "Nachiketh" <nachikethg@yahoo.com> wrote in message news:4e4925fb.0404280621.35789527@posting.google.com... > hi, > i would like to know how to communicate between two processes, one > running on a linux machine and one running on a windows machine, using > java sockets. an example code would be helpful. > thanks > -nachiketh lazy ???? goto library... to communicate between two processes, one > running on a linux machine and one running on a windows machine, using > java sockets. an example code would be helpful. > thanks > -nachiketh "Liz" <Liz@nospam.com> wrote in message news:<q9Tjc.3910\$kp.108080@attbi_s52>... > "Nachiketh" <nachikethg@yahoo.com> wrote in message > news:4e4925fb.0404280621.35789527@posting.google.com... > > hi, > > i would like to know how to communicate between two processes, one > > running on a linux machine and one running on a windows machine

Difference between SCP and SFTP ?
Hi, Some users need to use SCP instead of SFTP for transfering files. Actually all users have noshell, in order to avoid logind. But It's seems that SCP need a user Shell, Is it true ? If yes Can i create a restricted Shell and give people, that shell with restricted command. Ps: What's the difference between scp and SFTP. Thanks and Best regards In article <5573513d.0502061059.30521ff0@posting.google.com>, akim_ziadi@hotmail.com (mika) wrote: *SNIP* >But It's seems that SCP need a user Shell, Is it true ? Yes. scp uses the SSH system for login, and that requires a valid shell. I believe you will find that sftp does too. *SNIP* >Ps: What's the difference between scp and SFTP. > scp is a replacement for rcp, and is used to do batch file transfers in a non-interactive way. This means that the user or application needs to know the name and location of the file/s they wish to transfer before they commence. sftp is just FTP over SSH. You can browse the directory structure and get file listings before getting or sending files. -- Matthew Poole Auckland, New Zealand "Veni, vidi, velcro... I came, I saw, I