Link to home
Start Free TrialLog in
Avatar of jazzIIIlove
jazzIIIloveFlag for Sweden

asked on

median of 2 numbers. how to?

I have 2 numbers and trying to find median of those two eithout taking average manually but with built in functions. Any functions in javascript or prolog?

REGARDS.
ASKER CERTIFIED SOLUTION
Avatar of TommySzalapski
TommySzalapski
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
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 jazzIIIlove

ASKER

Please assume they are sorted and only 2 numbers.


Regards.
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
the definition of median function for an even number of values may be arbitrary. sometimes, it is required that the median value matches at least one of the values of the set. if so, for an even count you may have two medians (low and high) which are the two middle values of the sorted set.

Sara
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