Link to home
Start Free TrialLog in
Avatar of Mamea
Mamea

asked on

Ceiling Tag

Hi,

I inherited an application and I am looking at the following code that is calculating the number of questions you must answer correctly so you can pass the test.

#ceiling(getquestions.recordcount*request.passingpercent/100)#

request.passingpercent is always 75

for this example getquestions.recordcount is 67.

When you do the mathematical computation the answer is 50.25. Why is the tag rounding this up to 51? What I need to be displayed is 50 because if you have a test of 67 questions you have to answer 50 or more to pass (and passing is 75%).

Thanks

Thanks
SOLUTION
Avatar of erikTsomik
erikTsomik
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
try using round
<cfoutput>#round(67*(75/100))#</cfoutput>
Avatar of js_vaughan
js_vaughan

Ceiling() will always round up to the nearest whole number.  so even 50.01 will round up to 51.  If you want to always round down, use Int().  Use Round() to just round to the nearest whole number (either up or down)
also you can read this
http://kb.adobe.com/selfservice/viewContent.do?externalId=kb401292 but I think you better of with my above post
Just change ceiling( to int(
SOLUTION
Avatar of gdemaria
gdemaria
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mamea

ASKER

Thank you all for your help! I appreciate it!