in reply to Re: Generating Visually Distinct Colors
in thread Generating Visually Distinct Colors

Um, what's with that ceil() function? int($x+2)? I'd feel much safer with
sub ceil (Num $x) { $x == int($x) ?? $x :: int($x+1) }
I'm pretty sure that's the appropriate P6 code.
_____________________________________________________
Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart

Replies are listed 'Best First'.
Re^3: Generating Visually Distinct Colors
by polettix (Vicar) on Mar 22, 2005 at 18:47 UTC
    In Perl 5, ceil is in package POSIX and it is (together with floor) the recommended way to do a unilateral round towards an integer. For what I can remember, the use of int for this is discouraged even in Perl (5) documentation, due to the fact that its behaviour is not consistent between positive and negative numbers (it only cuts decimals away).

    I don't know if this has been changed in Perl 6, but I think that I'll stick to the library ceil anyway.

    Flavio

    -- Don't fool yourself.
      Yes, I use ceil(), I was commenting on the very bizarre P6 ceil-equivalent.
      _____________________________________________________
      Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
      How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart