trying to simplify an algorithm

Hui Zhou zhouhui at wam.umd.edu
Sun Feb 27 18:08:39 PST 2005


On Mon, Feb 28, 2005 at 01:36:32AM +0000, Johan V. wrote:
>How about:
>
>return ( a+b+c == 180 ) * (a>0) * (b>0) * (c>0) * 
>       ( 1 + (a==b) + (a==c) + (b==c) );
>
>0 : not a triangle
>1 : scalene
>2 : isosceles
>4 : equilateral

Very Clever! Except ...

1. Obscured
2. Wasting CPU clocks

-- 
Hui Zhou



More information about the lfs-chat mailing list