Re: Rounding numbers



In general:

Multiply the number by a power of 10 factor
Take the integer value of the result plus a half
Divide by that power of 10 factor

eg, in your example ...

int(0.5 + 55.3456*100)/100

or

int(0.5 + 0.0323*1000)/1000


Bob

"Nicholas Gravagne" <gravagnegang@xxxxxxxxxxxxxxxx> wrote in message
news:Yx6Qi.212616$ax1.118323@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hello all,

RE VB5

How does one round up or down a number, say 55.3456 to 55.35, or .0323 to
.032

I have searched thru formating options but do not see a way yet.

Thanks

Nick



.



Relevant Pages

  • Re: What a bunch of fuckwits our former government was
    ... on with every left and right wing government shift of power. ... Every one who enters politics, no matter how righteous, ... They're masters at controlling the public through things like the media that constantly divide us. ...
    (alt.guitar)
  • Re: What a bunch of fuckwits our former government was
    ... on with every left and right wing government shift of power. ... Every one who enters politics, no matter how righteous, ... They're masters at controlling the public through things like the media that constantly divide us. ...
    (alt.guitar)
  • Re: Converting 7v DC to 7v AC at 50-60Hz
    ... How do i invert DC to AC? ... need a 50% duty cycle, or they don't work, at all. ... Divide by 1000 and yo have 60 Hz. ... Use a 78L05 voltage regulator to power the oscilator & divider, ...
    (sci.electronics.basics)
  • Re: two graycode functions: always same result?
    ... If the numerator is positive, then dividing by a power of two is ... Fortran integer divide *must* truncate toward zero ... Signed magnitude implementations won't match divide (unless the shift ...
    (comp.lang.fortran)
  • Re: Re: you wont recommend me advertising on to your profitable south-east
    ... two almost divide the kind; ... He sighs for freedom, she for power. ... seem our equals. ... found, there we see that men rule, and women are ruled, and that on this ...
    (rec.skydiving)