Re: getting the closest number to an increment of 25,000

2006-04-06 Thread One User
Closest number, which is SMALLER than a given num (round down): cfset down25 = 25000 * int(num/25000) Closest number, which is LARGER than a given num (round up): cfset up25 = 25000 * ceiling(num/25000) Closest number (round): cfset round25 = 25000 * int(0.5 + num/25000)

Re: getting the closest number to an increment of 25,000

2006-04-06 Thread Barney Boisvert
Closest number (round): cfset round25 = 25000 * int(0.5 + num/25000) You can just use round for this, instead of adding an then using int: cfset round25 = 25000 * round(num / 25000) / cheers, barneyb On 4/6/06, One User [EMAIL PROTECTED] wrote: Closest number, which is SMALLER than a given

Re: getting the closest number to an increment of 25,000

2006-04-06 Thread One User
Closest number (round): cfset round25 = 25000 * int(0.5 + num/25000) You can just use round for this, instead of adding an then using int: cfset round25 = 25000 * round(num / 25000) / cheers, barneyb On 4/6/06, One User [EMAIL PROTECTED] wrote: -- Barney Boisvert Of course. I use

getting the closest number to an increment of 25,000

2006-04-05 Thread Andy Matthews
I'm working on a site for a realtor. It has a search by price feature with a low and a high end. The realtor would like both dropdowns to start at the closest increment of $25,000 in the database so that the user could conceivably just hit the submit button and get results. Right now I'm

Re: getting the closest number to an increment of 25,000

2006-04-05 Thread Ryan Guill
i have to admit, i didnt read your whole thing, but maybe this will work. take the max, MOD 25000 to get the remainder, and then subtract that from the max... On 4/5/06, Andy Matthews [EMAIL PROTECTED] wrote: I'm working on a site for a realtor. It has a search by price feature with a low and

Re: getting the closest number to an increment of 25,000

2006-04-05 Thread Barney Boisvert
#ceiling(price / 25,000) * 25000# should give you the next higher, or the same value if it's already aligned at a 25,000 border. Just reverse it fro the lower bound. You can also use round, if you actually want rounding, but that's not the case here. cheers, barneyb On 4/5/06, Andy Matthews

Re: getting the closest number to an increment of 25,000

2006-04-05 Thread Jerry Johnson
divide top value by 25000, get the ceiling, and multiply by 25000? On 4/5/06, Andy Matthews [EMAIL PROTECTED] wrote: I'm working on a site for a realtor. It has a search by price feature with a low and a high end. The realtor would like both dropdowns to start at the closest increment of

Re: getting the closest number to an increment of 25,000

2006-04-05 Thread Ryan Guill
Actually, that will just give you the nearest one less than your max. to round up or down, take the max MOD 25000, get the remainder, see if the remainer is greater than or less than half of your rounding number, so 125000, if less than, subtract the remainder from the max, if it is more,

Re: getting the closest number to an increment of 25,000

2006-04-05 Thread Tony
start with this andy, and you can filter out the ones you dont want because they are too low, or too high based on the search value? cfloop from = 1 to = 100 step = 25000 index = i option value=#i#i /cfloop On 4/5/06, Andy Matthews [EMAIL PROTECTED] wrote: I'm working on a site for a

RE: getting the closest number to an increment of 25,000

2006-04-05 Thread Andy Matthews
Thanks everyone. That should work! !//-- andy matthews web developer ICGLink, Inc. [EMAIL PROTECTED] 615.370.1530 x737 --//- -Original Message- From: Andy Matthews [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 05, 2006 1:53 PM To: CF-Talk