in reply to max of N numbers?
Without comparison operators?
If you don't use them explicitly -- say something like#!perl use strict; use warnings; my $vector = (1,23, 3, 2.0**37, -1.0 * 10 ** (-41), 10.0**19); my $max; $max = $vector[0]; $max = $_ if $max > $_ foreach (@vector[1..$#vector]); print "$max\n";
You'll be comparing them implicitly with a call to a routine like
which uses comparisons internally.$max = max (@vector);
So the literal answer to your question is "no" you can't find the number with the largest or smallest value of a group of values without comparison operators. You can, however, hide the comparison operators in a function.
emc
"Being forced to write comments actually improves code, because it is easier to fix a crock than to explain it. "
|
|---|