need a built in function to fix a number to its upper number

  • Thread starter Thread starter Mota
  • Start date Start date
M

Mota

Hi;
I want to get the nearest greater number from a fractional number.For
example,getting 4 from 3.2
It is to find the pages number of a report while its not open,based on the
RecordCount of its RecordSource.
Is there a Built in function to do this for me?
Thank you for your help.
 
Out of curiosity: How does Record Count ever get to be fractional? It is
always a whole number by definition.
 
Try this
Int(MyNumber + 0.5)

That doesn't do what Mota asked (e.g. 3.2 --> 4). Something like this
should do the job:

Int(X) + Sgn(X - Int(X))

If it doesn't produce the desired results when X < 0, replace Int() with
Fix().
 
You are right, I am sure I tried it and it gave the right resault
So in that case you can use

round(MyNumber + 0.5)
 
I felt that my version would be faster because it avoids the
(comparatively) slow and complicated floating point operations of
Round(). Some casual esting suggests that it is ... but that the
difference is only significant if you've got a loop that's calling the
expression many thousands of times.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top