Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
Solved

# rounding down function?

Posted on 2003-10-22
Medium Priority
279 Views
i have the following two variables that are both integers.

1. points
2. entries

#1, points has an initial value of 0.
#2, entries has an initial value of 1.

i want to make it so that for every 25 points, entries goes up by 1.

is there a cold fusion function that will round down.

meaning if they have 77 points, that would come out to (77/25) + 1 = 4.08 entries,
but i need it to come out as 4 entires. the + 1 is there because of the entries variable starts out at 1.

0
Question by:Judy Deo
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points

LVL 3

Accepted Solution

SewellM earned 800 total points
ID: 9599975
#int((77/25) + 1)# would return 4.

The int() function only returns the integer part of the value.  No rounding.

Michael
0

LVL 9

Assisted Solution

ID: 9599981
if you use #round(evaluate( (77/25) + 1))#

let me know if this helps.
0

LVL 9

Assisted Solution

ID: 9600005
int(4.5) will output 4
and
round(4.5) will output 5
0

Author Comment

ID: 9600016
would the Fix function also work?
0

LVL 9

Assisted Solution

ID: 9600167
the fix function works like this
#fix(4.5)#=4
0

LVL 17

Assisted Solution

anandkp earned 500 total points
ID: 9600764
u have 4 functions fix, cileing, int & round

go for int - if u always want integer value
go for fix - if u want least integer value
go for cieling - if u want the next integer value
go for round - if u plan to round of to nearest integer

ur call :)

Cheers
Anand
0

LVL 10

Assisted Solution

Mause earned 100 total points
ID: 9605789
you can also do this:

<cfset result = (77 \ 25)>
result will be 3

And ofcourse

<cfset rest = (77 mod 25)>
rest will be  2

Mause
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
###### Suggested Courses
Course of the Month9 days, 15 hours left to enroll