Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: max of N numbers?

by spiritway (Vicar)
on May 27, 2006 at 18:14 UTC ( [id://552018]=note: print w/replies, xml ) Need Help??


in reply to max of N numbers?

Depends on what you mean by "quick"; and it also depends on how you define "comparison operators". You *could* use the spaceship operator ( '<=>' )and sort the list of numbers. That involves, of course, a comparison. You could convert all the values into strings, with leading zeroes sufficient to ensure all the numbers have the same number of digits before the decimal point; then sort as before; this sort uses an implicit comparison. I'm not sure how quick these sorts would be.

The question that seems more important is why you would want to perform a comparison task, without using operators that are wholly appropriate for that purpose. Unless you meant, not having to use the '=', '>' and '<' operators separately...

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://552018]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2024-04-19 03:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found