RE: Max value of 3 variables

2005-04-15 Thread Michael T. Tangorre
From: G [mailto:[EMAIL PROTECTED] Got three variables passed into me, all are decimal values. What is the quickest and most elegant way of determining which of the variables holds the largest value? Max(Max(number1, number2),number3) Mike

Re: Max value of 3 variables

2005-04-15 Thread G
ty MT. From: G [mailto:[EMAIL PROTECTED] Got three variables passed into me, all are decimal values. What is the quickest and most elegant way of determining which of the variables holds the largest value? Max(Max(number1, number2),number3) Mike

RE: Max value of 3 variables

2005-04-15 Thread Ewok
Max() should do it if you're not going to eventually have more values. Think it can only take 2 values so nest them like max(max(no1, no2), no3) If its going to be more... just loop them, if the currnent value is larger than the previous, set it to the max... cfset max = 0 cfloop

RE: Max value of 3 variables

2005-04-15 Thread Calvin Ward
For flexibility, how about this: ListFirst(ListSort(numbers,'numeric')) -Calvin -Original Message- From: Ewok [mailto:[EMAIL PROTECTED] Sent: Friday, April 15, 2005 9:10 AM To: CF-Talk Subject: RE: Max value of 3 variables Max() should do it if you're not going to eventually have more

RE: Max value of 3 variables

2005-04-15 Thread Paul
Or #arrayMax(listToArray(numbers))# -Original Message- From: Calvin Ward [mailto:[EMAIL PROTECTED] Sent: Friday, April 15, 2005 7:18 AM To: CF-Talk Subject: RE: Max value of 3 variables For flexibility, how about this: ListFirst(ListSort(numbers,'numeric')) -Calvin -Original

RE: Max value of 3 variables

2005-04-15 Thread Rick Faircloth
the maximum value first in the list? Rick -Original Message- From: Paul [mailto:[EMAIL PROTECTED] Sent: Friday, April 15, 2005 10:44 AM To: CF-Talk Subject: RE: Max value of 3 variables Or #arrayMax(listToArray(numbers))# -Original Message- From: Calvin Ward [mailto:[EMAIL

RE: Max value of 3 variables

2005-04-15 Thread Calvin Ward
It should, but you'll probably actually have to add the desc attribute at the end of my suggestion. - Calvin -Original Message- From: Rick Faircloth [mailto:[EMAIL PROTECTED] Sent: Friday, April 15, 2005 11:08 AM To: CF-Talk Subject: RE: Max value of 3 variables Or #arrayMax

Re: Max value of 3 variables

2005-04-15 Thread Keith Gaughan
Calvin Ward wrote: For flexibility, how about this: ListFirst(ListSort(numbers,'numeric')) If we were talking about a lower-level language, I'd warn against that way of doing it. On average, ListSort() takes O(nlogn) to sort a list, whereas scanning the list with cfloop as below will be done in

RE: Max value of 3 variables

2005-04-15 Thread Justin D. Scott
ListFirst(ListSort(numbers,'numeric')) It should, but you'll probably actually have to add the desc attribute at the end of my suggestion. Or use listLast() instead. -Justin ~| Logware (www.logware.us): a new and

Re: Max value of 3 variables

2005-04-15 Thread Keith Gaughan
Rick Faircloth wrote: Or #arrayMax(listToArray(numbers))# For flexibility, how about this: ListFirst(ListSort(numbers,'numeric')) And how, exactly, would these assist in obtaining the top value of 3 numbers? Does arrayMax put the maximum value first in the array? No, it searches the

RE: Max value of 3 variables

2005-04-15 Thread Paul
arrayMax returns the largest numeric value in an array. http://livedocs.macromedia.com/coldfusion/7/htmldocs/0388.htm -Original Message- From: Rick Faircloth [mailto:[EMAIL PROTECTED] Sent: Friday, April 15, 2005 9:08 AM To: CF-Talk Subject: RE: Max value of 3 variables

RE: Max value of 3 variables

2005-04-15 Thread Rick Faircloth
Gotcha...thanks... Rick -Original Message- From: Keith Gaughan [mailto:[EMAIL PROTECTED] Sent: Friday, April 15, 2005 11:36 AM To: CF-Talk Subject: Re: Max value of 3 variables Rick Faircloth wrote: Or #arrayMax(listToArray(numbers))# For flexibility, how about