Trying to round up

  • Thread starter Thread starter carlo
  • Start date Start date
C

carlo

Hi All

I have a query in which I would like to round a calculation always up:

1 = 1
1.00000000000000000000000000000001 = 2
1.5 = 2
1.9999 = 2
2 = 2

I could do : int(x-0.000000000001) + 1
but I can't believe, that this is the best, or the only possibility.

how would you do that?

Thanks for your help, appreciate it

Carlo
 
Hi All

I have a query in which I would like to round a calculation always up:

1 = 1
1.00000000000000000000000000000001 = 2
1.5 = 2
1.9999 = 2
2 = 2

I could do : int(x-0.000000000001) + 1
but I can't believe, that this is the best, or the only possibility.

how would you do that?

Thanks for your help, appreciate it

Carlo

Since Int() always rounds down, use a double negative:

-Int(-x)

-1.5 will round - down! - to -2; -1 will round to -1.

John W. Vinson [MVP]
 
Back
Top