Re: Which is more Accurate for Centering images

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: MikeD (nobody_at_nowhere.edu)
Date: 06/23/04


Date: Wed, 23 Jun 2004 08:09:13 -0400


"Karproxid" <uce@ftc.gov> wrote in message
news:01c45918$5b21b780$0711ba3f@cooper...
> Truncating:
> Call .Move((Screen.Width - .Width) \ 2, (Screen.Height - .Height) \ 2)
>
> OR Rounding:
> Call .Move((Screen.Width - .Width) / 2, (Screen.Height - .Height) / 2)

Next time, please ask your question in the message body. The subject should
be just that....a subject. A question usually makes for a very bad subject.

It depends on the ScaleMode setting. If the scale mode is twips or pixels
(or a user mode in which there's no decimal portion), accuracy is the same.
However, integer division is more efficient so you should always use integer
division when possible.

Mike



Relevant Pages

  • Re: Pixel Mania
    ... In the case of the friend of mine who asked for my help, he wasn't even using integer division in his code. ... But VB was nevertheless performing this "decimal to integer" rounding for him. ... In his particular case he was running a standard integer "Step 1" For Next loop for some pixel plotting code and within the loop he was adding a floating point value that quite often had a value such that the decimal part of it was exactly 0.5. ...
    (microsoft.public.vb.general.discussion)
  • Re: ADO.NET Expressions fall short
    ... In there I used a simple rounding mechanism to evaluate a 2 digit decimal ... > 2) Integer division ... Failing to find support for that, ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: division by 7efficiently
    ... So if you repeat "add N>>3 and shift the result 3 places ... There is still the problem of rounding, ... Note, also, that the above rounds the result, so it is not the same as ... You can get closer to integer division if you only ...
    (comp.theory)
  • Re: round to mearest 5%
    ... Built in rounding function round to a set number of decimal places. ... next, but it is a back-slash, which is integer division, so the result ... Tom Ellison ...
    (microsoft.public.access.queries)