in reply to Re^3: Opinion: where Perl5 wasn't attractive for me
in thread Opinion: where Perl5 wasn't attractive for me
$/ = " "; $y = 2; while($x = <DATA>){ chop $x; print $num = ($x - $x % $y) / $y xor print " " xor print $num = int $x / $y xor print "\n" } __DATA__ -3 -2 -1 0 1 2 3
Yes. I like that Perl has sqrt.Output: -2 -1 -1 -1 -1 0 0 0 0 0 1 1 1 1
UPDATE: seems that my approach was not int_div, but floor.
|
|---|